#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ D2H(float *, float *, int, int);
int /*<<< orphan*/ H2D(float *, float *, int, int);
float fabs(float);
int /*<<< orphan*/ initialize_matrix(float *);
int /*<<< orphan*/ main_gpu(float *, float *, int, int);
float *matrix_alloc_cpu(int, int);
float *matrix_alloc_gpu(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ vertical_sum_cpu(float *, float *);
int main() {
  float *a_cpu, *s_cpu, *s2_cpu;
  float *a_gpu, *s_gpu, max = -1.0, m;
  int i, j;
  a_cpu = matrix_alloc_cpu(800, 2000);
  a_gpu = matrix_alloc_gpu(800, 2000);
  s_cpu = matrix_alloc_cpu(800, 2000);
  s2_cpu = matrix_alloc_cpu(800, 2000);
  s_gpu = matrix_alloc_gpu(800, 2000);
  initialize_matrix(a_cpu);
  vertical_sum_cpu(a_cpu, s_cpu);
  H2D(a_gpu, a_cpu, 800, 2000);
  main_gpu(s_gpu, a_gpu, 800, 2000);
  for (j = 101; j < 101 + 5; j++) {
    for (i = 30; i < 30 + 5; i++) {
      printf("%.6g\t", s_cpu[i + j * 800]);
    }
    printf("\n");
  }
  printf("\n----\n\n");
  D2H(s2_cpu, s_gpu, 800, 2000);
  for (j = 101; j < 101 + 5; j++) {
    for (i = 30; i < 30 + 5; i++) {
      printf("%.6g\t", s2_cpu[i + j * 800]);
    }
    printf("\n");
  }
  for (j = 0; j < 2000; j++) {
    for (i = 0; i < 800; i++) {
      m = fabs(s_cpu[i + j * 800] - s2_cpu[i + j * 800]);
      if (m > max)
        max = m;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xe59(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    $0x320,%edi
mov    $0x7d0,%esi
call   10b0 <matrix_alloc_cpu@plt>
mov    %rax,-0x10(%rbp)
mov    $0x320,%edi
mov    $0x7d0,%esi
call   1080 <matrix_alloc_gpu@plt>
mov    %rax,-0x28(%rbp)
mov    $0x320,%edi
mov    $0x7d0,%esi
call   10b0 <matrix_alloc_cpu@plt>
mov    %rax,-0x18(%rbp)
mov    $0x320,%edi
mov    $0x7d0,%esi
call   10b0 <matrix_alloc_cpu@plt>
mov    %rax,-0x20(%rbp)
mov    $0x320,%edi
mov    $0x7d0,%esi
call   1080 <matrix_alloc_gpu@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <initialize_matrix@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <vertical_sum_cpu@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x320,%edx
mov    $0x7d0,%ecx
call   1090 <H2D@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x320,%edx
mov    $0x7d0,%ecx
call   1050 <main_gpu@plt>
movl   $0x65,-0x40(%rbp)
cmpl   $0x6a,-0x40(%rbp)
jge    12c5 <main+0x135>
movl   $0x1e,-0x3c(%rbp)
cmpl   $0x23,-0x3c(%rbp)
jge    12a9 <main+0x119>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   $0x320,-0x40(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd70(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1267 <main+0xd7>
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1256 <main+0xc6>
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x320,%edx
mov    $0x7d0,%ecx
call   1070 <D2H@plt>
movl   $0x65,-0x40(%rbp)
cmpl   $0x6a,-0x40(%rbp)
jge    1360 <main+0x1d0>
movl   $0x1e,-0x3c(%rbp)
cmpl   $0x23,-0x3c(%rbp)
jge    1344 <main+0x1b4>
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   $0x320,-0x40(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcd5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1302 <main+0x172>
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12f1 <main+0x161>
movl   $0x0,-0x40(%rbp)
cmpl   $0x7d0,-0x40(%rbp)
jge    1401 <main+0x271>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x320,-0x3c(%rbp)
jge    13ee <main+0x25e>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   $0x320,-0x40(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   $0x320,-0x40(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
subss  (%rax,%rcx,4),%xmm0
call   1040 <fabs@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
ucomiss -0x34(%rbp),%xmm0
jbe    13db <main+0x24b>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    13e0 <main+0x250>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    137b <main+0x1eb>
jmp    13f3 <main+0x263>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1367 <main+0x1d7>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x320,%edi
mov    $0x7d0,%esi
call   10c0 <matrix_alloc_cpu@plt>
mov    %rax,%r13
mov    $0x320,%edi
mov    $0x7d0,%esi
call   1090 <matrix_alloc_gpu@plt>
mov    %rax,%r12
mov    $0x320,%edi
mov    $0x7d0,%esi
call   10c0 <matrix_alloc_cpu@plt>
mov    %rax,%rbx
mov    $0x320,%edi
mov    $0x7d0,%esi
call   10c0 <matrix_alloc_cpu@plt>
mov    %rax,%r14
mov    $0x320,%edi
mov    $0x7d0,%esi
call   1090 <matrix_alloc_gpu@plt>
mov    %rax,%r15
mov    %r13,%rdi
call   10b0 <initialize_matrix@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <vertical_sum_cpu@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x320,%edx
mov    $0x7d0,%ecx
call   10a0 <H2D@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x320,%edx
mov    $0x7d0,%ecx
call   1060 <main_gpu@plt>
movss  0x4eef8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdad(%rip),%r12
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4eefc(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4ef00(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4ef04(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4ef08(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x4fb78(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb7c(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb80(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb84(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb88(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x507f8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x507fc(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x50800(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x50804(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x50808(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x51478(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x5147c(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x51480(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x51484(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x51488(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x520f8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x520fc(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x52100(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x52104(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x52108(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb60(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x320,%edx
mov    $0x7d0,%ecx
call   1080 <D2H@plt>
movss  0x4eef8(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4eefc(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4ef00(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4ef04(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4ef08(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x4fb78(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb7c(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb80(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb84(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4fb88(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x507f8(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x507fc(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x50800(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x50804(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x50808(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x51478(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x5147c(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x51480(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x51484(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x51488(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x520f8(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x520fc(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x52100(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x52104(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x52108(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.6g\09\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [8 x i8] c"\0A----\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float*
%3 = alloca float*
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store float -1.000000e+00, float* %7
%11 = call float* @matrix_alloc_cpu(i32 800, i32 2000)
store float* %11, float** %2
%12 = call float* @matrix_alloc_gpu(i32 800, i32 2000)
store float* %12, float** %5
%13 = call float* @matrix_alloc_cpu(i32 800, i32 2000)
store float* %13, float** %3
%14 = call float* @matrix_alloc_cpu(i32 800, i32 2000)
store float* %14, float** %4
%15 = call float* @matrix_alloc_gpu(i32 800, i32 2000)
store float* %15, float** %6
%16 = load float*, float** %2
%17 = call i32 @initialize_matrix(float* %16)
%18 = load float*, float** %2
%19 = load float*, float** %3
%20 = call i32 @vertical_sum_cpu(float* %18, float* %19)
%21 = load float*, float** %5
%22 = load float*, float** %2
%23 = call i32 @H2D(float* %21, float* %22, i32 800, i32 2000)
%24 = load float*, float** %6
%25 = load float*, float** %5
%26 = call i32 @main_gpu(float* %24, float* %25, i32 800, i32 2000)
store i32 101, i32* %10
br label %27
27: ; preds = %50, %0
%28 = load i32, i32* %10
%29 = icmp slt i32 %28, 106
br i1 %29, label %30, label %53
30: ; preds = %27
store i32 30, i32* %9
br label %31
31: ; preds = %45, %30
%32 = load i32, i32* %9
%33 = icmp slt i32 %32, 35
br i1 %33, label %34, label %48
34: ; preds = %31
%35 = load float*, float** %3
%36 = load i32, i32* %9
%37 = load i32, i32* %10
%38 = mul nsw i32 %37, 800
%39 = add nsw i32 %36, %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %35, i64 %40
%42 = load float, float* %41
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %43)
br label %45
45: ; preds = %34
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
br label %31
48: ; preds = %31
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
br label %27
53: ; preds = %27
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%55 = load float*, float** %4
%56 = load float*, float** %6
%57 = call i32 @D2H(float* %55, float* %56, i32 800, i32 2000)
store i32 101, i32* %10
br label %58
58: ; preds = %81, %53
%59 = load i32, i32* %10
%60 = icmp slt i32 %59, 106
br i1 %60, label %61, label %84
61: ; preds = %58
store i32 30, i32* %9
br label %62
62: ; preds = %76, %61
%63 = load i32, i32* %9
%64 = icmp slt i32 %63, 35
br i1 %64, label %65, label %79
65: ; preds = %62
%66 = load float*, float** %4
%67 = load i32, i32* %9
%68 = load i32, i32* %10
%69 = mul nsw i32 %68, 800
%70 = add nsw i32 %67, %69
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds float, float* %66, i64 %71
%73 = load float, float* %72
%74 = fpext float %73 to double
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %74)
br label %76
76: ; preds = %65
%77 = load i32, i32* %9
%78 = add nsw i32 %77, 1
store i32 %78, i32* %9
br label %62
79: ; preds = %62
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %81
81: ; preds = %79
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 1
store i32 %83, i32* %10
br label %58
84: ; preds = %58
store i32 0, i32* %10
br label %85
85: ; preds = %121, %84
%86 = load i32, i32* %10
%87 = icmp slt i32 %86, 2000
br i1 %87, label %88, label %124
88: ; preds = %85
store i32 0, i32* %9
br label %89
89: ; preds = %117, %88
%90 = load i32, i32* %9
%91 = icmp slt i32 %90, 800
br i1 %91, label %92, label %120
92: ; preds = %89
%93 = load float*, float** %3
%94 = load i32, i32* %9
%95 = load i32, i32* %10
%96 = mul nsw i32 %95, 800
%97 = add nsw i32 %94, %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds float, float* %93, i64 %98
%100 = load float, float* %99
%101 = load float*, float** %4
%102 = load i32, i32* %9
%103 = load i32, i32* %10
%104 = mul nsw i32 %103, 800
%105 = add nsw i32 %102, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds float, float* %101, i64 %106
%108 = load float, float* %107
%109 = fsub float %100, %108
%110 = call float @fabs(float %109)
store float %110, float* %8
%111 = load float, float* %8
%112 = load float, float* %7
%113 = fcmp ogt float %111, %112
br i1 %113, label %114, label %116
114: ; preds = %92
%115 = load float, float* %8
store float %115, float* %7
br label %116
116: ; preds = %114, %92
br label %117
117: ; preds = %116
%118 = load i32, i32* %9
%119 = add nsw i32 %118, 1
store i32 %119, i32* %9
br label %89
120: ; preds = %89
br label %121
121: ; preds = %120
%122 = load i32, i32* %10
%123 = add nsw i32 %122, 1
store i32 %123, i32* %10
br label %85
124: ; preds = %85
%125 = load i32, i32* %1
ret i32 %125
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.6g\09\00"
@str = [7 x i8] c"\0A----\0A\00"
define i32 @main() {
%1 = tail call float* @matrix_alloc_cpu(i32 800, i32 2000)
%2 = tail call float* @matrix_alloc_gpu(i32 800, i32 2000)
%3 = tail call float* @matrix_alloc_cpu(i32 800, i32 2000)
%4 = tail call float* @matrix_alloc_cpu(i32 800, i32 2000)
%5 = tail call float* @matrix_alloc_gpu(i32 800, i32 2000)
%6 = tail call i32 @initialize_matrix(float* %1)
%7 = tail call i32 @vertical_sum_cpu(float* %1, float* %3)
%8 = tail call i32 @H2D(float* %2, float* %1, i32 800, i32 2000)
%9 = tail call i32 @main_gpu(float* %5, float* %2, i32 800, i32 2000)
%10 = getelementptr inbounds float, float* %3, i64 80830
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %12)
%14 = getelementptr inbounds float, float* %3, i64 80831
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %16)
%18 = getelementptr inbounds float, float* %3, i64 80832
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %20)
%22 = getelementptr inbounds float, float* %3, i64 80833
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %24)
%26 = getelementptr inbounds float, float* %3, i64 80834
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %28)
%30 = tail call i32 @putchar(i32 10)
%31 = getelementptr inbounds float, float* %3, i64 81630
%32 = load float, float* %31
%33 = fpext float %32 to double
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %33)
%35 = getelementptr inbounds float, float* %3, i64 81631
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %37)
%39 = getelementptr inbounds float, float* %3, i64 81632
%40 = load float, float* %39
%41 = fpext float %40 to double
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %41)
%43 = getelementptr inbounds float, float* %3, i64 81633
%44 = load float, float* %43
%45 = fpext float %44 to double
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %45)
%47 = getelementptr inbounds float, float* %3, i64 81634
%48 = load float, float* %47
%49 = fpext float %48 to double
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %49)
%51 = tail call i32 @putchar(i32 10)
%52 = getelementptr inbounds float, float* %3, i64 82430
%53 = load float, float* %52
%54 = fpext float %53 to double
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %54)
%56 = getelementptr inbounds float, float* %3, i64 82431
%57 = load float, float* %56
%58 = fpext float %57 to double
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %58)
%60 = getelementptr inbounds float, float* %3, i64 82432
%61 = load float, float* %60
%62 = fpext float %61 to double
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %62)
%64 = getelementptr inbounds float, float* %3, i64 82433
%65 = load float, float* %64
%66 = fpext float %65 to double
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %66)
%68 = getelementptr inbounds float, float* %3, i64 82434
%69 = load float, float* %68
%70 = fpext float %69 to double
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %70)
%72 = tail call i32 @putchar(i32 10)
%73 = getelementptr inbounds float, float* %3, i64 83230
%74 = load float, float* %73
%75 = fpext float %74 to double
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %75)
%77 = getelementptr inbounds float, float* %3, i64 83231
%78 = load float, float* %77
%79 = fpext float %78 to double
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %79)
%81 = getelementptr inbounds float, float* %3, i64 83232
%82 = load float, float* %81
%83 = fpext float %82 to double
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %83)
%85 = getelementptr inbounds float, float* %3, i64 83233
%86 = load float, float* %85
%87 = fpext float %86 to double
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %87)
%89 = getelementptr inbounds float, float* %3, i64 83234
%90 = load float, float* %89
%91 = fpext float %90 to double
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %91)
%93 = tail call i32 @putchar(i32 10)
%94 = getelementptr inbounds float, float* %3, i64 84030
%95 = load float, float* %94
%96 = fpext float %95 to double
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %96)
%98 = getelementptr inbounds float, float* %3, i64 84031
%99 = load float, float* %98
%100 = fpext float %99 to double
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %100)
%102 = getelementptr inbounds float, float* %3, i64 84032
%103 = load float, float* %102
%104 = fpext float %103 to double
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %104)
%106 = getelementptr inbounds float, float* %3, i64 84033
%107 = load float, float* %106
%108 = fpext float %107 to double
%109 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %108)
%110 = getelementptr inbounds float, float* %3, i64 84034
%111 = load float, float* %110
%112 = fpext float %111 to double
%113 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %112)
%114 = tail call i32 @putchar(i32 10)
%115 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%116 = tail call i32 @D2H(float* %4, float* %5, i32 800, i32 2000)
%117 = getelementptr inbounds float, float* %4, i64 80830
%118 = load float, float* %117
%119 = fpext float %118 to double
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %119)
%121 = getelementptr inbounds float, float* %4, i64 80831
%122 = load float, float* %121
%123 = fpext float %122 to double
%124 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %123)
%125 = getelementptr inbounds float, float* %4, i64 80832
%126 = load float, float* %125
%127 = fpext float %126 to double
%128 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %127)
%129 = getelementptr inbounds float, float* %4, i64 80833
%130 = load float, float* %129
%131 = fpext float %130 to double
%132 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %131)
%133 = getelementptr inbounds float, float* %4, i64 80834
%134 = load float, float* %133
%135 = fpext float %134 to double
%136 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %135)
%137 = tail call i32 @putchar(i32 10)
%138 = getelementptr inbounds float, float* %4, i64 81630
%139 = load float, float* %138
%140 = fpext float %139 to double
%141 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %140)
%142 = getelementptr inbounds float, float* %4, i64 81631
%143 = load float, float* %142
%144 = fpext float %143 to double
%145 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %144)
%146 = getelementptr inbounds float, float* %4, i64 81632
%147 = load float, float* %146
%148 = fpext float %147 to double
%149 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %148)
%150 = getelementptr inbounds float, float* %4, i64 81633
%151 = load float, float* %150
%152 = fpext float %151 to double
%153 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %152)
%154 = getelementptr inbounds float, float* %4, i64 81634
%155 = load float, float* %154
%156 = fpext float %155 to double
%157 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %156)
%158 = tail call i32 @putchar(i32 10)
%159 = getelementptr inbounds float, float* %4, i64 82430
%160 = load float, float* %159
%161 = fpext float %160 to double
%162 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %161)
%163 = getelementptr inbounds float, float* %4, i64 82431
%164 = load float, float* %163
%165 = fpext float %164 to double
%166 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %165)
%167 = getelementptr inbounds float, float* %4, i64 82432
%168 = load float, float* %167
%169 = fpext float %168 to double
%170 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %169)
%171 = getelementptr inbounds float, float* %4, i64 82433
%172 = load float, float* %171
%173 = fpext float %172 to double
%174 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %173)
%175 = getelementptr inbounds float, float* %4, i64 82434
%176 = load float, float* %175
%177 = fpext float %176 to double
%178 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %177)
%179 = tail call i32 @putchar(i32 10)
%180 = getelementptr inbounds float, float* %4, i64 83230
%181 = load float, float* %180
%182 = fpext float %181 to double
%183 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %182)
%184 = getelementptr inbounds float, float* %4, i64 83231
%185 = load float, float* %184
%186 = fpext float %185 to double
%187 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %186)
%188 = getelementptr inbounds float, float* %4, i64 83232
%189 = load float, float* %188
%190 = fpext float %189 to double
%191 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %190)
%192 = getelementptr inbounds float, float* %4, i64 83233
%193 = load float, float* %192
%194 = fpext float %193 to double
%195 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %194)
%196 = getelementptr inbounds float, float* %4, i64 83234
%197 = load float, float* %196
%198 = fpext float %197 to double
%199 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %198)
%200 = tail call i32 @putchar(i32 10)
%201 = getelementptr inbounds float, float* %4, i64 84030
%202 = load float, float* %201
%203 = fpext float %202 to double
%204 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %203)
%205 = getelementptr inbounds float, float* %4, i64 84031
%206 = load float, float* %205
%207 = fpext float %206 to double
%208 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %207)
%209 = getelementptr inbounds float, float* %4, i64 84032
%210 = load float, float* %209
%211 = fpext float %210 to double
%212 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %211)
%213 = getelementptr inbounds float, float* %4, i64 84033
%214 = load float, float* %213
%215 = fpext float %214 to double
%216 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %215)
%217 = getelementptr inbounds float, float* %4, i64 84034
%218 = load float, float* %217
%219 = fpext float %218 to double
%220 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %219)
%221 = tail call i32 @putchar(i32 10)
ret i32 0
}