#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 decisionFunc(double);
int /*<<< orphan*/ printf(char *, int, ...);
void out(double **result, int images_num, int results_num) {
  int i, j;
  for (i = 0; i < images_num; i++) {
    printf("Results for image %d:\n", i);
    for (j = 0; j < results_num; j++) {
      printf("%f\n", result[i][j]);
      if (decisionFunc(result[i][j]) == 1) {
        printf("Image %d is symbol %d.\n", i, j);
      }
    }
  }
}


x86 assembly (clang, -O0):
<out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e9 <out+0xc9>
mov    -0x14(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d6 <out+0xb6>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <decisionFunc@plt>
cmp    $0x1,%eax
jne    11c3 <out+0xa3>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c8 <out+0xa8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115d <out+0x3d>
jmp    11db <out+0xbb>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <out+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
test   %esi,%esi
jle    11d2 <out+0xb2>
mov    %rdi,%rbx
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r15d
lea    0xec7(%rip),%r13
lea    0xec4(%rip),%r12
xor    %ebp,%ebp
jmp    116b <out+0x4b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    0x10(%rsp),%rbp
je     11d2 <out+0xb2>
lea    0xe8e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1160 <out+0x40>
xor    %r14d,%r14d
jmp    1199 <out+0x79>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    %r14,%r15
je     1160 <out+0x40>
mov    (%rbx,%rbp,8),%rax
cvttsd2si (%rax,%r14,8),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx,%rbp,8),%rax
movsd  (%rax,%r14,8),%xmm0
call   1040 <decisionFunc@plt>
cmp    $0x1,%eax
jne    1190 <out+0x70>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1190 <out+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Results for image %d:\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
@.str.2 = [24 x i8] c"Image %d is symbol %d.\0A\00"
define void @out(double** %0, i32 %1, i32 %2) {
%4 = alloca double**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double** %0, double*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %52, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %55
13: ; preds = %9
%14 = load i32, i32* %7
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %14)
store i32 0, i32* %8
br label %16
16: ; preds = %48, %13
%17 = load i32, i32* %8
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %51
20: ; preds = %16
%21 = load double**, double*** %4
%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 = fptosi double %29 to i32
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load double**, double*** %4
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = call i32 @decisionFunc(double %40)
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %47
43: ; preds = %20
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %44, i32 %45)
br label %47
47: ; preds = %43, %20
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %16
51: ; preds = %16
br label %52
52: ; preds = %51
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %9
55: ; preds = %9
ret void
}

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