#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*/ printf(char *, ...);
void print_arr(double *arr) {
  int row, col, i = 0;
  printf("\n");
  for (row = 0; row < 10; row++) {
    for (col = 0; col < 10; col++) {
      if (i < 100) {
        printf("%10f ", arr[row * 10 + col]);
      } else {
        goto FINISH;
      }
      i++;
    }
    printf("\n");
  }
FINISH:
  printf("\n");
}


x86 assembly (clang, -O0):
<print_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11bb <print_arr+0xab>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    119f <print_arr+0x8f>
cmpl   $0x64,-0x14(%rbp)
jge    1183 <print_arr+0x73>
mov    -0x8(%rbp),%rax
imul   $0xa,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1188 <print_arr+0x78>
jmp    11c0 <print_arr+0xb0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <print_arr+0x39>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <print_arr+0x28>
jmp    11c0 <print_arr+0xb0>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arr>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x48,%ebx
lea    0xec2(%rip),%r14
xchg   %ax,%ax
movsd  -0x48(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x40(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x38(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x30(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x28(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x18(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x10(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x8(%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%r15,%rbx,1),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x50,%rbx
cmp    $0x368,%rbx
jne    1140 <print_arr+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%10f \00"
define void @print_arr(double* nocapture %0) {
%2 = tail call i32 @putchar(i32 10)
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %46, %3 ]
%5 = mul nuw nsw i64 %4, 10
%6 = getelementptr inbounds double, double* %0, i64 %5
%7 = load double, double* %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %7)
%9 = or i64 %5, 1
%10 = getelementptr inbounds double, double* %0, i64 %9
%11 = load double, double* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = add nuw nsw i64 %5, 2
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = load double, double* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = add nuw nsw i64 %5, 3
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = load double, double* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %19)
%21 = add nuw nsw i64 %5, 4
%22 = getelementptr inbounds double, double* %0, i64 %21
%23 = load double, double* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %23)
%25 = add nuw nsw i64 %5, 5
%26 = getelementptr inbounds double, double* %0, i64 %25
%27 = load double, double* %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %27)
%29 = add nuw nsw i64 %5, 6
%30 = getelementptr inbounds double, double* %0, i64 %29
%31 = load double, double* %30
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %31)
%33 = add nuw nsw i64 %5, 7
%34 = getelementptr inbounds double, double* %0, i64 %33
%35 = load double, double* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %35)
%37 = add nuw nsw i64 %5, 8
%38 = getelementptr inbounds double, double* %0, i64 %37
%39 = load double, double* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %39)
%41 = add nuw nsw i64 %5, 9
%42 = getelementptr inbounds double, double* %0, i64 %41
%43 = load double, double* %42
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %43)
%45 = tail call i32 @putchar(i32 10)
%46 = add nuw nsw i64 %4, 1
%47 = icmp eq i64 %46, 10
br i1 %47, label %48, label %3
48: ; preds = %3
%49 = tail call i32 @putchar(i32 10)
ret void
}