#include "rgb_pixels_factory.cuh"

int RgbPixelsFactory::random(int max)
{
	return rand() % max;
}
unsigned char RgbPixelsFactory::randomChar()
{
	return random(256);
}

Pixel * RgbPixelsFactory::generate(int count, int maxX, int maxY)
{
	Pixel* pixels = new Pixel[count];

	for (int i = 0; i < count; i++)
	{
		pixels[i].color.red = randomChar();
		pixels[i].color.green = randomChar();
		pixels[i].color.blue = randomChar();
		pixels[i].point.x = random(maxX);
		pixels[i].point.y = random(maxY);
	}
	

	return pixels;
}
	.file	"tmpxft_002719bb_00000000-6_rgb_pixels_factory.cudafe1.cpp"
	.text
#APP

#NO_APP
	.align 2
	.globl	_ZN16RgbPixelsFactory8generateEiii
	.type	_ZN16RgbPixelsFactory8generateEiii, @function
_ZN16RgbPixelsFactory8generateEiii:
.LFB2034:
	.cfi_startproc
	endbr64
	movabsq	$768614336404564650, %rax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%esi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 12(%rsp)
	cmpq	%rbx, %rax
	jb	.L2
	imulq	$12, %rbx, %rdi
	movl	%ecx, %r14d
	movq	%rbx, %r12
	call	_Znam@PLT
	movq	%rax, %r15
	jmp	.L3
.L2:
	call	__cxa_throw_bad_array_new_length@PLT
.L3:
	subq	$1, %rbx
	jb	.L9
	xorl	%edx, %edx
	movb	$0, 8(%rax)
	addq	$12, %rax
	movl	%edx, -12(%rax)
	movl	%edx, -8(%rax)
	movb	$0, -3(%rax)
	movb	$0, -2(%rax)
	jmp	.L3
.L9:
	movq	%r15, %rbx
	xorl	%r13d, %r13d
	movl	$256, %ebp
.L5:
	cmpl	%r12d, %r13d
	jge	.L10
	call	rand@PLT
	incl	%r13d
	addq	$12, %rbx
	cltd
	idivl	%ebp
	movb	%dl, -4(%rbx)
	call	rand@PLT
	cltd
	idivl	%ebp
	movb	%dl, -3(%rbx)
	call	rand@PLT
	cltd
	idivl	%ebp
	movb	%dl, -2(%rbx)
	call	rand@PLT
	cltd
	idivl	12(%rsp)
	movl	%edx, -12(%rbx)
	call	rand@PLT
	cltd
	idivl	%r14d
	movl	%edx, -8(%rbx)
	jmp	.L5
.L10:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movq	%r15, %rax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_ZN16RgbPixelsFactory8generateEiii, .-_ZN16RgbPixelsFactory8generateEiii
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2037:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2037:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.globl	_ZN16RgbPixelsFactory6randomEi
	.type	_ZN16RgbPixelsFactory6randomEi, @function
_ZN16RgbPixelsFactory6randomEi:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	%esi, %ebx
	call	rand@PLT
	cltd
	idivl	%ebx
	popq	%rbx
	.cfi_def_cfa_offset 8
	movl	%edx, %eax
	ret
	.cfi_endproc
.LFE2032:
	.size	_ZN16RgbPixelsFactory6randomEi, .-_ZN16RgbPixelsFactory6randomEi
	.align 2
	.globl	_ZN16RgbPixelsFactory10randomCharEv
	.type	_ZN16RgbPixelsFactory10randomCharEv, @function
_ZN16RgbPixelsFactory10randomCharEv:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	rand@PLT
	movl	$256, %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_ZN16RgbPixelsFactory10randomCharEv, .-_ZN16RgbPixelsFactory10randomCharEv
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2060:
	.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
.LFE2060:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.weak	_ZTS13PixelsFactory
	.section	.rodata._ZTS13PixelsFactory,"aG",@progbits,_ZTS13PixelsFactory,comdat
	.align 16
	.type	_ZTS13PixelsFactory, @object
	.size	_ZTS13PixelsFactory, 16
_ZTS13PixelsFactory:
	.string	"13PixelsFactory"
	.weak	_ZTI13PixelsFactory
	.section	.data.rel.ro._ZTI13PixelsFactory,"awG",@progbits,_ZTI13PixelsFactory,comdat
	.align 8
	.type	_ZTI13PixelsFactory, @object
	.size	_ZTI13PixelsFactory, 16
_ZTI13PixelsFactory:
	.quad	_ZTVN10__cxxabiv117__class_type_infoE+16
	.quad	_ZTS13PixelsFactory
	.weak	_ZTS16RgbPixelsFactory
	.section	.rodata._ZTS16RgbPixelsFactory,"aG",@progbits,_ZTS16RgbPixelsFactory,comdat
	.align 16
	.type	_ZTS16RgbPixelsFactory, @object
	.size	_ZTS16RgbPixelsFactory, 19
_ZTS16RgbPixelsFactory:
	.string	"16RgbPixelsFactory"
	.weak	_ZTI16RgbPixelsFactory
	.section	.data.rel.ro._ZTI16RgbPixelsFactory,"awG",@progbits,_ZTI16RgbPixelsFactory,comdat
	.align 8
	.type	_ZTI16RgbPixelsFactory, @object
	.size	_ZTI16RgbPixelsFactory, 24
_ZTI16RgbPixelsFactory:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS16RgbPixelsFactory
	.quad	_ZTI13PixelsFactory
	.weak	_ZTV16RgbPixelsFactory
	.section	.data.rel.ro.local._ZTV16RgbPixelsFactory,"awG",@progbits,_ZTV16RgbPixelsFactory,comdat
	.align 8
	.type	_ZTV16RgbPixelsFactory, @object
	.size	_ZTV16RgbPixelsFactory, 24
_ZTV16RgbPixelsFactory:
	.quad	0
	.quad	_ZTI16RgbPixelsFactory
	.quad	_ZN16RgbPixelsFactory8generateEiii
	.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:


#include <hip/hip_runtime.h>
#include "rgb_pixels_factory.cuh"

int RgbPixelsFactory::random(int max)
{
	return rand() % max;
}
unsigned char RgbPixelsFactory::randomChar()
{
	return random(256);
}

Pixel * RgbPixelsFactory::generate(int count, int maxX, int maxY)
{
	Pixel* pixels = new Pixel[count];

	for (int i = 0; i < count; i++)
	{
		pixels[i].color.red = randomChar();
		pixels[i].color.green = randomChar();
		pixels[i].color.blue = randomChar();
		pixels[i].point.x = random(maxX);
		pixels[i].point.y = random(maxY);
	}
	

	return pixels;
}
	.text
	.file	"rgb_pixels_factory.hip"
	.globl	_ZN16RgbPixelsFactory6randomEi  # -- Begin function _ZN16RgbPixelsFactory6randomEi
	.p2align	1, 0x90
	.type	_ZN16RgbPixelsFactory6randomEi,@function
_ZN16RgbPixelsFactory6randomEi:         # @_ZN16RgbPixelsFactory6randomEi
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%esi, %ebx
	callq	rand
	cltd
	idivl	%ebx
	movl	%edx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_ZN16RgbPixelsFactory6randomEi, .Lfunc_end0-_ZN16RgbPixelsFactory6randomEi
	.cfi_endproc
                                        # -- End function
	.globl	_ZN16RgbPixelsFactory10randomCharEv # -- Begin function _ZN16RgbPixelsFactory10randomCharEv
	.p2align	1, 0x90
	.type	_ZN16RgbPixelsFactory10randomCharEv,@function
_ZN16RgbPixelsFactory10randomCharEv:    # @_ZN16RgbPixelsFactory10randomCharEv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	rand
                                        # kill: def $al killed $al killed $eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_ZN16RgbPixelsFactory10randomCharEv, .Lfunc_end1-_ZN16RgbPixelsFactory10randomCharEv
	.cfi_endproc
                                        # -- End function
	.globl	_ZN16RgbPixelsFactory8generateEiii # -- Begin function _ZN16RgbPixelsFactory8generateEiii
	.p2align	1, 0x90
	.type	_ZN16RgbPixelsFactory8generateEiii,@function
_ZN16RgbPixelsFactory8generateEiii:     # @_ZN16RgbPixelsFactory8generateEiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%ecx, %ebx
	movl	%edx, %ebp
	movl	%esi, %r15d
	movslq	%esi, %r12
	movl	$12, %ecx
	movq	%r12, %rax
	mulq	%rcx
	movq	$-1, %rdi
	cmovnoq	%rax, %rdi
	callq	_Znam
	movq	%rax, %r14
	testl	%r12d, %r12d
	je	.LBB2_6
# %bb.1:
	shlq	$2, %r12
	leaq	(%r12,%r12,2), %rax
	xorl	%ecx, %ecx
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movl	$0, 7(%r14,%rcx)
	movq	$0, (%r14,%rcx)
	addq	$12, %rcx
	cmpq	%rcx, %rax
	jne	.LBB2_2
# %bb.3:                                # %.loopexit
	testl	%r15d, %r15d
	jle	.LBB2_6
# %bb.4:                                # %.lr.ph.preheader
	movl	%r15d, %eax
	shlq	$2, %rax
	leaq	(%rax,%rax,2), %r15
	xorl	%r12d, %r12d
.LBB2_5:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movb	%al, 8(%r14,%r12)
	callq	rand
	movb	%al, 9(%r14,%r12)
	callq	rand
	movb	%al, 10(%r14,%r12)
	callq	rand
	cltd
	idivl	%ebp
	movl	%edx, (%r14,%r12)
	callq	rand
	cltd
	idivl	%ebx
	movl	%edx, 4(%r14,%r12)
	addq	$12, %r12
	cmpq	%r12, %r15
	jne	.LBB2_5
.LBB2_6:                                # %._crit_edge
	movq	%r14, %rax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_ZN16RgbPixelsFactory8generateEiii, .Lfunc_end2-_ZN16RgbPixelsFactory8generateEiii
	.cfi_endproc
                                        # -- End function
	.type	_ZTV16RgbPixelsFactory,@object  # @_ZTV16RgbPixelsFactory
	.section	.rodata,"a",@progbits
	.globl	_ZTV16RgbPixelsFactory
	.p2align	3, 0x0
_ZTV16RgbPixelsFactory:
	.quad	0
	.quad	_ZTI16RgbPixelsFactory
	.quad	_ZN16RgbPixelsFactory8generateEiii
	.size	_ZTV16RgbPixelsFactory, 24

	.type	_ZTS16RgbPixelsFactory,@object  # @_ZTS16RgbPixelsFactory
	.globl	_ZTS16RgbPixelsFactory
_ZTS16RgbPixelsFactory:
	.asciz	"16RgbPixelsFactory"
	.size	_ZTS16RgbPixelsFactory, 19

	.type	_ZTS13PixelsFactory,@object     # @_ZTS13PixelsFactory
	.section	.rodata._ZTS13PixelsFactory,"aG",@progbits,_ZTS13PixelsFactory,comdat
	.weak	_ZTS13PixelsFactory
_ZTS13PixelsFactory:
	.asciz	"13PixelsFactory"
	.size	_ZTS13PixelsFactory, 16

	.type	_ZTI13PixelsFactory,@object     # @_ZTI13PixelsFactory
	.section	.rodata._ZTI13PixelsFactory,"aG",@progbits,_ZTI13PixelsFactory,comdat
	.weak	_ZTI13PixelsFactory
	.p2align	3, 0x0
_ZTI13PixelsFactory:
	.quad	_ZTVN10__cxxabiv117__class_type_infoE+16
	.quad	_ZTS13PixelsFactory
	.size	_ZTI13PixelsFactory, 16

	.type	_ZTI16RgbPixelsFactory,@object  # @_ZTI16RgbPixelsFactory
	.section	.rodata,"a",@progbits
	.globl	_ZTI16RgbPixelsFactory
	.p2align	3, 0x0
_ZTI16RgbPixelsFactory:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS16RgbPixelsFactory
	.quad	_ZTI13PixelsFactory
	.size	_ZTI16RgbPixelsFactory, 24

	.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 __gxx_personality_v0
	.addrsig_sym _ZTVN10__cxxabiv120__si_class_type_infoE
	.addrsig_sym _ZTS16RgbPixelsFactory
	.addrsig_sym _ZTVN10__cxxabiv117__class_type_infoE
	.addrsig_sym _ZTS13PixelsFactory
	.addrsig_sym _ZTI13PixelsFactory
	.addrsig_sym _ZTI16RgbPixelsFactory
	.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
