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

#define CSC(call)                           \
do {                                \
  cudaError_t res = call;                     \
  if (res != cudaSuccess) {                   \
    fprintf(stderr, "ERROR in %s:%d. Message: %s\n",      \
        __FILE__, __LINE__, cudaGetErrorString(res));   \
    exit(0);                          \
  }                               \
} while(0)


void f(uchar4* data, uchar4 *out, int w, int h, int wScale, int hScale) {
  
  int n = wScale * hScale;
  int x, y, i, j;
  uchar4 p;
  uint4 s;


  for(y = 0; y < h; y += 1) {
    for(x = 0; x < w; x += 1) {

      s = {0,0,0,0};
      
      for (i = 0; i < wScale; ++i) {
        for (j = 0; j < hScale; ++j){
          p = data[(x * wScale + i) + y * (y * hScale + j)];
          s.x += p.x;
          s.y += p.y;
          s.z += p.z;
        }
      }
      s.x /= n;
      s.y /= n;
      s.z /= n;
    
      out[y * w + x] = make_uchar4(s.x, s.y, s.z, s.w);
    }
  }
}

int main() {


  int w, h, wn, hn, wScale, hScale;
  char inputFile[256], outputFile[256];
  scanf("%s %s %d %d", inputFile, outputFile, &wn, &hn);

  FILE *fp = fopen(inputFile, "rb");
  fread(&w, sizeof(int), 1, fp);
  fread(&h, sizeof(int), 1, fp);

  wScale = w / wn, hScale = h / hn;

  uchar4 *data = (uchar4 *)malloc(sizeof(uchar4) * w * h);
  uchar4 *out = (uchar4 *)malloc(sizeof(uchar4) * w * h);
  fread(data, sizeof(uchar4), w * h, fp);
  fclose(fp);

  

  cudaEvent_t start, stop;
  float time;
  cudaEventCreate(&start);
  cudaEventCreate(&stop);
  cudaEventRecord(start, 0);

  f(data, out, wn, hn, wScale, hScale);

  cudaEventRecord(stop, 0);
  cudaEventSynchronize(stop);
  cudaEventElapsedTime(&time, start, stop);
  fprintf(stderr, "%.2f\n", time);
  cudaEventDestroy(stop);
  cudaEventDestroy(start);

  
  return 0;
}

	.file	"tmpxft_0031f038_00000000-6_cpu.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3639:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3639:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z1fP6uchar4S0_iiii
	.type	_Z1fP6uchar4S0_iiii, @function
_Z1fP6uchar4S0_iiii:
.LFB3635:
	.cfi_startproc
	endbr64
	movl	%r8d, %eax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edx, %r11d
	xorl	%r10d, %r10d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	imull	%r9d, %eax
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, -4(%rsp)
	movl	%eax, -36(%rsp)
.L3:
	cmpl	%r10d, -4(%rsp)
	jle	.L2
	movslq	%r13d, %rax
	xorl	%ebp, %ebp
	leaq	(%rsi,%rax,4), %rcx
	leaq	0(,%r10,4), %rax
	movq	%rax, -16(%rsp)
	movl	%r12d, %eax
	imull	%r10d, %eax
	cltq
	movq	%rax, -24(%rsp)
	xorl	%eax, %eax
	movl	%eax, -32(%rsp)
.L9:
	cmpl	%r11d, -32(%rsp)
	jge	.L13
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	%edx, -28(%rsp)
	movl	%edx, -8(%rsp)
.L7:
	cmpl	%r8d, %ebx
	jge	.L5
	movq	-24(%rsp), %r14
	leal	(%rbx,%rbp), %edx
	movslq	%edx, %rdx
	addq	%r14, %rdx
	xorl	%r14d, %r14d
	leaq	(%rdi,%rdx,4), %rdx
.L6:
	cmpl	%r9d, %r14d
	jge	.L14
	movzbl	(%rdx), %r15d
	incl	%r14d
	addl	%r15d, %eax
	movzbl	1(%rdx), %r15d
	addl	%r15d, -8(%rsp)
	movzbl	2(%rdx), %r15d
	addl	%r15d, -28(%rsp)
	movq	-16(%rsp), %r15
	addq	%r15, %rdx
	jmp	.L6
.L14:
	incl	%ebx
	jmp	.L7
.L5:
	xorl	%edx, %edx
	movb	$0, 3(%rcx)
	addl	%r8d, %ebp
	addq	$4, %rcx
	divl	-36(%rsp)
	xorl	%edx, %edx
	incl	-32(%rsp)
	movb	%al, -4(%rcx)
	movl	-8(%rsp), %eax
	divl	-36(%rsp)
	xorl	%edx, %edx
	movb	%al, -3(%rcx)
	movl	-28(%rsp), %eax
	divl	-36(%rsp)
	movb	%al, -2(%rcx)
	jmp	.L9
.L13:
	incq	%r10
	addl	%r11d, %r13d
	addl	%r9d, %r12d
	jmp	.L3
.L2:
	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
.LFE3635:
	.size	_Z1fP6uchar4S0_iiii, .-_Z1fP6uchar4S0_iiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s %s %d %d"
.LC1:
	.string	"rb"
.LC2:
	.string	"%.2f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$584, %rsp
	.cfi_def_cfa_offset 640
	movq	%fs:40, %rax
	movq	%rax, 568(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rbx
	leaq	28(%rsp), %rcx
	leaq	312(%rsp), %rdx
	leaq	32(%rsp), %r8
	movq	%rbx, %rsi
	call	__isoc23_scanf@PLT
	movq	%rbx, %rdi
	leaq	.LC1(%rip), %rsi
	call	fopen@PLT
	leaq	20(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	movq	%rax, %rbp
	movq	%rax, %r8
	movl	$4, %esi
	call	__fread_chk@PLT
	movq	%rbp, %r8
	movl	$1, %ecx
	movl	$4, %esi
	leaq	24(%rsp), %rdi
	movl	$4, %edx
	call	__fread_chk@PLT
	movl	20(%rsp), %eax
	movslq	20(%rsp), %rbx
	cltd
	idivl	28(%rsp)
	movl	%eax, %r15d
	movl	24(%rsp), %eax
	cltd
	idivl	32(%rsp)
	movl	%eax, 12(%rsp)
	movslq	24(%rsp), %rax
	imulq	%rax, %rbx
	leaq	0(,%rbx,4), %r14
	movq	%r14, %rdi
	call	malloc@PLT
	movq	%r14, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rbp, %r8
	movq	%rbx, %rcx
	movl	$4, %edx
	movq	%r14, %rsi
	movq	%r12, %rdi
	movq	%rax, %r13
	call	__fread_chk@PLT
	movq	%rbp, %rdi
	call	fclose@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	12(%rsp), %r9d
	movl	%r15d, %r8d
	movq	%r13, %rsi
	movl	32(%rsp), %ecx
	movl	28(%rsp), %edx
	movq	%r12, %rdi
	call	_Z1fP6uchar4S0_iiii
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	48(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	leaq	36(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC2(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	36(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$584, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.LFE3636:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3662:
	.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
.LFE3662:
	.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:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

#define CSC(call)                           \
do {                                \
  hipError_t res = call;                     \
  if (res != hipSuccess) {                   \
    fprintf(stderr, "ERROR in %s:%d. Message: %s\n",      \
        __FILE__, __LINE__, hipGetErrorString(res));   \
    exit(0);                          \
  }                               \
} while(0)


void f(uchar4* data, uchar4 *out, int w, int h, int wScale, int hScale) {
  
  int n = wScale * hScale;
  int x, y, i, j;
  uchar4 p;
  uint4 s;


  for(y = 0; y < h; y += 1) {
    for(x = 0; x < w; x += 1) {

      s = {0,0,0,0};
      
      for (i = 0; i < wScale; ++i) {
        for (j = 0; j < hScale; ++j){
          p = data[(x * wScale + i) + y * (y * hScale + j)];
          s.x += p.x;
          s.y += p.y;
          s.z += p.z;
        }
      }
      s.x /= n;
      s.y /= n;
      s.z /= n;
    
      out[y * w + x] = make_uchar4(s.x, s.y, s.z, s.w);
    }
  }
}

int main() {


  int w, h, wn, hn, wScale, hScale;
  char inputFile[256], outputFile[256];
  scanf("%s %s %d %d", inputFile, outputFile, &wn, &hn);

  FILE *fp = fopen(inputFile, "rb");
  fread(&w, sizeof(int), 1, fp);
  fread(&h, sizeof(int), 1, fp);

  wScale = w / wn, hScale = h / hn;

  uchar4 *data = (uchar4 *)malloc(sizeof(uchar4) * w * h);
  uchar4 *out = (uchar4 *)malloc(sizeof(uchar4) * w * h);
  fread(data, sizeof(uchar4), w * h, fp);
  fclose(fp);

  

  hipEvent_t start, stop;
  float time;
  hipEventCreate(&start);
  hipEventCreate(&stop);
  hipEventRecord(start, 0);

  f(data, out, wn, hn, wScale, hScale);

  hipEventRecord(stop, 0);
  hipEventSynchronize(stop);
  hipEventElapsedTime(&time, start, stop);
  fprintf(stderr, "%.2f\n", time);
  hipEventDestroy(stop);
  hipEventDestroy(start);

  
  return 0;
}

	.text
	.file	"cpu.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z1fP15HIP_vector_typeIhLj4EES1_iiii # -- Begin function _Z1fP15HIP_vector_typeIhLj4EES1_iiii
	.type	_Z1fP15HIP_vector_typeIhLj4EES1_iiii,@function
_Z1fP15HIP_vector_typeIhLj4EES1_iiii:   # @_Z1fP15HIP_vector_typeIhLj4EES1_iiii
	.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	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $r9d killed $r9d def $r9
	movl	%edx, -60(%rsp)                 # 4-byte Spill
	movq	%rsi, -32(%rsp)                 # 8-byte Spill
	testl	%ecx, %ecx
	jle	.LBB0_13
# %bb.1:                                # %.preheader43.lr.ph
	movl	%r9d, %eax
	imull	%r8d, %eax
	movl	%eax, -40(%rsp)                 # 4-byte Spill
	movl	%ecx, %eax
	movq	%rax, -24(%rsp)                 # 8-byte Spill
	movl	-60(%rsp), %eax                 # 4-byte Reload
	movq	%rax, -16(%rsp)                 # 8-byte Spill
	movl	%r9d, %r14d
	leal	(%r9,%r9), %eax
	movl	%eax, -48(%rsp)                 # 4-byte Spill
	xorl	%eax, %eax
	movq	%rax, -56(%rsp)                 # 8-byte Spill
	movl	%r9d, %ecx
	xorl	%ebx, %ebx
.LBB0_2:                                # %.preheader43
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
                                        #       Child Loop BB0_7 Depth 3
                                        #         Child Loop BB0_9 Depth 4
	movl	%ecx, -44(%rsp)                 # 4-byte Spill
	cmpl	$0, -60(%rsp)                   # 4-byte Folded Reload
	jle	.LBB0_12
# %bb.3:                                # %.preheader42.lr.ph
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	%ebx, %eax
	imull	-60(%rsp), %eax                 # 4-byte Folded Reload
	movq	-32(%rsp), %rcx                 # 8-byte Reload
	leaq	(%rcx,%rax,4), %rax
	movq	%rax, -8(%rsp)                  # 8-byte Spill
	movq	-56(%rsp), %rax                 # 8-byte Reload
	movl	%eax, %r13d
	xorl	%r15d, %r15d
.LBB0_4:                                # %.preheader42
                                        #   Parent Loop BB0_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_7 Depth 3
                                        #         Child Loop BB0_9 Depth 4
	testl	%r8d, %r8d
	movl	%r13d, -36(%rsp)                # 4-byte Spill
	jle	.LBB0_5
# %bb.6:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB0_4 Depth=2
	xorl	%eax, %eax
	xorl	%r11d, %r11d
	xorl	%r10d, %r10d
	xorl	%edx, %edx
.LBB0_7:                                # %.preheader
                                        #   Parent Loop BB0_2 Depth=1
                                        #     Parent Loop BB0_4 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB0_9 Depth 4
	testl	%r9d, %r9d
	jle	.LBB0_10
# %bb.8:                                # %.lr.ph
                                        #   in Loop: Header=BB0_7 Depth=3
	movq	%r14, %r12
	movl	%r13d, %ecx
.LBB0_9:                                #   Parent Loop BB0_2 Depth=1
                                        #     Parent Loop BB0_4 Depth=2
                                        #       Parent Loop BB0_7 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	movl	%ecx, %ebp
	movzbl	(%rdi,%rbp,4), %esi
	addl	%esi, %eax
	movzbl	1(%rdi,%rbp,4), %esi
	addl	%esi, %r11d
	movzbl	2(%rdi,%rbp,4), %esi
	addl	%esi, %r10d
	addl	%ebx, %ecx
	decq	%r12
	jne	.LBB0_9
.LBB0_10:                               # %._crit_edge
                                        #   in Loop: Header=BB0_7 Depth=3
	incl	%edx
	incl	%r13d
	cmpl	%r8d, %edx
	jne	.LBB0_7
	jmp	.LBB0_11
.LBB0_5:                                #   in Loop: Header=BB0_4 Depth=2
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	xorl	%eax, %eax
.LBB0_11:                               # %._crit_edge54
                                        #   in Loop: Header=BB0_4 Depth=2
	xorl	%edx, %edx
	movl	-40(%rsp), %esi                 # 4-byte Reload
	divl	%esi
	movl	%eax, %ecx
	movl	%r11d, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %r11d
	movl	%r10d, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	$255, %edx
	andl	%edx, %ecx
	andl	%edx, %r11d
	shll	$8, %r11d
	orl	%ecx, %r11d
	andl	%edx, %eax
	shll	$16, %eax
	orl	%r11d, %eax
	movq	-8(%rsp), %rcx                  # 8-byte Reload
	movl	%eax, (%rcx,%r15,4)
	incq	%r15
	movl	-36(%rsp), %r13d                # 4-byte Reload
	addl	%r8d, %r13d
	cmpq	-16(%rsp), %r15                 # 8-byte Folded Reload
	jne	.LBB0_4
.LBB0_12:                               # %._crit_edge59
                                        #   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movq	-56(%rsp), %rax                 # 8-byte Reload
	movl	-44(%rsp), %ecx                 # 4-byte Reload
	addl	%ecx, %eax
	movq	%rax, -56(%rsp)                 # 8-byte Spill
	addl	-48(%rsp), %ecx                 # 4-byte Folded Reload
	cmpq	-24(%rsp), %rbx                 # 8-byte Folded Reload
	jne	.LBB0_2
.LBB0_13:                               # %._crit_edge61
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.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_end0:
	.size	_Z1fP15HIP_vector_typeIhLj4EES1_iiii, .Lfunc_end0-_Z1fP15HIP_vector_typeIhLj4EES1_iiii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.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	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$568, %rsp                      # imm = 0x238
	.cfi_def_cfa_offset 624
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	304(%rsp), %rbx
	leaq	48(%rsp), %rdx
	leaq	16(%rsp), %rcx
	leaq	8(%rsp), %r8
	movl	$.L.str, %edi
	movq	%rbx, %rsi
	movq	%rcx, %r12
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$.L.str.1, %esi
	movq	%rbx, %rdi
	callq	fopen
	movq	%rax, %r15
	leaq	28(%rsp), %rbx
	movl	$4, %esi
	movl	$1, %edx
	movq	%rbx, %rdi
	movq	%rax, %rcx
	callq	fread
	leaq	24(%rsp), %r14
	movl	$4, %esi
	movl	$1, %edx
	movq	%r14, %rdi
	movq	%r15, %rcx
	callq	fread
	movslq	(%rbx), %r13
	movl	%r13d, %eax
	cltd
	idivl	(%r12)
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	movslq	(%r14), %rbp
	movl	%ebp, %eax
	cltd
	leaq	8(%rsp), %rcx
	idivl	(%rcx)
	movl	%eax, %r12d
	movq	%r13, %r14
	imulq	%rbp, %r14
	shlq	$2, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r14
	imull	%r13d, %ebp
	movslq	%ebp, %rdx
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%r15, %rcx
	callq	fread
	movq	%r15, %rdi
	callq	fclose
	leaq	40(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	leaq	32(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	(%r15), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	16(%rsp), %rax
	movl	(%rax), %edx
	leaq	8(%rsp), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	12(%rsp), %r8d                  # 4-byte Reload
	movl	%r12d, %r9d
	callq	_Z1fP15HIP_vector_typeIhLj4EES1_iiii
	movq	(%r13), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r13), %rdi
	callq	hipEventSynchronize
	movq	(%r15), %rsi
	movq	(%r13), %rdx
	leaq	20(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	stderr(%rip), %rdi
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.2, %esi
	movb	$1, %al
	callq	fprintf
	movq	(%r13), %rdi
	callq	hipEventDestroy
	movq	(%r15), %rdi
	callq	hipEventDestroy
	xorl	%eax, %eax
	addq	$568, %rsp                      # imm = 0x238
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.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_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%s %s %d %d"
	.size	.L.str, 12

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"rb"
	.size	.L.str.1, 3

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%.2f\n"
	.size	.L.str.2, 6

	.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
