#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int Data_Read_Corrective_Test(int row, int col, double *testing_array,
                              char *name) {
  FILE *outputfile;
  outputfile = fopen(name, "w");
  for (int i = 0; i < row; i++) {
    for (int j = 0; j < col; j++) {
      fprintf(outputfile, "%f\t", testing_array[j + col * i]);
    }
    fprintf(outputfile, "\n");
  }
  fclose(outputfile);
  return 0;
}


x86 assembly (clang, -O0):
<Data_Read_Corrective_Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d8 <Data_Read_Corrective_Test+0xa8>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b8 <Data_Read_Corrective_Test+0x88>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x8(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5f(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1174 <Data_Read_Corrective_Test+0x44>
mov    -0x20(%rbp),%rdi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <Data_Read_Corrective_Test+0x31>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Data_Read_Corrective_Test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %esi,0x4(%rsp)
mov    %edi,%r15d
lea    0xea1(%rip),%rsi
mov    %rcx,%rdi
call   1060 <fopen@plt>
mov    %rax,%rbp
test   %r15d,%r15d
jle    11ee <Data_Read_Corrective_Test+0xae>
movslq 0x4(%rsp),%rax
mov    %r15d,%ecx
mov    %rcx,0x8(%rsp)
mov    %eax,%r14d
shl    $0x3,%rax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
lea    0xe70(%rip),%r15
jmp    11bd <Data_Read_Corrective_Test+0x7d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
mov    %rbp,%rsi
call   1040 <fputc@plt>
add    $0x1,%r13
add    0x10(%rsp),%rbx
cmp    0x8(%rsp),%r13
je     11ee <Data_Read_Corrective_Test+0xae>
cmpl   $0x0,0x4(%rsp)
jle    11a0 <Data_Read_Corrective_Test+0x60>
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%r12,8),%xmm0
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%r14
jne    11d0 <Data_Read_Corrective_Test+0x90>
jmp    11a0 <Data_Read_Corrective_Test+0x60>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [4 x i8] c"%f\09\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @Data_Read_Corrective_Test(i32 %0, i32 %1, double* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %9
store i32 0, i32* %10
br label %14
14: ; preds = %41, %4
%15 = load i32, i32* %10
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %44
18: ; preds = %14
store i32 0, i32* %11
br label %19
19: ; preds = %35, %18
%20 = load i32, i32* %11
%21 = load i32, i32* %6
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %38
23: ; preds = %19
%24 = load i32*, i32** %9
%25 = load double*, double** %7
%26 = load i32, i32* %11
%27 = load i32, i32* %6
%28 = load i32, i32* %10
%29 = mul nsw i32 %27, %28
%30 = add nsw i32 %26, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %25, i64 %31
%33 = load double, double* %32
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %33)
br label %35
35: ; preds = %23
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
br label %19
38: ; preds = %19
%39 = load i32*, i32** %9
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %38
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %14
44: ; preds = %14
%45 = load i32*, i32** %9
%46 = call i32 @fclose(i32* %45)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [4 x i8] c"%f\09\00"
define i32 @Data_Read_Corrective_Test(i32 %0, i32 %1, double* nocapture %2, i8* nocapture %3) {
%5 = tail call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = icmp sgt i32 %1, 0
%9 = sext i32 %1 to i64
%10 = zext i32 %0 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %7, %18
%13 = phi i64 [ 0, %7 ], [ %20, %18 ]
br i1 %8, label %14, label %18
14: ; preds = %12
%15 = mul nsw i64 %13, %9
br label %22
16: ; preds = %18, %4
%17 = tail call i32 @fclose(i32* %5)
ret i32 0
18: ; preds = %22, %12
%19 = tail call i32 @fputc(i32 10, i32* %5)
%20 = add nuw nsw i64 %13, 1
%21 = icmp eq i64 %20, %10
br i1 %21, label %16, label %12
22: ; preds = %14, %22
%23 = phi i64 [ 0, %14 ], [ %28, %22 ]
%24 = add nsw i64 %23, %15
%25 = getelementptr inbounds double, double* %2, i64 %24
%26 = load double, double* %25
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = add nuw nsw i64 %23, 1
%29 = icmp eq i64 %28, %11
br i1 %29, label %18, label %22
}