xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ execve(char *, char **, char **);
int getpid();
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int my_fexecve(int fd, char **arg, char **env) {
  char fname[1024];
  snprintf(fname, 1024, "/proc/%d/fd/%d", getpid(), fd);
  execve(fname, arg, env);
  return 0;
}


x86 assembly (clang, -O0):
<my_fexecve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x428(%rbp),%rdi
mov    %eax,%ecx
mov    -0x4(%rbp),%r8d
mov    $0x400,%esi
lea    0xe8c(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <execve@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_fexecve>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xead(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %eax,%ecx
mov    %ebp,%r8d
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <execve@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/proc/%d/fd/%d\00"
define i32 @my_fexecve(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca [1024 x i8]
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%9 = call i32 (...) @getpid()
%10 = load i32, i32* %4
%11 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%13 = load i8**, i8*** %5
%14 = load i8**, i8*** %6
%15 = call i32 @execve(i8* %12, i8** %13, i8** %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"/proc/%d/fd/%d\00"
define i32 @my_fexecve(i32 %0, i8** %1, i8** %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = tail call i32 (...) @getpid()
%7 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %0)
%8 = call i32 @execve(i8* %5, i8** %1, i8** %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
int main(void) {
  float x = 2.55f;
  float result;
  result = 3 * (x * x * x) - 5 * (x * x) + 6;
  printf("The result of 3(x^3) - 5(x^2) + 6 where x = %f is: %f\n", x, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee5(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
mulss  -0x8(%rbp),%xmm2
movss  0xebb(%rip),%xmm1
mulss  %xmm2,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xe9e(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe8a(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [55 x i8] c"The result of 3(x^3) - 5(x^2) + 6 where x = %f is: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x4004666660000000, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fmul float %4, %5
%7 = load float, float* %2
%8 = fmul float %6, %7
%9 = load float, float* %2
%10 = load float, float* %2
%11 = fmul float %9, %10
%12 = fmul float 5.000000e+00, %11
%13 = fneg float %12
%14 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %8, float %13)
%15 = fadd float %14, 6.000000e+00
store float %15, float* %3
%16 = load float, float* %2
%17 = load float, float* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), float %16, float %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [55 x i8] c"The result of 3(x^3) - 5(x^2) + 6 where x = %f is: %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), float 0x4004666660000000, float 0x40373B4BA0000000)
ret i32 0
}
char *fixtype(type)
char *type;
{ return (fixit(type, type)); }


x86 assembly (clang, -O0):
<fixtype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <fixit@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixtype>:
push   %rax
mov    %rdi,%rsi
xor    %eax,%eax
call   1030 <fixit@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @fixtype(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @fixit to i32 (i8*, i8*, ...)*)(i8* %3, i8* %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @fixtype(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @fixit to i32 (i8*, i8*, ...)*)(i8* %0, i8* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int hwmon_chip_present() {
  FILE *fp = fopen("/sys/class/hwmon/hwmon0/device/name", "r");
  if (fp != NULL) {
    fclose(fp);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<hwmon_chip_present>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xeee(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115f <hwmon_chip_present+0x3f>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1166 <hwmon_chip_present+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hwmon_chip_present>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef5(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1148 <hwmon_chip_present+0x28>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"/sys/class/hwmon/hwmon0/device/name\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @hwmon_chip_present() {
%1 = alloca i32
%2 = alloca i32*
%3 = call i32* @fopen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32*, i32** %2
%8 = call i32 @fclose(i32* %7)
store i32 1, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [36 x i8] c"/sys/class/hwmon/hwmon0/device/name\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @hwmon_chip_present() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @fclose(i32* %1)
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ 1, %3 ], [ 0, %0 ]
ret i32 %6
}
int lesf2(float a, float b) { return a <= b; }


x86 assembly (clang, -O0):
<lesf2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lesf2>:
xor    %eax,%eax
ucomiss %xmm0,%xmm1
setae  %al
ret

LLVM IR (-O0):
define i32 @lesf2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ole float %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @lesf2(float %0, float %1) {
%3 = fcmp ole float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int checkIfBreakPoint(int *breakPoints, int lineNumber) {
  for (int i = 0; i < 100; i++) {
    if (breakPoints[i] == lineNumber)
      return 1;
    if (breakPoints[i] == -1)
      return 0;
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<checkIfBreakPoint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x64,-0x18(%rbp)
jge    1171 <checkIfBreakPoint+0x71>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    113c <checkIfBreakPoint+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1178 <checkIfBreakPoint+0x78>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    115a <checkIfBreakPoint+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1178 <checkIfBreakPoint+0x78>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <checkIfBreakPoint+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIfBreakPoint>:
xor    %ecx,%ecx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rdi,%rcx,4),%edx
cmp    %esi,%edx
je     112a <checkIfBreakPoint+0x2a>
cmp    $0xffffffff,%edx
je     1129 <checkIfBreakPoint+0x29>
lea    0x2(%rcx),%rdx
cmp    $0x62,%rcx
mov    %rdx,%rcx
jb     1110 <checkIfBreakPoint+0x10>
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @checkIfBreakPoint(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %30, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = load i32*, i32** %4
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = load i32, i32* %5
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %10
store i32 1, i32* %3
br label %34
19: ; preds = %10
%20 = load i32*, i32** %4
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %27
26: ; preds = %19
store i32 0, i32* %3
br label %34
27: ; preds = %19
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %30
30: ; preds = %27
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %7
33: ; preds = %7
store i32 0, i32* %3
br label %34
34: ; preds = %33, %26, %18
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @checkIfBreakPoint(i32* nocapture %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i64 [ 0, %2 ], [ %10, %8 ]
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, %1
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = icmp ne i32 %6, -1
%10 = add nuw nsw i64 %4, 2
%11 = icmp ult i64 %4, 98
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %3, label %13
13: ; preds = %8, %3
%14 = phi i32 [ 1, %3 ], [ 0, %8 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned long f10(unsigned long x,
                                               unsigned long y) {
  unsigned long r = x - y;
  if (r <= y)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     1141 <f10+0x31>
xor    %edi,%edi
call   1030 <foo@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f10>:
push   %rbx
mov    %rdi,%rbx
sub    %rsi,%rbx
cmp    %rsi,%rbx
ja     1123 <f10+0x13>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @f10(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = sub i64 %6, %7
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = icmp ule i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @foo(i32 0)
br label %14
14: ; preds = %12, %2
%15 = load i64, i64* %5
ret i64 %15
}

LLVM IR (-O2):
define i64 @f10(i64 %0, i64 %1) {
%3 = sub i64 %0, %1
%4 = icmp ugt i64 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @foo(i32 0)
br label %7
7: ; preds = %5, %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, short);
char *strdup(char *);
char *get_field_imm14(long instr) {
  char tmpstr[25];
  sprintf(tmpstr, "%d", (short)((instr & 0x00003FFF) >> 0));
  return (strdup(tmpstr));
}


x86 assembly (clang, -O0):
<get_field_imm14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rax
and    $0x3fff,%rax
sar    $0x0,%rax
lea    0xebb(%rip),%rsi
movswl %ax,%edx
call   1030 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <strdup@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_field_imm14>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rdx
and    $0x3fff,%edx
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strdup@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @get_field_imm14(i64 %0) {
%2 = alloca i64
%3 = alloca [25 x i8]
store i64 %0, i64* %2
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%5 = load i64, i64* %2
%6 = and i64 %5, 16383
%7 = ashr i64 %6, 0
%8 = trunc i64 %7 to i16
%9 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 signext %8)
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%11 = call i8* @strdup(i8* %10)
ret i8* %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define noalias i8* @get_field_imm14(i64 %0) {
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%4 = trunc i64 %0 to i16
%5 = and i16 %4, 16383
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 signext %5)
%7 = call i8* @strdup(i8* %3)
ret i8* %7
}
void swapChar(void *a, void *b) {
  char *x = *(char *)a;
  char *y = *(char *)b;
  char aux = *x;
  *x = *y;
  *y = aux;
}


x86 assembly (clang, -O0):
<swapChar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbq (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbq (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x21(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapChar>:
movsbq (%rdi),%rax
movsbq (%rsi),%rcx
mov    (%rax),%sil
mov    (%rcx),%dl
mov    %dl,(%rax)
mov    %sil,(%rcx)
ret

LLVM IR (-O0):
define void @swapChar(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i64
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %5
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i64
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %6
%16 = load i8*, i8** %5
%17 = load i8, i8* %16
store i8 %17, i8* %7
%18 = load i8*, i8** %6
%19 = load i8, i8* %18
%20 = load i8*, i8** %5
store i8 %19, i8* %20
%21 = load i8, i8* %7
%22 = load i8*, i8** %6
store i8 %21, i8* %22
ret void
}

LLVM IR (-O2):
define void @swapChar(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = load i8, i8* %1
%7 = sext i8 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = load i8, i8* %5
%10 = load i8, i8* %8
store i8 %10, i8* %5
store i8 %9, i8* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IDEA_keyset(unsigned char *);
char *IDEAdecrypt(unsigned char *, unsigned int);
char *IDEA_decrypt(unsigned char *input, unsigned char *key, unsigned size) {
  IDEA_keyset(key);
  return IDEAdecrypt(input, size);
}


x86 assembly (clang, -O0):
<IDEA_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <IDEA_keyset@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <IDEAdecrypt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IDEA_decrypt>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <IDEA_keyset@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <IDEAdecrypt@plt>

LLVM IR (-O0):
define i8* @IDEA_decrypt(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = call i32 @IDEA_keyset(i8* %7)
%9 = load i8*, i8** %4
%10 = load i32, i32* %6
%11 = call i8* @IDEAdecrypt(i8* %9, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @IDEA_decrypt(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @IDEA_keyset(i8* %1)
%5 = tail call i8* @IDEAdecrypt(i8* %0, i32 %2)
ret i8* %5
}
/* Variables and functions */
int strncasecmp(char *, char *, int);
void strncasecmp_diff_length_1() {
  char *x = "abc";
  char *y = "aBdef";
  if (strncasecmp(x, y, 5) != -1)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strncasecmp_diff_length_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncasecmp@plt>
cmp    $0xffffffff,%eax
je     1149 <strncasecmp_diff_length_1+0x39>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [6 x i8] c"aBdef\00"
define void @strncasecmp_diff_length_1() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @strncasecmp(i8* %3, i8* %4, i32 5)
%6 = icmp ne i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = load i8, i8* null
br label %9
9: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
define void @strncasecmp_diff_length_1() {
ret void
}
void inclass_ext_unit2inclass_unit() {}


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

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

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

LLVM IR (-O2):
define void @inclass_ext_unit2inclass_unit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_console_alarm();
void do_entInt(unsigned long type, unsigned long vector) {
  switch (type) {
  case 0:
    break;
  case 1:
    set_console_alarm();
    break;
  case 2:
    break;
  }
}


x86 assembly (clang, -O0):
<do_entInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
test   %rax,%rax
je     115c <do_entInt+0x4c>
jmp    1136 <do_entInt+0x26>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
je     1161 <do_entInt+0x51>
jmp    1149 <do_entInt+0x39>
mov    -0x18(%rbp),%rax
sub    $0x2,%rax
je     116d <do_entInt+0x5d>
jmp    1172 <do_entInt+0x62>
jmp    1172 <do_entInt+0x62>
mov    $0x0,%al
call   1030 <set_console_alarm@plt>
jmp    1172 <do_entInt+0x62>
jmp    1172 <do_entInt+0x62>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_entInt>:
cmp    $0x1,%rdi
jne    111d <do_entInt+0xd>
xor    %eax,%eax
jmp    1030 <set_console_alarm@plt>
ret

LLVM IR (-O0):
define void @do_entInt(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
switch i64 %5, label %10 [
i64 0, label %6
i64 1, label %7
i64 2, label %9
]
6: ; preds = %2
br label %10
7: ; preds = %2
%8 = call i32 (...) @set_console_alarm()
br label %10
9: ; preds = %2
br label %10
10: ; preds = %2, %9, %7, %6
ret void
}

LLVM IR (-O2):
define void @do_entInt(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @set_console_alarm()
br label %6
6: ; preds = %2, %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int WriteUInt8(uint8_t *ptr, int ofs, uint8_t val) {
  ptr[ofs] = val;
  return (ofs + 1);
}


x86 assembly (clang, -O0):
<WriteUInt8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteUInt8>:
movslq %esi,%rax
mov    %edx,(%rdi,%rax,4)
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @WriteUInt8(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
store i32 %7, i32* %11
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @WriteUInt8(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
store i32 %2, i32* %5
%6 = add nsw i32 %1, 1
ret i32 %6
}
int __attribute__((visibility("default"))) func_from_language_runtime(void) {
  return 86;
}


x86 assembly (clang, -O0):
<func_from_language_runtime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x56,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_from_language_runtime>:
mov    $0x56,%eax
ret

LLVM IR (-O0):
define i32 @func_from_language_runtime() {
ret i32 86
}

LLVM IR (-O2):
define i32 @func_from_language_runtime() {
ret i32 86
}
/* Variables and functions */
bool allspace(char *p, unsigned n) {
  unsigned i;
  for (i = 0; i < n; i++)
    if (p[i] != ' ')
      return false;
  return true;
}


x86 assembly (clang, -O0):
<allspace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1151 <allspace+0x51>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     113e <allspace+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1158 <allspace+0x58>
jmp    1143 <allspace+0x43>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <allspace+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<allspace>:
mov    $0x1,%eax
test   %esi,%esi
je     111f <allspace+0x1f>
mov    %esi,%ecx
xor    %edx,%edx
nopl   (%rax)
cmpb   $0x20,(%rdi,%rdx,1)
jne    1120 <allspace+0x20>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <allspace+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @allspace(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 32
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %6, label %14
14: ; preds = %8, %6, %2
%15 = phi i32 [ 1, %2 ], [ 1, %6 ], [ 0, %8 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void hello_sub() { printf("\n%s\n\n", "hello world"); }


x86 assembly (clang, -O0):
<hello_sub>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee4(%rip),%rsi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello_sub>:
lea    0xee9(%rip),%rdi
lea    0xee8(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\0A%s\0A\0A\00"
@.str.1 = [12 x i8] c"hello world\00"
define void @hello_sub() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\0A%s\0A\0A\00"
@.str.1 = [12 x i8] c"hello world\00"
define void @hello_sub() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret void
}
multidef(sname) char *sname;
{
  error("already defined");
  comment();
  outstr(sname);
  nl();
}


x86 assembly (clang, -O0):
<multidef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1060 <error@plt>
mov    $0x0,%al
call   1050 <comment@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <outstr@plt>
mov    $0x0,%al
call   1030 <nl@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multidef>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1060 <error@plt>
xor    %eax,%eax
call   1050 <comment@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outstr@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <nl@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"already defined\00"
define i32 @multidef(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @comment()
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @outstr to i32 (i8*, ...)*)(i8* %6)
%8 = call i32 (...) @nl()
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@.str = [16 x i8] c"already defined\00"
define i32 @multidef(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @comment()
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @outstr to i32 (i8*, ...)*)(i8* %0)
%5 = tail call i32 (...) @nl()
ret i32 undef
}
void SPI_RP_EnableTxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPI_RP_EnableTxInt() {
ret void
}
void HeapCleanup() {}


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

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

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

LLVM IR (-O2):
define void @HeapCleanup() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fgetc(int /*<<< orphan*/ *);
void skip_bytes(FILE *fp, int n) {
  while (n-- > 0)
    fgetc(fp);
}


x86 assembly (clang, -O0):
<skip_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1141 <skip_bytes+0x31>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
jmp    111f <skip_bytes+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_bytes>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1130 <skip_bytes+0x20>
mov    %esi,%ebx
mov    %rdi,%r14
add    $0x1,%ebx
mov    %r14,%rdi
call   1030 <fgetc@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <skip_bytes+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @skip_bytes(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %4
%7 = add nsw i32 %6, -1
store i32 %7, i32* %4
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32*, i32** %3
%11 = call i32 @fgetc(i32* %10)
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @skip_bytes(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %1, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @fgetc(i32* %0)
%8 = icmp ugt i32 %5, 1
br i1 %8, label %4, label %9
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
scalar_t__ isleap(int);
scalar_t__ isleappartial(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  for (int year = 0; year < 2500; year++) {
    if (isleap(year) != isleappartial(year)) {
      printf("Issue with year %d\n", year);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x9c4,-0x8(%rbp)
jge    1199 <main+0x69>
mov    -0x8(%rbp),%edi
call   1030 <isleap@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <isleappartial@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     1186 <main+0x56>
mov    -0x8(%rbp),%esi
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
jmp    118b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xec2(%rip),%r14
jmp    114b <main+0x1b>
add    $0x1,%ebx
cmp    $0x9c4,%ebx
je     116d <main+0x3d>
mov    %ebx,%edi
call   1030 <isleap@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1040 <isleappartial@plt>
cmp    %rax,%r15
je     1140 <main+0x10>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
jmp    1140 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Issue with year %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 2500
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i64 @isleap(i32 %7)
%9 = load i32, i32* %2
%10 = call i64 @isleappartial(i32 %9)
%11 = icmp ne i64 %8, %10
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %6
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %3
19: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Issue with year %d\0A\00"
define i32 @main() {
br label %2
1: ; preds = %9
ret i32 0
2: ; preds = %0, %9
%3 = phi i32 [ 0, %0 ], [ %10, %9 ]
%4 = tail call i64 @isleap(i32 %3)
%5 = tail call i64 @isleappartial(i32 %3)
%6 = icmp eq i64 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %9
9: ; preds = %2, %7
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 2500
br i1 %11, label %1, label %2
}
int floatcmp(void *p1, void *p2) {
  float *f1 = p1, *f2 = p2;
  return *f1 > *f2 ? 1 : (*f1 < *f2 ? -1 : 0);
}


x86 assembly (clang, -O0):
<floatcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomiss (%rax),%xmm0
jbe    113e <floatcmp+0x3e>
mov    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115e <floatcmp+0x5e>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
xor    %eax,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatcmp>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomiss %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @floatcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca float*
%6 = alloca float*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to float*
store float* %8, float** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to float*
store float* %10, float** %6
%11 = load float*, float** %5
%12 = load float, float* %11
%13 = load float*, float** %6
%14 = load float, float* %13
%15 = fcmp ogt float %12, %14
br i1 %15, label %16, label %17
16: ; preds = %2
br label %25
17: ; preds = %2
%18 = load float*, float** %5
%19 = load float, float* %18
%20 = load float*, float** %6
%21 = load float, float* %20
%22 = fcmp olt float %19, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 -1, i32 0
br label %25
25: ; preds = %17, %16
%26 = phi i32 [ 1, %16 ], [ %24, %17 ]
ret i32 %26
}

LLVM IR (-O2):
define i32 @floatcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = bitcast i8* %1 to float*
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ogt float %5, %6
%8 = fcmp olt float %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
char *salloc(length)
unsigned length;
{
  char *c, *s;
  c = malloc(length);
  if (!c)
    error(5);
  for (s = c; s < c + length; s++)
    *s = 0;
  return (c);
}


x86 assembly (clang, -O0):
<salloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <salloc+0x30>
mov    $0x5,%edi
mov    $0x0,%al
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%edx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1187 <salloc+0x67>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1158 <salloc+0x38>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<salloc>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    %edi,%ebx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1172 <salloc+0x42>
test   %ebp,%ebp
je     116a <salloc+0x3a>
add    %r14,%rbx
lea    0x1(%r14),%rax
cmp    %rax,%rbx
cmovbe %rax,%rbx
sub    %r14,%rbx
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x5,%edi
xor    %eax,%eax
call   1050 <error@plt>
test   %ebp,%ebp
jne    114c <salloc+0x1c>
jmp    116a <salloc+0x3a>

LLVM IR (-O0):
define i8* @salloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 5)
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %3
store i8* %13, i8** %4
br label %14
14: ; preds = %23, %12
%15 = load i8*, i8** %4
%16 = load i8*, i8** %3
%17 = load i32, i32* %2
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = icmp ult i8* %15, %19
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = load i8*, i8** %4
store i8 0, i8* %22
br label %23
23: ; preds = %21
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
br label %14
26: ; preds = %14
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
define i8* @salloc(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
%4 = ptrtoint i8* %3 to i64
%5 = icmp eq i8* %3, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 5)
br label %8
8: ; preds = %6, %1
%9 = icmp eq i32 %0, 0
br i1 %9, label %15, label %10
10: ; preds = %8
%11 = add i64 %4, %2
%12 = add i64 %4, 1
%13 = call i64 @llvm.umax.i64(i64 %11, i64 %12)
%14 = sub i64 %13, %4
br label %15
15: ; preds = %10, %8
ret i8* %3
}
void RandomFunc(unsigned char input[1], unsigned char output[1]) {
  unsigned char state[1];
  unsigned char local1;
  {
    state[0UL] = input[0UL] + (unsigned char)219;
    local1 = 0UL;
    while (local1 < (unsigned char)0) {
      state[0UL] |= (state[0UL] & (unsigned char)63) << 4UL;
      local1++;
    }
    output[0UL] = state[0UL] ^ (unsigned char)236;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
add    $0xdb,%eax
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
cmp    $0x0,%eax
jge    114c <RandomFunc+0x4c>
movzbl -0x11(%rbp),%ecx
and    $0x3f,%ecx
shl    $0x4,%ecx
movzbl -0x11(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    111f <RandomFunc+0x1f>
movzbl -0x11(%rbp),%eax
xor    $0xec,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%al
add    $0xdb,%al
xor    $0xec,%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1 x i8]
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = add nsw i32 %10, 219
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 %12, i8* %13
store i8 0, i8* %6
br label %14
14: ; preds = %18, %2
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = and i32 %21, 63
%23 = shl i32 %22, 4
%24 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = or i32 %26, %23
%28 = trunc i32 %27 to i8
store i8 %28, i8* %24
%29 = load i8, i8* %6
%30 = add i8 %29, 1
store i8 %30, i8* %6
br label %14
31: ; preds = %14
%32 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = xor i32 %34, 236
%36 = trunc i32 %35 to i8
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 0
store i8 %36, i8* %38
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = add i8 %3, -37
%5 = xor i8 %4, -20
store i8 %5, i8* %1
ret void
}
double vec3_dot(const double *v1, const double *v2) {
  return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
}


x86 assembly (clang, -O0):
<vec3_dot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_dot>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @vec3_dot(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %18)
ret double %25
}

LLVM IR (-O2):
define double @vec3_dot(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void nocrash_fileno() {
  FILE *f;
  f = fopen("this_file_doesnt_exist", "r");
  if (f) {
    fileno(f);
    fclose(f);
  }
}


x86 assembly (clang, -O0):
<nocrash_fileno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116c <nocrash_fileno+0x3c>
mov    -0x8(%rbp),%rdi
call   1040 <fileno@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nocrash_fileno>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     115d <nocrash_fileno+0x2d>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fileno@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_fileno() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32*, i32** %1
%7 = call i32 @fileno(i32* %6)
%8 = load i32*, i32** %1
%9 = call i32 @fclose(i32* %8)
br label %10
10: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_fileno() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @fileno(i32* %1)
%5 = tail call i32 @fclose(i32* %1)
br label %6
6: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_logo(void) {
  printf("<a href=\"http://www.hypermail.org/\"><img "
         "src=\"http://www.hypermail.org/images/hypermail-small.gif "
         "alt=\"HYPERMAIL\" align=bottom></a>");
}


x86 assembly (clang, -O0):
<print_logo>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_logo>:
lea    0xee9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [132 x i8] c"<a href=\22http://www.hypermail.org/\22><img src=\22http://www.hypermail.org/images/hypermail-small.gif alt=\22HYPERMAIL\22 align=bottom></a>\00"
define void @print_logo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [132 x i8] c"<a href=\22http://www.hypermail.org/\22><img src=\22http://www.hypermail.org/images/hypermail-small.gif alt=\22HYPERMAIL\22 align=bottom></a>\00"
define void @print_logo() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0))
ret void
}
int ijk2n(int i, int j, int k) { return (i + 4 * j + 16 * k); }


x86 assembly (clang, -O0):
<ijk2n>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ijk2n>:
lea    (%rdi,%rsi,4),%eax
shl    $0x4,%edx
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @ijk2n(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 4, %8
%10 = add nsw i32 %7, %9
%11 = load i32, i32* %6
%12 = mul nsw i32 16, %11
%13 = add nsw i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @ijk2n(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 %1, 2
%5 = add nsw i32 %4, %0
%6 = shl nsw i32 %2, 4
%7 = add nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
size_t os_get_working_directory(char *, size_t);
size_t lovrFilesystemGetWorkingDirectory(char *buffer, size_t size) {
  return os_get_working_directory(buffer, size);
}


x86 assembly (clang, -O0):
<lovrFilesystemGetWorkingDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <os_get_working_directory@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lovrFilesystemGetWorkingDirectory>:
jmp    1030 <os_get_working_directory@plt>

LLVM IR (-O0):
define i64 @lovrFilesystemGetWorkingDirectory(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i64 @os_get_working_directory(i8* %5, i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @lovrFilesystemGetWorkingDirectory(i8* %0, i64 %1) {
%3 = tail call i64 @os_get_working_directory(i8* %0, i64 %1)
ret i64 %3
}