#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 exp(double);
void exponentiate_lum(double **image, int width, int height) {
  int x, y;
  for (y = 0; y < height; y++)
    for (x = 0; x < width; x++)
      image[y][x] = exp(image[y][x]) - 1e-5;
}


x86 assembly (clang, -O0):
<exponentiate_lum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a8 <exponentiate_lum+0x98>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1195 <exponentiate_lum+0x85>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe92(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113c <exponentiate_lum+0x2c>
jmp    119a <exponentiate_lum+0x8a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1129 <exponentiate_lum+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponentiate_lum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1181 <exponentiate_lum+0x71>
mov    %esi,%r14d
mov    %rdi,%r12
mov    %edx,%r15d
mov    %esi,%r13d
xor    %ebx,%ebx
jmp    1139 <exponentiate_lum+0x29>
nop
add    $0x1,%rbx
cmp    %r15,%rbx
je     1181 <exponentiate_lum+0x71>
test   %r14d,%r14d
jle    1130 <exponentiate_lum+0x20>
mov    (%r12,%rbx,8),%rax
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rax,%rbp,8),%xmm0
call   1030 <exp@plt>
movsd  0xe9e(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm1,%xmm0
mov    (%r12,%rbx,8),%rax
movsd  %xmm0,(%rax,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1150 <exponentiate_lum+0x40>
jmp    1130 <exponentiate_lum+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @exponentiate_lum(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* %8
br label %9
9: ; preds = %43, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %46
13: ; preds = %9
store i32 0, i32* %7
br label %14
14: ; preds = %39, %13
%15 = load i32, i32* %7
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %42
18: ; preds = %14
%19 = load double**, double*** %4
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double*, double** %19, i64 %21
%23 = load double*, double** %22
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = call i32 @exp(double %27)
%29 = sitofp i32 %28 to double
%30 = fsub double %29, 1.000000e-05
%31 = load double**, double*** %4
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double*, double** %31, i64 %33
%35 = load double*, double** %34
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
store double %30, double* %38
br label %39
39: ; preds = %18
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %14
42: ; preds = %14
br label %43
43: ; preds = %42
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %9
46: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @exponentiate_lum(double** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %29
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
%7 = zext i32 %2 to i64
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %5, %26
%10 = phi i64 [ 0, %5 ], [ %27, %26 ]
br i1 %6, label %11, label %26
11: ; preds = %9
%12 = getelementptr inbounds double*, double** %0, i64 %10
%13 = load double*, double** %12
br label %14
14: ; preds = %11, %14
%15 = phi double* [ %13, %11 ], [ %22, %14 ]
%16 = phi i64 [ 0, %11 ], [ %24, %14 ]
%17 = getelementptr inbounds double, double* %15, i64 %16
%18 = load double, double* %17
%19 = tail call i32 @exp(double %18)
%20 = sitofp i32 %19 to double
%21 = fadd double %20, -1.000000e-05
%22 = load double*, double** %12
%23 = getelementptr inbounds double, double* %22, i64 %16
store double %21, double* %23
%24 = add nuw nsw i64 %16, 1
%25 = icmp eq i64 %24, %8
br i1 %25, label %26, label %14
26: ; preds = %14, %9
%27 = add nuw nsw i64 %10, 1
%28 = icmp eq i64 %27, %7
br i1 %28, label %29, label %9
29: ; preds = %26, %3
ret void
}