#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 *, double, ...);
void print_iteration(double **v, double *f, int n, int itr) {
  int i, j;
  printf("Iteration %d\n", itr);
  for (j = 0; j <= n; j++) {
    for (i = 0; i < n; i++) {
      printf("%f %f\n", v[j][i], f[j]);
    }
  }
}


x86 assembly (clang, -O0):
<print_iteration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
lea    0xece(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11b0 <print_iteration+0xa0>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119d <print_iteration+0x8d>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe86(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1153 <print_iteration+0x43>
jmp    11a2 <print_iteration+0x92>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1140 <print_iteration+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_iteration>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%rbx
cvtsi2sd %ecx,%xmm0
lea    0xecf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbp,0x8(%rsp)
test   %ebp,%ebp
js     11a5 <print_iteration+0x95>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%ecx
mov    %rcx,0x10(%rsp)
mov    %eax,%ebp
xor    %r14d,%r14d
lea    0xeb4(%rip),%r12
jmp    116b <print_iteration+0x5b>
nopl   0x0(%rax)
add    $0x1,%r14
cmp    0x10(%rsp),%r14
je     11a5 <print_iteration+0x95>
cmpl   $0x0,0x8(%rsp)
je     1160 <print_iteration+0x50>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx,%r14,8),%rax
movsd  (%rax,%r13,8),%xmm0
movsd  (%r15,%r14,8),%xmm1
mov    %r12,%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
jne    1180 <print_iteration+0x70>
jmp    1160 <print_iteration+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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