#pragma once
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdlib.h>
#include <stdio.h>


dim3 *dim3Ctr(int x, int y = 1, int z = 1)
{
	dim3 *a;
	a = (dim3 *)malloc(sizeof(dim3));
	a->x = x;
	a->y = y;
	a->z = z;
	return a;
}

dim3 *dim3Unit()
{
	dim3 *a;
	a = (dim3 *)malloc(sizeof(dim3));
	a->x = 1;
	a->y = 1;
	a->z = 1;
	return a;
}

int dim3Vol(dim3 *a)
{
	return a->x * a->y * a->z;
}

void printDim3(dim3 *yow)
{
	printf("yow: {%d, %d, %d}", yow->x, yow->y, yow->z);
}


int ThreadChop2d(int width)
{
	if (width > 255)
		return 16;
	if (width > 63)
		return 8;
	if (width > 15)
		return 4;
	if (width > 3)
		return 2;
	return 1;
}

	.file	"tmpxft_00292813_00000000-6_BlockUtils.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z7dim3Ctriii
	.type	_Z7dim3Ctriii, @function
_Z7dim3Ctriii:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%edi, %r12d
	movl	$12, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edx, %ebx
	call	malloc@PLT
	movl	%r12d, (%rax)
	movl	%ebp, 4(%rax)
	movl	%ebx, 8(%rax)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z7dim3Ctriii, .-_Z7dim3Ctriii
	.globl	_Z8dim3Unitv
	.type	_Z8dim3Unitv, @function
_Z8dim3Unitv:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$12, %edi
	call	malloc@PLT
	movabsq	$4294967297, %rdx
	movq	%rdx, (%rax)
	movl	$1, 8(%rax)
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z8dim3Unitv, .-_Z8dim3Unitv
	.globl	_Z7dim3VolP4dim3
	.type	_Z7dim3VolP4dim3, @function
_Z7dim3VolP4dim3:
.LFB2029:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	imull	4(%rdi), %eax
	imull	8(%rdi), %eax
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z7dim3VolP4dim3, .-_Z7dim3VolP4dim3
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"yow: {%d, %d, %d}"
	.text
	.globl	_Z9printDim3P4dim3
	.type	_Z9printDim3P4dim3, @function
_Z9printDim3P4dim3:
.LFB2030:
	.cfi_startproc
	endbr64
	movl	4(%rdi), %ecx
	movl	8(%rdi), %r8d
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	movl	(%rdi), %edx
	movl	$2, %edi
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z9printDim3P4dim3, .-_Z9printDim3P4dim3
	.globl	_Z12ThreadChop2di
	.type	_Z12ThreadChop2di, @function
_Z12ThreadChop2di:
.LFB2031:
	.cfi_startproc
	endbr64
	movl	$16, %eax
	cmpl	$255, %edi
	jg	.L8
	movl	$8, %eax
	cmpl	$63, %edi
	jg	.L8
	movl	$4, %eax
	cmpl	$15, %edi
	jg	.L8
	xorl	%eax, %eax
	cmpl	$3, %edi
	setg	%al
	incl	%eax
.L8:
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z12ThreadChop2di, .-_Z12ThreadChop2di
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2057:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2057:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#pragma once
#include "hip/hip_runtime.h"

#include <stdlib.h>
#include <stdio.h>


dim3 *dim3Ctr(int x, int y = 1, int z = 1)
{
	dim3 *a;
	a = (dim3 *)malloc(sizeof(dim3));
	a->x = x;
	a->y = y;
	a->z = z;
	return a;
}

dim3 *dim3Unit()
{
	dim3 *a;
	a = (dim3 *)malloc(sizeof(dim3));
	a->x = 1;
	a->y = 1;
	a->z = 1;
	return a;
}

int dim3Vol(dim3 *a)
{
	return a->x * a->y * a->z;
}

void printDim3(dim3 *yow)
{
	printf("yow: {%d, %d, %d}", yow->x, yow->y, yow->z);
}


int ThreadChop2d(int width)
{
	if (width > 255)
		return 16;
	if (width > 63)
		return 8;
	if (width > 15)
		return 4;
	if (width > 3)
		return 2;
	return 1;
}

	.text
	.file	"BlockUtils.hip"
	.globl	_Z7dim3Ctriii                   # -- Begin function _Z7dim3Ctriii
	.type	_Z7dim3Ctriii,@function
_Z7dim3Ctriii:                          # @_Z7dim3Ctriii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebx
	movl	%esi, %ebp
	movl	%edi, %r14d
	movl	$12, %edi
	callq	malloc
	movl	%r14d, (%rax)
	movl	%ebp, 4(%rax)
	movl	%ebx, 8(%rax)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z7dim3Ctriii, .Lfunc_end0-_Z7dim3Ctriii
	.cfi_endproc
                                        # -- End function
	.globl	_Z8dim3Unitv                    # -- Begin function _Z8dim3Unitv
	.type	_Z8dim3Unitv,@function
_Z8dim3Unitv:                           # @_Z8dim3Unitv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$12, %edi
	callq	malloc
	movabsq	$4294967297, %rcx               # imm = 0x100000001
	movq	%rcx, (%rax)
	movl	$1, 8(%rax)
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z8dim3Unitv, .Lfunc_end1-_Z8dim3Unitv
	.cfi_endproc
                                        # -- End function
	.globl	_Z7dim3VolP4dim3                # -- Begin function _Z7dim3VolP4dim3
	.type	_Z7dim3VolP4dim3,@function
_Z7dim3VolP4dim3:                       # @_Z7dim3VolP4dim3
	.cfi_startproc
# %bb.0:
	movl	4(%rdi), %eax
	imull	(%rdi), %eax
	imull	8(%rdi), %eax
	retq
.Lfunc_end2:
	.size	_Z7dim3VolP4dim3, .Lfunc_end2-_Z7dim3VolP4dim3
	.cfi_endproc
                                        # -- End function
	.globl	_Z9printDim3P4dim3              # -- Begin function _Z9printDim3P4dim3
	.type	_Z9printDim3P4dim3,@function
_Z9printDim3P4dim3:                     # @_Z9printDim3P4dim3
	.cfi_startproc
# %bb.0:
	movl	(%rdi), %esi
	movl	4(%rdi), %edx
	movl	8(%rdi), %ecx
	movl	$.L.str, %edi
	xorl	%eax, %eax
	jmp	printf                          # TAILCALL
.Lfunc_end3:
	.size	_Z9printDim3P4dim3, .Lfunc_end3-_Z9printDim3P4dim3
	.cfi_endproc
                                        # -- End function
	.globl	_Z12ThreadChop2di               # -- Begin function _Z12ThreadChop2di
	.type	_Z12ThreadChop2di,@function
_Z12ThreadChop2di:                      # @_Z12ThreadChop2di
	.cfi_startproc
# %bb.0:
	movl	$16, %eax
	cmpl	$255, %edi
	jg	.LBB4_4
# %bb.1:
	movl	$8, %eax
	cmpl	$63, %edi
	jg	.LBB4_4
# %bb.2:
	movl	$4, %eax
	cmpl	$15, %edi
	jg	.LBB4_4
# %bb.3:
	xorl	%eax, %eax
	cmpl	$4, %edi
	setge	%al
	incl	%eax
.LBB4_4:
	retq
.Lfunc_end4:
	.size	_Z12ThreadChop2di, .Lfunc_end4-_Z12ThreadChop2di
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"yow: {%d, %d, %d}"
	.size	.L.str, 18

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
