#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_profit_values(long max_precincts, int max_quality_layers,
                         double **profit) {
  int i, j;
  printf("\nprofit (psnr or ssim values): \n");
  for (i = 0; i < max_precincts; i++) {
    for (j = 0; j < max_quality_layers; j++) {
      printf(" %4.2lf ", profit[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_profit_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    11a6 <print_profit_values+0x96>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118a <print_profit_values+0x7a>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeac(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114d <print_profit_values+0x3d>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <print_profit_values+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_profit_values>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r13
mov    %esi,0x4(%rsp)
mov    %rdi,%r15
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
test   %r15,%r15
jle    11b0 <print_profit_values+0x80>
mov    0x4(%rsp),%ebp
xor    %ebx,%ebx
lea    0xe9d(%rip),%r12
jmp    1183 <print_profit_values+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r15,%rbx
je     11b0 <print_profit_values+0x80>
cmpl   $0x0,0x4(%rsp)
jle    1170 <print_profit_values+0x40>
xor    %r14d,%r14d
nopl   (%rax)
mov    0x0(%r13,%rbx,8),%rax
movsd  (%rax,%r14,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1190 <print_profit_values+0x60>
jmp    1170 <print_profit_values+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [9 x i8] c" %4.2lf \00"
@str = [32 x i8] c"\0Aprofit (psnr or ssim values): \00"
define void @print_profit_values(i64 %0, i32 %1, double** nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i64 %0, 0
br i1 %5, label %6, label %25
6: ; preds = %3
%7 = icmp sgt i32 %1, 0
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %21
%10 = phi i64 [ 0, %6 ], [ %23, %21 ]
br i1 %7, label %11, label %21
11: ; preds = %9
%12 = getelementptr inbounds double*, double** %2, i64 %10
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %19, %13 ]
%15 = load double*, double** %12
%16 = getelementptr inbounds double, double* %15, i64 %14
%17 = load double, double* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = add nuw nsw i64 %14, 1
%20 = icmp eq i64 %19, %8
br i1 %20, label %21, label %13
21: ; preds = %13, %9
%22 = tail call i32 @putchar(i32 10)
%23 = add nuw nsw i64 %10, 1
%24 = icmp eq i64 %23, %0
br i1 %24, label %25, label %9
25: ; preds = %21, %3
ret void
}