xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ SetStrPreference(char const *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void SetIntPreference(const char *name, int value) {
  char var[256];
  sprintf(var, "%d", value);
  SetStrPreference(name, var);
}


x86 assembly (clang, -O0):
<SetIntPreference>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xebd(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1030 <SetStrPreference@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetIntPreference>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xeca(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <SetStrPreference@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @SetIntPreference(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [256 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = call i32 @SetStrPreference(i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @SetIntPreference(i8* %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = call i32 @SetStrPreference(i8* %0, i8* %4)
ret void
}
int find_max(const char *str) {
  int max = 0;
  while (*str) {
    if (max < *str)
      max = *str;
    str++;
  }
  return max;
}


x86 assembly (clang, -O0):
<find_max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1149 <find_max+0x49>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jge    1138 <find_max+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <find_max+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_max>:
mov    (%rdi),%cl
test   %cl,%cl
je     1124 <find_max+0x24>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %ecx,%eax
cmovl  %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <find_max+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @find_max(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %9, %12
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %8
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %4
21: ; preds = %4
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @find_max(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = icmp slt i32 %6, %8
%10 = select i1 %9, i32 %8, i32 %6
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
unsigned strlen(const char *s) {
  unsigned i;
  for (i = 0; *s; s++)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1136 <strlen+0x36>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add i32 %9, 1
store i32 %10, i32* %3
br label %11
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add i32 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
unsigned long timeval_to_ms(struct timeval *tv) {
  unsigned long sec_ms = ((unsigned long)tv->tv_sec) * 1000;
  unsigned long usec_ms = ((unsigned long)tv->tv_usec) / 1000;
  return sec_ms + usec_ms;
}


x86 assembly (clang, -O0):
<timeval_to_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3e8,0x8(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_to_ms>:
imul   $0x3e8,0x8(%rdi),%rcx
mov    (%rdi),%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rdx
9b c4 20
mul    %rdx
shr    $0x4,%rdx
add    %rdx,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @timeval_to_ms(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca i64
%4 = alloca i64
store %struct.timeval* %0, %struct.timeval** %2
%5 = load %struct.timeval*, %struct.timeval** %2
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%7 = load i64, i64* %6
%8 = mul i64 %7, 1000
store i64 %8, i64* %3
%9 = load %struct.timeval*, %struct.timeval** %2
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = udiv i64 %11, 1000
store i64 %12, i64* %4
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = add i64 %13, %14
ret i64 %15
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @timeval_to_ms(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = mul i64 %3, 1000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i64, i64* %5
%7 = udiv i64 %6, 1000
%8 = add i64 %7, %4
ret i64 %8
}
double rhodry(double e_mbar, double p_mbar, double tkelvin) {
  double rhodry;
  rhodry = (p_mbar - e_mbar) / (2.8704e-3 * tkelvin);
  return (rhodry);
}


x86 assembly (clang, -O0):
<rhodry>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xedb(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rhodry>:
subsd  %xmm0,%xmm1
mulsd  0xef4(%rip),%xmm2
divsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @rhodry(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = load double, double* %6
%12 = fmul double 2.870400e-03, %11
%13 = fdiv double %10, %12
store double %13, double* %7
%14 = load double, double* %7
ret double %14
}

LLVM IR (-O2):
define double @rhodry(double %0, double %1, double %2) {
%4 = fsub double %1, %0
%5 = fmul double %2, 2.870400e-03
%6 = fdiv double %4, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ drv_FW8888_send_cmd(int);
void drv_FW8888_clear(void) { drv_FW8888_send_cmd(0x01); }


x86 assembly (clang, -O0):
<drv_FW8888_clear>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <drv_FW8888_send_cmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_FW8888_clear>:
mov    $0x1,%edi
jmp    1030 <drv_FW8888_send_cmd@plt>

LLVM IR (-O0):
define void @drv_FW8888_clear() {
%1 = call i32 @drv_FW8888_send_cmd(i32 1)
ret void
}

LLVM IR (-O2):
define void @drv_FW8888_clear() {
%1 = tail call i32 @drv_FW8888_send_cmd(i32 1)
ret void
}
float weightedAverage(float n1, float n2, float w) {
  if (w < 0.0f)
    return n1;
  if (w > 1.0f)
    return n2;
  return w * n2 + (1.0f - w) * n1;
}


x86 assembly (clang, -O0):
<weightedAverage>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    112f <weightedAverage+0x2f>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    117d <weightedAverage+0x7d>
movss  -0x10(%rbp),%xmm0
movss  0xec4(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1154 <weightedAverage+0x54>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    117d <weightedAverage+0x7d>
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe9a(%rip),%xmm1
subss  -0x10(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<weightedAverage>:
xorps  %xmm3,%xmm3
ucomiss %xmm2,%xmm3
ja     112c <weightedAverage+0x2c>
ucomiss 0xef1(%rip),%xmm2
ja     1129 <weightedAverage+0x29>
movss  0xee7(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm2,%xmm1
addss  %xmm3,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @weightedAverage(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %7
%9 = fcmp olt float %8, 0.000000e+00
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %5
store float %11, float* %4
br label %25
12: ; preds = %3
%13 = load float, float* %7
%14 = fcmp ogt float %13, 1.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load float, float* %6
store float %16, float* %4
br label %25
17: ; preds = %12
%18 = load float, float* %7
%19 = load float, float* %6
%20 = load float, float* %7
%21 = fsub float 1.000000e+00, %20
%22 = load float, float* %5
%23 = fmul float %21, %22
%24 = call float @llvm.fmuladd.f32(float %18, float %19, float %23)
store float %24, float* %4
br label %25
25: ; preds = %17, %15, %10
%26 = load float, float* %4
ret float %26
}

LLVM IR (-O2):
define float @weightedAverage(float %0, float %1, float %2) {
%4 = fcmp olt float %2, 0.000000e+00
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = fcmp ogt float %2, 1.000000e+00
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = fsub float 1.000000e+00, %2
%9 = fmul float %8, %0
%10 = tail call float @llvm.fmuladd.f32(float %2, float %1, float %9)
br label %11
11: ; preds = %5, %3, %7
%12 = phi float [ %10, %7 ], [ %0, %3 ], [ %1, %5 ]
ret float %12
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void byebye(int nsig) {
  nsig = 0;
  exit(nsig);
}


x86 assembly (clang, -O0):
<byebye>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<byebye>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @byebye(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
define void @byebye(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
double fabs(double);
double evaluate_objective_function_contribution(double value,
                                                int objective_function) {
  if (objective_function == 0)
    return value * value;
  if (objective_function == 1)
    return fabs(value);
  assert(0);
  return 0;
}


x86 assembly (clang, -O0):
<evaluate_objective_function_contribution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113e <evaluate_objective_function_contribution+0x2e>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1171 <evaluate_objective_function_contribution+0x61>
cmpl   $0x1,-0x14(%rbp)
jne    1162 <evaluate_objective_function_contribution+0x52>
movsd  -0x10(%rbp),%xmm0
movaps 0xeac(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1171 <evaluate_objective_function_contribution+0x61>
xor    %edi,%edi
call   1030 <assert@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_objective_function_contribution>:
push   %rax
cmp    $0x1,%edi
je     1120 <evaluate_objective_function_contribution+0x10>
test   %edi,%edi
jne    1129 <evaluate_objective_function_contribution+0x19>
mulsd  %xmm0,%xmm0
pop    %rax
ret
andps  0xed9(%rip),%xmm0
pop    %rax
ret
xor    %edi,%edi
call   1030 <assert@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @evaluate_objective_function_contribution(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load double, double* %4
%10 = load double, double* %4
%11 = fmul double %9, %10
store double %11, double* %3
br label %20
12: ; preds = %2
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load double, double* %4
%17 = call double @llvm.fabs.f64(double %16)
store double %17, double* %3
br label %20
18: ; preds = %12
%19 = call i32 @assert(i32 0)
store double 0.000000e+00, double* %3
br label %20
20: ; preds = %18, %15, %8
%21 = load double, double* %3
ret double %21
}

LLVM IR (-O2):
define double @evaluate_objective_function_contribution(double %0, i32 %1) {
switch i32 %1, label %7 [
i32 0, label %3
i32 1, label %5
]
3: ; preds = %2
%4 = fmul double %0, %0
br label %9
5: ; preds = %2
%6 = tail call double @llvm.fabs.f64(double %0)
br label %9
7: ; preds = %2
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %7, %5, %3
%10 = phi double [ %4, %3 ], [ %6, %5 ], [ 0.000000e+00, %7 ]
ret double %10
}
int g1(int a, int b) {
  return ((a) < (((a) > (b) ? (a) : (b))) ? (a) : (((a) > (b) ? (a) : (b))));
}


x86 assembly (clang, -O0):
<g1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1127 <g1+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112d <g1+0x2d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1146 <g1+0x46>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <g1+0x69>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    115d <g1+0x5d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1163 <g1+0x63>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g1>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @g1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
br label %13
13: ; preds = %11, %9
%14 = phi i32 [ %10, %9 ], [ %12, %11 ]
%15 = icmp slt i32 %5, %14
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* %3
br label %28
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32, i32* %3
br label %26
24: ; preds = %18
%25 = load i32, i32* %4
br label %26
26: ; preds = %24, %22
%27 = phi i32 [ %23, %22 ], [ %25, %24 ]
br label %28
28: ; preds = %26, %16
%29 = phi i32 [ %17, %16 ], [ %27, %26 ]
ret i32 %29
}

LLVM IR (-O2):
define i32 @g1(i32 %0, i32 %1) {
ret i32 %0
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
const char **find_arg(const char **first, const char **last, const char *arg) {
  for (; first != last; first++) {
    if (strcmp(*first, arg) == 0)
      break;
  }
  return first;
}


x86 assembly (clang, -O0):
<find_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1167 <find_arg+0x57>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1151 <find_arg+0x41>
jmp    1167 <find_arg+0x57>
jmp    1156 <find_arg+0x46>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <find_arg+0x14>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_arg>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
cmp    %rsi,%rdi
je     114c <find_arg+0x3c>
mov    %rdx,%r15
mov    %rsi,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114c <find_arg+0x3c>
add    $0x8,%rbx
cmp    %r14,%rbx
jne    1130 <find_arg+0x20>
mov    %r14,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8** @find_arg(i8** %0, i8** %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8*
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
br label %7
7: ; preds = %19, %3
%8 = load i8**, i8*** %4
%9 = load i8**, i8*** %5
%10 = icmp ne i8** %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i8**, i8*** %4
%13 = load i8*, i8** %12
%14 = load i8*, i8** %6
%15 = call i64 @strcmp(i8* %13, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
br label %22
18: ; preds = %11
br label %19
19: ; preds = %18
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i32 1
store i8** %21, i8*** %4
br label %7
22: ; preds = %17, %7
%23 = load i8**, i8*** %4
ret i8** %23
}

LLVM IR (-O2):
define i8** @find_arg(i8** %0, i8** readnone %1, i8* %2) {
%4 = icmp eq i8** %0, %1
br i1 %4, label %13, label %5
5: ; preds = %3, %10
%6 = phi i8** [ %11, %10 ], [ %0, %3 ]
%7 = load i8*, i8** %6
%8 = tail call i64 @strcmp(i8* %7, i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8*, i8** %6, i64 1
%12 = icmp eq i8** %11, %1
br i1 %12, label %13, label %5
13: ; preds = %10, %5, %3
%14 = phi i8** [ %0, %3 ], [ %6, %5 ], [ %1, %10 ]
ret i8** %14
}
void spi_pin_config(void) {}


x86 assembly (clang, -O0):
<spi_pin_config>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_pin_config>:
ret

LLVM IR (-O0):
define void @spi_pin_config() {
ret void
}

LLVM IR (-O2):
define void @spi_pin_config() {
ret void
}
unsigned char i2c_read_ack(void) { return 0; }


x86 assembly (clang, -O0):
<i2c_read_ack>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_read_ack>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i8 @i2c_read_ack() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @i2c_read_ack() {
ret i8 0
}
/* Variables and functions */
scalar_t__ malloc(int);
char *strcpy(char *, char const *);
int strlen(char const *);
extern char *io_util_strdup(const char *str) {
  char *dummy;
  dummy = (char *)malloc((strlen(str) + 1) * sizeof(char));
  if (dummy == NULL)
    return NULL;
  return strcpy(dummy, str);
}


x86 assembly (clang, -O0):
<io_util_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1171 <io_util_strdup+0x41>
movq   $0x0,-0x8(%rbp)
jmp    1182 <io_util_strdup+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_util_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1159 <io_util_strdup+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    115b <io_util_strdup+0x2b>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @io_util_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 1
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %1
store i8* null, i8** %2
br label %20
16: ; preds = %1
%17 = load i8*, i8** %4
%18 = load i8*, i8** %3
%19 = call i8* @strcpy(i8* %17, i8* %18)
store i8* %19, i8** %2
br label %20
20: ; preds = %16, %15
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
define i8* @io_util_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = inttoptr i64 %4 to i8*
%8 = tail call i8* @strcpy(i8* %7, i8* dereferenceable(1) %0)
br label %9
9: ; preds = %1, %6
%10 = phi i8* [ %7, %6 ], [ null, %1 ]
ret i8* %10
}
int addPasswd(const char *username, const char *passwd) { return 0; }


x86 assembly (clang, -O0):
<addPasswd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addPasswd>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @addPasswd(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @addPasswd(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
int reboot() { return 0; }


x86 assembly (clang, -O0):
<reboot>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reboot>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @reboot() {
ret i32 0
}

LLVM IR (-O2):
define i32 @reboot() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430InterruptP__Port10__disable();
void Msp430InterruptC__1__HplInterrupt__disable(void) {
  HplMsp430InterruptP__Port10__disable();
}


x86 assembly (clang, -O0):
<Msp430InterruptC__1__HplInterrupt__disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HplMsp430InterruptP__Port10__disable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Msp430InterruptC__1__HplInterrupt__disable>:
xor    %eax,%eax
jmp    1030 <HplMsp430InterruptP__Port10__disable@plt>

LLVM IR (-O0):
define void @Msp430InterruptC__1__HplInterrupt__disable() {
%1 = call i32 (...) @HplMsp430InterruptP__Port10__disable()
ret void
}

LLVM IR (-O2):
define void @Msp430InterruptC__1__HplInterrupt__disable() {
%1 = tail call i32 (...) @HplMsp430InterruptP__Port10__disable()
ret void
}
/* Variables and functions */
long add2(int, int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  int m;
  long result;
  scanf("%d", &n);
  scanf("%d", &m);
  result = add2(n, m);
  printf("Sum = %ld\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <add2@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <add2@plt>
lea    0xe99(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"Sum = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i64 @add2(i32 %7, i32 %8)
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"Sum = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i64 @add2(i32 %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %9)
ret i32 0
}
void *dlsym(void *handle, const char *symbol) { return (void *)0; }


x86 assembly (clang, -O0):
<dlsym>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlsym>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @dlsym(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @dlsym(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int luaO_fb2int(int x) {
  int e = (x >> 3) & 31;
  if (e == 0)
    return x;
  else
    return ((x & 7) + 8) << (e - 1);
}


x86 assembly (clang, -O0):
<luaO_fb2int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x3,%eax
and    $0x1f,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1128 <luaO_fb2int+0x28>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113c <luaO_fb2int+0x3c>
mov    -0x8(%rbp),%eax
and    $0x7,%eax
add    $0x8,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<luaO_fb2int>:
mov    %edi,%edx
shr    $0x3,%edx
and    $0x1f,%edx
lea    -0x1(%rdx),%ecx
mov    %edi,%eax
and    $0x7,%eax
or     $0x8,%eax
shl    %cl,%eax
cmp    $0x1,%edx
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @luaO_fb2int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 3
%7 = and i32 %6, 31
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %3
store i32 %11, i32* %2
br label %19
12: ; preds = %1
%13 = load i32, i32* %3
%14 = and i32 %13, 7
%15 = add nsw i32 %14, 8
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = shl i32 %15, %17
store i32 %18, i32* %2
br label %19
19: ; preds = %12, %10
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @luaO_fb2int(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 31
%4 = icmp eq i32 %3, 0
%5 = and i32 %0, 7
%6 = or i32 %5, 8
%7 = add nsw i32 %3, -1
%8 = shl i32 %6, %7
%9 = select i1 %4, i32 %0, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ check(char const *, int, int);
void check_glob(const char *str) { check(str, true, false); }


x86 assembly (clang, -O0):
<check_glob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <check@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_glob>:
mov    $0x1,%esi
xor    %edx,%edx
jmp    1030 <check@plt>

LLVM IR (-O0):
define void @check_glob(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @check(i8* %3, i32 1, i32 0)
ret void
}

LLVM IR (-O2):
define void @check_glob(i8* %0) {
%2 = tail call i32 @check(i8* %0, i32 1, i32 0)
ret void
}
void f() {
  int (*is_ref)(int *s);
  if (is_ref(1)) {
    ;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   *-0x8(%rbp)
cmp    $0x0,%eax
je     111e <f+0x1e>
jmp    111e <f+0x1e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @f() {
%1 = alloca i32 (i32*)*
%2 = load i32 (i32*)*, i32 (i32*)** %1
%3 = call i32 %2(i32* inttoptr (i64 1 to i32*))
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
br label %6
6: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
void aeResizeSetSize(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               35, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<aeResizeSetSize>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x23,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<aeResizeSetSize>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x23,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.aeResizeSetSize = [16 x i8] c"aeResizeSetSize\00"
define void @aeResizeSetSize() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 35, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.aeResizeSetSize, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.aeResizeSetSize = [16 x i8] c"aeResizeSetSize\00"
define void @aeResizeSetSize() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 35, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.aeResizeSetSize, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
__attribute__((__noreturn__)) void exitfunc12(void) {
  printf("Executing exitfunc"
         "12"
         ".\n");
  exit(0);
}


x86 assembly (clang, -O0):
<exitfunc12>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc12>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Executing exitfunc12.\0A\00"
define void @exitfunc12() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [22 x i8] c"Executing exitfunc12.\00"
define void @exitfunc12() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int board_idx(int y, int x) { return y * 39 + x; }


x86 assembly (clang, -O0):
<board_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x27,-0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_idx>:
imul   $0x27,%edi,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @board_idx(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = mul nsw i32 %5, 39
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @board_idx(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 39
%4 = add nsw i32 %3, %1
ret i32 %4
}
void mem_put_le32_as_int(void *vmem, int val) {
  unsigned char *mem = (unsigned char *)vmem;
  mem[0] = (val >> 0) & 0xff;
  mem[1] = (val >> 8) & 0xff;
  mem[2] = (val >> 16) & 0xff;
  mem[3] = (val >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<mem_put_le32_as_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_put_le32_as_int>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @mem_put_le32_as_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i32, i32* %4
%8 = ashr i32 %7, 0
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 %10, i8* %12
%13 = load i32, i32* %4
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %16, i8* %18
%19 = load i32, i32* %4
%20 = ashr i32 %19, 16
%21 = and i32 %20, 255
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 2
store i8 %22, i8* %24
%25 = load i32, i32* %4
%26 = ashr i32 %25, 24
%27 = and i32 %26, 255
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %5
%30 = getelementptr inbounds i8, i8* %29, i64 3
store i8 %28, i8* %30
ret void
}

LLVM IR (-O2):
define void @mem_put_le32_as_int(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void singleArg(int a) {
  printf("singleArg Called!\n");
  printf("Accessing a: %d\n", a);
  a = a * 2;
}


x86 assembly (clang, -O0):
<singleArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singleArg>:
push   %rbx
mov    %edi,%ebx
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeca(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"singleArg Called!\0A\00"
@.str.1 = [17 x i8] c"Accessing a: %d\0A\00"
define void @singleArg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = mul nsw i32 %6, 2
store i32 %7, i32* %2
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"Accessing a: %d\0A\00"
@str = [18 x i8] c"singleArg Called!\00"
define void @singleArg(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
double atof(char *);
double getnum(char *s) {
  char *p;
  for (; *s; s++)
    if (*s == ' ')
      p = s + 1;
  return atof(p);
}


x86 assembly (clang, -O0):
<getnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <getnum+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1145 <getnum+0x35>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114a <getnum+0x3a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <getnum+0xc>
mov    -0x10(%rbp),%rdi
call   1030 <atof@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnum>:
add    $0x1,%rdi
jmp    1127 <getnum+0x17>
cs nopw 0x0(%rax,%rax,1)
mov    %rdi,%rax
add    $0x1,%rdi
movzbl -0x1(%rdi),%ecx
cmp    $0x20,%cl
je     1120 <getnum+0x10>
test   %cl,%cl
jne    1123 <getnum+0x13>
mov    %rax,%rdi
jmp    1030 <atof@plt>

LLVM IR (-O0):
define double @getnum(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
br label %4
4: ; preds = %17, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %15, i8** %3
br label %16
16: ; preds = %13, %8
br label %17
17: ; preds = %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
br label %4
20: ; preds = %4
%21 = load i8*, i8** %3
%22 = call double @atof(i8* %21)
ret double %22
}

LLVM IR (-O2):
define double @getnum(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ undef, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 32, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
%12 = tail call double @atof(i8* %4)
ret double %12
}
void L3_idct3(float x0, float x1, float x2, float *dst) {
  float m1 = x1 * 0.86602540f;
  float a1 = x0 - x2 * 0.5f;
  dst[1] = x0 + x2;
  dst[0] = a1 + m1;
  dst[2] = a1 - m1;
}


x86 assembly (clang, -O0):
<L3_idct3>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
movss  0xee5(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xeb8(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x20(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<L3_idct3>:
mulss  0xef8(%rip),%xmm1
movss  0xef4(%rip),%xmm3
mulss  %xmm2,%xmm3
addss  %xmm0,%xmm3
addss  %xmm2,%xmm0
movss  %xmm0,0x4(%rdi)
movaps %xmm1,%xmm0
addss  %xmm3,%xmm0
movss  %xmm0,(%rdi)
subss  %xmm1,%xmm3
movss  %xmm3,0x8(%rdi)
ret

LLVM IR (-O0):
define void @L3_idct3(float %0, float %1, float %2, float* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float*
%9 = alloca float
%10 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float* %3, float** %8
%11 = load float, float* %6
%12 = fmul float %11, 0x3FEBB67AE0000000
store float %12, float* %9
%13 = load float, float* %5
%14 = load float, float* %7
%15 = fneg float %14
%16 = call float @llvm.fmuladd.f32(float %15, float 5.000000e-01, float %13)
store float %16, float* %10
%17 = load float, float* %5
%18 = load float, float* %7
%19 = fadd float %17, %18
%20 = load float*, float** %8
%21 = getelementptr inbounds float, float* %20, i64 1
store float %19, float* %21
%22 = load float, float* %10
%23 = load float, float* %9
%24 = fadd float %22, %23
%25 = load float*, float** %8
%26 = getelementptr inbounds float, float* %25, i64 0
store float %24, float* %26
%27 = load float, float* %10
%28 = load float, float* %9
%29 = fsub float %27, %28
%30 = load float*, float** %8
%31 = getelementptr inbounds float, float* %30, i64 2
store float %29, float* %31
ret void
}

LLVM IR (-O2):
define void @L3_idct3(float %0, float %1, float %2, float* nocapture writeonly %3) {
%5 = fmul float %1, 0x3FEBB67AE0000000
%6 = fneg float %2
%7 = tail call float @llvm.fmuladd.f32(float %6, float 5.000000e-01, float %0)
%8 = fadd float %0, %2
%9 = getelementptr inbounds float, float* %3, i64 1
store float %8, float* %9
%10 = fadd float %5, %7
store float %10, float* %3
%11 = fsub float %7, %5
%12 = getelementptr inbounds float, float* %3, i64 2
store float %11, float* %12
ret void
}
int test_int() {
  int i;
  int reds[3] = {0};
#pragma acc parallel loop
  for (i = 0; i < 4096; i++) {
    int v;
    v = i - 10;
#pragma acc atomic
    reds[0] -= v;
#pragma acc atomic
    reds[1] = reds[1] - v;
  }
  for (i = 0; i < 2; i++) {
    if (reds[i] != -(4096 * (4096 - 1) / 2 - 10 * 4096)) {
      return i + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    1167 <test_int+0x57>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <test_int+0x1f>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ab <test_int+0x9b>
movslq -0x8(%rbp),%rax
cmpl   $0xff80a800,-0x14(%rbp,%rax,4)
ff
je     1198 <test_int+0x88>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <test_int+0xa2>
jmp    119d <test_int+0x8d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <test_int+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_int>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @test_int() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = bitcast [3 x i32]* %3 to i8*
store i32 0, i32* %2
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 4096
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 10
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%14 = load i32, i32* %13
%15 = sub nsw i32 %14, %12
store i32 %15, i32* %13
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%17 = load i32, i32* %16
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store i32 %19, i32* %20
br label %21
21: ; preds = %9
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %6
24: ; preds = %6
store i32 0, i32* %2
br label %25
25: ; preds = %38, %24
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 2
br i1 %27, label %28, label %41
28: ; preds = %25
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = icmp ne i32 %32, -8345600
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %1
br label %42
37: ; preds = %28
br label %38
38: ; preds = %37
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %25
41: ; preds = %25
store i32 0, i32* %1
br label %42
42: ; preds = %41, %34
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
define i32 @test_int() {
ret i32 0
}
int main(void) {
  struct horario {
    char M[8][40];
  };
  struct horario hora = {.M = {{"X 8 9 10 11 12 13 14 15 16 17 18 19 20"},
                               {"S"},
                               {"T"},
                               {"Q"},
                               {"Q"},
                               {"S"},
                               {"S"},
                               {"D"}}};
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
lea    -0x140(%rbp),%rdi
lea    0xed7(%rip),%rsi
mov    $0x140,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.horario = type { [8 x [40 x i8]] }
@__const.main.hora = %struct.horario { [8 x [40 x i8]] [[40 x i8] c"X 8 9 10 11 12 13 14 15 16 17 18 19 20\00\00", [40 x i8] c"S\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"T\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"Q\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"Q\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"S\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"S\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"D\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"] }
define i32 @main() {
%1 = alloca %struct.horario
%2 = bitcast %struct.horario* %1 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}