xunge/DecIR huggingface dataset:
/* Type definitions */
struct bladerf {
  int dummy;
};

/* Variables and functions */
int version_check_fpga(struct bladerf *);
int fpga_check_version(struct bladerf *dev) {
  int status = version_check_fpga(dev);
  return status;
}


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

x86 assembly (clang, -O2):
<fpga_check_version>:
jmp    1030 <version_check_fpga@plt>

LLVM IR (-O0):
%struct.bladerf = type { i32 }
define i32 @fpga_check_version(%struct.bladerf* %0) {
%2 = alloca %struct.bladerf*
%3 = alloca i32
store %struct.bladerf* %0, %struct.bladerf** %2
%4 = load %struct.bladerf*, %struct.bladerf** %2
%5 = call i32 @version_check_fpga(%struct.bladerf* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.bladerf = type { i32 }
define i32 @fpga_check_version(%struct.bladerf* %0) {
%2 = tail call i32 @version_check_fpga(%struct.bladerf* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("hello world\n");
  printf("hello world\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str.1 = [12 x i8] c"hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fread(void volatile *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void loadImage(FILE *infile, volatile void *address, int numbytes) {
  int outlen = fread(address, sizeof(char), numbytes, infile);
  if (outlen != numbytes) {
    printf("ERROR READING\n");
  }
  fclose(infile);
}


x86 assembly (clang, -O0):
<loadImage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1173 <loadImage+0x43>
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadImage>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x1,%esi
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    %ebp,%eax
je     1158 <loadImage+0x28>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <fclose@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"ERROR READING\0A\00"
define void @loadImage(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i32*, i32** %4
%11 = call i32 @fread(i8* %8, i32 1, i32 %9, i32* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %3
%18 = load i32*, i32** %4
%19 = call i32 @fclose(i32* %18)
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"ERROR READING\00"
define void @loadImage(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @fread(i8* %1, i32 1, i32 %2, i32* %0)
%5 = icmp eq i32 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @fclose(i32* %0)
ret void
}
int *f() { return 0; }


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

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

LLVM IR (-O0):
define i32* @f() {
ret i32* null
}

LLVM IR (-O2):
define noalias i32* @f() {
ret i32* null
}
/* Variables and functions */
int rand();
int main(int argc, char **argv) {
  int x;
  int r = rand();
  if (r >= 0) {
    x = 42;
  } else {
    x = 7;
  }
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1146 <main+0x36>
movl   $0x2a,-0x14(%rbp)
jmp    114d <main+0x3d>
movl   $0x7,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
test   %eax,%eax
mov    $0x2a,%ecx
mov    $0x7,%eax
cmovns %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @rand()
store i32 %8, i32* %7
%9 = load i32, i32* %7
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 42, i32* %6
br label %13
12: ; preds = %2
store i32 7, i32* %6
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %6
ret i32 %14
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @rand()
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 42, i32 7
ret i32 %5
}
/* Variables and functions */
unsigned int dictGenHashFunction(unsigned char *, int /*<<< orphan*/);
int /*<<< orphan*/ sdslen(char *);
unsigned int dictSdsHash(const void *key) {
  return dictGenHashFunction((unsigned char *)key, sdslen((char *)key));
}


x86 assembly (clang, -O0):
<dictSdsHash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sdslen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1030 <dictGenHashFunction@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dictSdsHash>:
push   %rbx
mov    %rdi,%rbx
call   1040 <sdslen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <dictGenHashFunction@plt>

LLVM IR (-O0):
define i32 @dictSdsHash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sdslen(i8* %4)
%6 = call i32 @dictGenHashFunction(i8* %3, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @dictSdsHash(i8* %0) {
%2 = tail call i32 @sdslen(i8* %0)
%3 = tail call i32 @dictGenHashFunction(i8* %0, i32 %2)
ret i32 %3
}
int ft_tolower(int c) {
  if (c >= 'A' && c <= 'Z') {
    return (c + 32);
  }
  return (c);
}


x86 assembly (clang, -O0):
<ft_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1129 <ft_tolower+0x29>
cmpl   $0x5a,-0x8(%rbp)
jg     1129 <ft_tolower+0x29>
mov    -0x8(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <ft_tolower+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_tolower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @ft_tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 32
store i32 %11, i32* %2
br label %14
12: ; preds = %6, %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @ft_tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
double errcheck(int /*<<< orphan*/, char *);
int /*<<< orphan*/ exp(double);
double Exp(double x) { return errcheck(exp(x), "exp"); }


x86 assembly (clang, -O0):
<Exp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
call   1030 <errcheck@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Exp>:
push   %rax
call   1040 <exp@plt>
lea    0xed3(%rip),%rsi
mov    %eax,%edi
pop    %rax
jmp    1030 <errcheck@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"exp\00"
define double @Exp(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @exp(double %3)
%5 = call double @errcheck(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret double %5
}

LLVM IR (-O2):
@.str = [4 x i8] c"exp\00"
define double @Exp(double %0) {
%2 = tail call i32 @exp(double %0)
%3 = tail call double @errcheck(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret double %3
}
unsigned xrop3_102_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  stk1 = D ^ S;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_102_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_102_1_1>:
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
or     %edi,%esi
mov    %edi,%ecx
not    %cl
movzbl %cl,%ecx
not    %eax
and    %ecx,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_102_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
store i32 %14, i32* %6
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 8
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = or i32 %17, %19
store i32 %20, i32* %7
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = xor i32 %21, %22
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = load i32, i32* %6
%26 = xor i32 %25, -1
%27 = and i32 %24, %26
%28 = load i32, i32* %7
%29 = xor i32 %28, -1
%30 = and i32 %27, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = and i32 %31, %32
%34 = or i32 %30, %33
%35 = load i32, i32* %5
%36 = load i32, i32* %7
%37 = and i32 %35, %36
%38 = or i32 %34, %37
ret i32 %38
}

LLVM IR (-O2):
define i32 @xrop3_102_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = xor i8 %0, -1
%6 = zext i8 %5 to i32
%7 = xor i32 %4, -1
%8 = and i32 %6, %7
%9 = or i8 %1, %0
%10 = zext i8 %9 to i32
%11 = or i32 %8, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ int_to_be(long, char *);
int /*<<< orphan*/ output_char(char);
void output_be(long int num) {
  char buf[4];
  int i;
  int_to_be(num, buf);
  for (i = 0; i < 4; i++) {
    output_char(buf[i]);
  }
}


x86 assembly (clang, -O0):
<output_be>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <int_to_be@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1166 <output_be+0x46>
movslq -0x10(%rbp),%rax
movsbl -0xc(%rbp,%rax,1),%edi
call   1030 <output_char@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1140 <output_be+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_be>:
push   %rax
lea    0x4(%rsp),%rsi
call   1040 <int_to_be@plt>
movsbl 0x4(%rsp),%edi
call   1030 <output_char@plt>
movsbl 0x5(%rsp),%edi
call   1030 <output_char@plt>
movsbl 0x6(%rsp),%edi
call   1030 <output_char@plt>
movsbl 0x7(%rsp),%edi
call   1030 <output_char@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @output_be(i64 %0) {
%2 = alloca i64
%3 = alloca [4 x i8]
%4 = alloca i32
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%7 = call i32 @int_to_be(i64 %5, i8* %6)
store i32 0, i32* %4
br label %8
8: ; preds = %17, %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @output_char(i8 signext %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %8
20: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @output_be(i64 %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = call i32 @int_to_be(i64 %0, i8* %3)
%5 = load i8, i8* %3
%6 = call i32 @output_char(i8 signext %5)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%8 = load i8, i8* %7
%9 = call i32 @output_char(i8 signext %8)
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%11 = load i8, i8* %10
%12 = call i32 @output_char(i8 signext %11)
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%14 = load i8, i8* %13
%15 = call i32 @output_char(i8 signext %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
extern void *phaz_ts_routine(void *arg) {
  system((char *)arg);
  return 0;
}


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

x86 assembly (clang, -O2):
<phaz_ts_routine>:
push   %rax
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @phaz_ts_routine(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @system(i8* %3)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @phaz_ts_routine(i8* nocapture %0) {
%2 = tail call i32 @system(i8* %0)
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ IntEnable(int);
int /*<<< orphan*/ IntRegister(int, void (*)());
void LCDIntRegister(uint32_t ui32Base, void (*pfnHandler)(void)) {
  ;
  ;
  IntRegister(113, pfnHandler);
  IntEnable(113);
}


x86 assembly (clang, -O0):
<LCDIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x71,%edi
call   1040 <IntRegister@plt>
mov    $0x71,%edi
call   1030 <IntEnable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDIntRegister>:
push   %rax
mov    $0x71,%edi
call   1040 <IntRegister@plt>
mov    $0x71,%edi
pop    %rax
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @LCDIntRegister(i32 %0, void ()* %1) {
%3 = alloca i32
%4 = alloca void ()*
store i32 %0, i32* %3
store void ()* %1, void ()** %4
%5 = load void ()*, void ()** %4
%6 = bitcast void ()* %5 to void (...)*
%7 = call i32 @IntRegister(i32 113, void (...)* %6)
%8 = call i32 @IntEnable(i32 113)
ret void
}

LLVM IR (-O2):
define void @LCDIntRegister(i32 %0, void ()* %1) {
%3 = bitcast void ()* %1 to void (...)*
%4 = tail call i32 @IntRegister(i32 113, void (...)* %3)
%5 = tail call i32 @IntEnable(i32 113)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ reachELF();
int /*<<< orphan*/ uart_spin_puts(char *);
void mbr(void) {
  uart_spin_puts("Bootloader is running!\r\n");
  reachELF();
spin:
  while (1)
    ;
}


x86 assembly (clang, -O0):
<mbr>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <uart_spin_puts@plt>
mov    $0x0,%al
call   1040 <reachELF@plt>
jmp    113c <mbr+0x1c>
jmp    113c <mbr+0x1c>

x86 assembly (clang, -O2):
<mbr>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <uart_spin_puts@plt>
xor    %eax,%eax
call   1040 <reachELF@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1140 <mbr+0x20>

LLVM IR (-O0):
@.str = [25 x i8] c"Bootloader is running!\0D\0A\00"
define void @mbr() {
%1 = call i32 @uart_spin_puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @reachELF()
br label %3
3: ; preds = %0
br label %4
4: ; preds = %3, %4
br label %4
}

LLVM IR (-O2):
@.str = [25 x i8] c"Bootloader is running!\0D\0A\00"
define void @mbr() {
%1 = tail call i32 @uart_spin_puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @reachELF()
br label %3
3: ; preds = %0, %3
br label %3
}
/* Variables and functions */
scalar_t__ malloc(size_t);
long int *newLintArray(long int n) {
  long int *v;
  if (n <= 0)
    return (NULL);
  v = NULL;
  v = (long int *)malloc((size_t)n * sizeof(long int));
  return (v);
}


x86 assembly (clang, -O0):
<newLintArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jg     1134 <newLintArray+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1155 <newLintArray+0x45>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newLintArray>:
test   %rdi,%rdi
jle    1124 <newLintArray+0x14>
push   %rax
shl    $0x3,%rdi
call   1030 <malloc@plt>
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64* @newLintArray(i64 %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = icmp sle i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i64* null, i64** %2
br label %14
8: ; preds = %1
store i64* null, i64** %4
%9 = load i64, i64* %3
%10 = mul i64 %9, 8
%11 = call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to i64*
store i64* %12, i64** %4
%13 = load i64*, i64** %4
store i64* %13, i64** %2
br label %14
14: ; preds = %8, %7
%15 = load i64*, i64** %2
ret i64* %15
}

LLVM IR (-O2):
define i64* @newLintArray(i64 %0) {
%2 = icmp slt i64 %0, 1
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = shl i64 %0, 3
%5 = tail call i64 @malloc(i64 %4)
%6 = inttoptr i64 %5 to i64*
br label %7
7: ; preds = %1, %3
%8 = phi i64* [ %6, %3 ], [ null, %1 ]
ret i64* %8
}
int swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define i32 @swap(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
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
store i32 %8, i32* %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = load i32*, i32** %4
store i32 %10, i32* %11
%12 = load i32, i32* %6
%13 = load i32*, i32** %5
store i32 %12, i32* %13
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret i32 undef
}
void ima_file_free(struct file *file) { return; }


x86 assembly (clang, -O0):
<ima_file_free>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.file = type opaque
define void @ima_file_free(%struct.file* %0) {
%2 = alloca %struct.file*
store %struct.file* %0, %struct.file** %2
ret void
}

LLVM IR (-O2):
%struct.file = type opaque
define void @ima_file_free(%struct.file* nocapture %0) {
ret void
}
int do_735() { return 735; }


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

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

LLVM IR (-O0):
define i32 @do_735() {
ret i32 735
}

LLVM IR (-O2):
define i32 @do_735() {
ret i32 735
}
int getArrayFilledSize(int nodes[]) {
  int length = 0;
  while (nodes[length] != -1) {
    length++;
  }
  return length;
}


x86 assembly (clang, -O0):
<getArrayFilledSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     112f <getArrayFilledSize+0x2f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <getArrayFilledSize+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getArrayFilledSize>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpl   $0xffffffff,(%rdi)
lea    0x4(%rdi),%rdi
jne    1110 <getArrayFilledSize+0x10>
ret

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

LLVM IR (-O2):
define i32 @getArrayFilledSize(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, -1
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vuln(char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: buffer_overflow [str]\n");
    return 1;
  }
  for (int i = 0; i < 0x31337; i++)
    ;
  vuln(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1193 <main+0x73>
movl   $0x0,-0x14(%rbp)
cmpl   $0x31337,-0x14(%rbp)
jge    117f <main+0x5f>
jmp    1171 <main+0x51>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <vuln@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1133 <main+0x13>
mov    0x8(%rsi),%rdi
call   1040 <vuln@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [29 x i8] c"Usage: buffer_overflow [str]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @vuln(i8* %6)
br label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %4, %8
%11 = phi i32 [ 1, %8 ], [ 0, %4 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ isWordCharacter(char);
void readWord(char **markerp) {
  while (**markerp && isWordCharacter(**markerp))
    (*markerp)++;
}


x86 assembly (clang, -O0):
<readWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     114d <readWord+0x3d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isWordCharacter@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115d <readWord+0x4d>
jmp    1170 <readWord+0x60>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    111c <readWord+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readWord>:
push   %rbx
mov    (%rdi),%rax
mov    (%rax),%al
test   %al,%al
je     113f <readWord+0x2f>
mov    %rdi,%rbx
nopl   (%rax)
movsbl %al,%edi
call   1030 <isWordCharacter@plt>
test   %rax,%rax
je     113f <readWord+0x2f>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movzbl 0x1(%rax),%eax
test   %al,%al
jne    1120 <readWord+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @readWord(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %9
%6 = phi i8 [ %12, %9 ], [ %3, %1 ]
%7 = tail call i64 @isWordCharacter(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = load i8*, i8** %0
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %0
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %9, %1
ret void
}
double deg_to_rad(int deg) {
  switch (deg) {
  case 0:
    return 0;
  case 90:
    return 3.1415 / 2;
  case 180:
    return 3.1415;
  default:
    return deg * 3.1415 / 180;
  }
}


x86 assembly (clang, -O0):
<deg_to_rad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     113e <deg_to_rad+0x3e>
jmp    111a <deg_to_rad+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x5a,%eax
je     114b <deg_to_rad+0x4b>
jmp    112b <deg_to_rad+0x2b>
mov    -0x10(%rbp),%eax
sub    $0xb4,%eax
je     115d <deg_to_rad+0x5d>
jmp    116f <deg_to_rad+0x6f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1191 <deg_to_rad+0x91>
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1191 <deg_to_rad+0x91>
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1191 <deg_to_rad+0x91>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg_to_rad>:
test   %edi,%edi
je     111a <deg_to_rad+0x1a>
cmp    $0xb4,%edi
je     111e <deg_to_rad+0x1e>
cmp    $0x5a,%edi
jne    1127 <deg_to_rad+0x27>
movsd  0xeef(%rip),%xmm0
ret
xorps  %xmm0,%xmm0
ret
movsd  0xeda(%rip),%xmm0
ret
cvtsi2sd %edi,%xmm0
mulsd  0xecd(%rip),%xmm0
divsd  0xed5(%rip),%xmm0
ret

LLVM IR (-O0):
define double @deg_to_rad(i32 %0) {
%2 = alloca double
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 0, label %5
i32 90, label %6
i32 180, label %7
]
5: ; preds = %1
store double 0.000000e+00, double* %2
br label %13
6: ; preds = %1
store double 1.570750e+00, double* %2
br label %13
7: ; preds = %1
store double 3.141500e+00, double* %2
br label %13
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = fmul double %10, 3.141500e+00
%12 = fdiv double %11, 1.800000e+02
store double %12, double* %2
br label %13
13: ; preds = %8, %7, %6, %5
%14 = load double, double* %2
ret double %14
}

LLVM IR (-O2):
define double @deg_to_rad(i32 %0) {
switch i32 %0, label %4 [
i32 0, label %8
i32 90, label %2
i32 180, label %3
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
%5 = sitofp i32 %0 to double
%6 = fmul double %5, 3.141500e+00
%7 = fdiv double %6, 1.800000e+02
br label %8
8: ; preds = %1, %4, %3, %2
%9 = phi double [ %7, %4 ], [ 3.141500e+00, %3 ], [ 1.570750e+00, %2 ], [ 0.000000e+00, %1 ]
ret double %9
}
int os2_netopen(char *name, int *lcl, int nett) { return (-1); }


x86 assembly (clang, -O0):
<os2_netopen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @os2_netopen(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
ret i32 -1
}

LLVM IR (-O2):
define i32 @os2_netopen(i8* nocapture readnone %0, i32* nocapture readnone %1, i32 %2) {
ret i32 -1
}
/* Variables and functions */
scalar_t__ strncmp(char *, char *, int);
int endEMBL(char *s, int *addend) {
  *addend = 0;
  return (strncmp(s, "     ", 5) != 0);
}


x86 assembly (clang, -O0):
<endEMBL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xecb(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endEMBL>:
push   %rax
movl   $0x0,(%rsi)
lea    0xee2(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c" \00"
define i32 @endEMBL(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@.str = [6 x i8] c" \00"
define i32 @endEMBL(i8* %0, i32* nocapture writeonly %1) {
store i32 0, i32* %1
%3 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void __attribute__((weak)) tim6_dac_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<tim6_dac_isr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <debug_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tim6_dac_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

LLVM IR (-O0):
@__FUNCTION__.tim6_dac_isr = [13 x i8] c"tim6_dac_isr\00"
define weak void @tim6_dac_isr() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.tim6_dac_isr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__FUNCTION__.tim6_dac_isr = [13 x i8] c"tim6_dac_isr\00"
define weak void @tim6_dac_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.tim6_dac_isr, i64 0, i64 0))
ret void
}
void ff_hevc_put_hevc_bi_w_epel_hv8_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_hv8_8_sse4() {
ret void
}
/* Variables and functions */
void *memHeapAlloc(void **, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *memHeapAllocZ(void **ppvMemHeap, int nbytes) {
  void *ptr = memHeapAlloc(ppvMemHeap, nbytes);
  if (0 != ptr)
    memset(ptr, 0, nbytes);
  return ptr;
}


x86 assembly (clang, -O0):
<memHeapAllocZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <memHeapAlloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1159 <memHeapAllocZ+0x39>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memHeapAllocZ>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <memHeapAlloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113e <memHeapAllocZ+0x1e>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @memHeapAllocZ(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
%7 = load i32, i32* %4
%8 = call i8* @memHeapAlloc(i8** %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* null, %9
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i32, i32* %4
%14 = call i32 @memset(i8* %12, i32 0, i32 %13)
br label %15
15: ; preds = %11, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @memHeapAllocZ(i8** %0, i32 %1) {
%3 = tail call i8* @memHeapAlloc(i8** %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memset(i8* %3, i32 0, i32 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
float __rmod(float, float);
float sinf(float);
float __rsind(float x) {
  float circle = 360.0F;
  return sinf(.017453292519943295F * __rmod(x, circle));
}


x86 assembly (clang, -O0):
<__rsind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xecf(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <__rmod@plt>
movaps %xmm0,%xmm1
movss  0xeac(%rip),%xmm0
mulss  %xmm1,%xmm0
call   1030 <sinf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rsind>:
push   %rax
movss  0xed7(%rip),%xmm1
call   1040 <__rmod@plt>
mulss  0xece(%rip),%xmm0
pop    %rax
jmp    1030 <sinf@plt>

LLVM IR (-O0):
define float @__rsind(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 3.600000e+02, float* %3
%4 = load float, float* %2
%5 = load float, float* %3
%6 = call float @__rmod(float %4, float %5)
%7 = fmul float 0x3F91DF46A0000000, %6
%8 = call float @sinf(float %7)
ret float %8
}

LLVM IR (-O2):
define float @__rsind(float %0) {
%2 = tail call float @__rmod(float %0, float 3.600000e+02)
%3 = fmul float %2, 0x3F91DF46A0000000
%4 = tail call float @sinf(float %3)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *echo(int argc, char **argv, void *data) {
  printf("tokens:%i\n", argc);
  while (*argv)
    printf("[%s]\n", *(argv++));
  return 0;
}


x86 assembly (clang, -O0):
<echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1165 <echo+0x55>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <echo+0x22>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<echo>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1154 <echo+0x44>
add    $0x8,%rbx
lea    0xed3(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1140 <echo+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"tokens:%i\0A\00"
@.str.1 = [6 x i8] c"[%s]\0A\00"
define i8* @echo(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %13, %3
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i32 1
store i8** %15, i8*** %5
%16 = load i8*, i8** %14
%17 = ptrtoint i8* %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %9
19: ; preds = %9
ret i8* null
}

LLVM IR (-O2):
@.str = [11 x i8] c"tokens:%i\0A\00"
@.str.1 = [6 x i8] c"[%s]\0A\00"
define noalias i8* @echo(i32 %0, i8** nocapture %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %16, label %7
7: ; preds = %3, %7
%8 = phi i8* [ %14, %7 ], [ %5, %3 ]
%9 = phi i8** [ %10, %7 ], [ %1, %3 ]
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = ptrtoint i8* %8 to i64
%12 = trunc i64 %11 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i8*, i8** %10
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %7
16: ; preds = %7, %3
ret i8* null
}
void blk_mq_debugfs_unregister_sched(struct request_queue *q) {}


x86 assembly (clang, -O0):
<blk_mq_debugfs_unregister_sched>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.request_queue = type opaque
define void @blk_mq_debugfs_unregister_sched(%struct.request_queue* %0) {
%2 = alloca %struct.request_queue*
store %struct.request_queue* %0, %struct.request_queue** %2
ret void
}

LLVM IR (-O2):
%struct.request_queue = type opaque
define void @blk_mq_debugfs_unregister_sched(%struct.request_queue* nocapture %0) {
ret void
}
void ff_hevc_put_hevc_bi_pel_pixels6_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_pel_pixels6_10_sse4() {
ret void
}
/* Variables and functions */
int strlen(char *);
void removeNewLine(char *input) {
  int len = strlen(input);
  input[len - 1] = '\0';
}


x86 assembly (clang, -O0):
<removeNewLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeNewLine>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
pop    %rbx
ret

LLVM IR (-O0):
define void @removeNewLine(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
store i8 0, i8* %10
ret void
}

LLVM IR (-O2):
define void @removeNewLine(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 0, i8* %5
ret void
}
/* Type definitions */
struct encoder_packet {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ obs_encoder_packet_release(struct encoder_packet *);
void obs_free_encoder_packet(struct encoder_packet *packet) {
  obs_encoder_packet_release(packet);
}


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

x86 assembly (clang, -O2):
<obs_free_encoder_packet>:
jmp    1030 <obs_encoder_packet_release@plt>

LLVM IR (-O0):
%struct.encoder_packet = type { i32 }
define void @obs_free_encoder_packet(%struct.encoder_packet* %0) {
%2 = alloca %struct.encoder_packet*
store %struct.encoder_packet* %0, %struct.encoder_packet** %2
%3 = load %struct.encoder_packet*, %struct.encoder_packet** %2
%4 = call i32 @obs_encoder_packet_release(%struct.encoder_packet* %3)
ret void
}

LLVM IR (-O2):
%struct.encoder_packet = type { i32 }
define void @obs_free_encoder_packet(%struct.encoder_packet* %0) {
%2 = tail call i32 @obs_encoder_packet_release(%struct.encoder_packet* %0)
ret void
}
/* Type definitions */
struct matrix {
  int dummy;
};

/* Variables and functions */
struct matrix *get_matrix(int);
int /*<<< orphan*/ matrix_info(int, struct matrix *);
void handle_list() {
  for (int i = 0; i < 512; i++) {
    struct matrix *m = get_matrix(i);
    if (m == NULL)
      continue;
    matrix_info(i, m);
  }
}


x86 assembly (clang, -O0):
<handle_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
jge    1172 <handle_list+0x52>
mov    -0x4(%rbp),%edi
call   1030 <get_matrix@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1158 <handle_list+0x38>
jmp    1164 <handle_list+0x44>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <matrix_info@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <handle_list+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_list>:
push   %rbx
xor    %ebx,%ebx
jmp    113b <handle_list+0x1b>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
cmp    $0x200,%ebx
je     1153 <handle_list+0x33>
mov    %ebx,%edi
call   1030 <get_matrix@plt>
test   %rax,%rax
je     1130 <handle_list+0x10>
mov    %ebx,%edi
mov    %rax,%rsi
call   1040 <matrix_info@plt>
jmp    1130 <handle_list+0x10>
pop    %rbx
ret

LLVM IR (-O0):
%struct.matrix = type { i32 }
define void @handle_list() {
%1 = alloca i32
%2 = alloca %struct.matrix*
store i32 0, i32* %1
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 512
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call %struct.matrix* @get_matrix(i32 %7)
store %struct.matrix* %8, %struct.matrix** %2
%9 = load %struct.matrix*, %struct.matrix** %2
%10 = icmp eq %struct.matrix* %9, null
br i1 %10, label %11, label %12
11: ; preds = %6
br label %16
12: ; preds = %6
%13 = load i32, i32* %1
%14 = load %struct.matrix*, %struct.matrix** %2
%15 = call i32 @matrix_info(i32 %13, %struct.matrix* %14)
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %3
19: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.matrix = type { i32 }
define void @handle_list() {
br label %2
1: ; preds = %8
ret void
2: ; preds = %0, %8
%3 = phi i32 [ 0, %0 ], [ %9, %8 ]
%4 = tail call %struct.matrix* @get_matrix(i32 %3)
%5 = icmp eq %struct.matrix* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @matrix_info(i32 %3, %struct.matrix* %4)
br label %8
8: ; preds = %2, %6
%9 = add nuw nsw i32 %3, 1
%10 = icmp eq i32 %9, 512
br i1 %10, label %1, label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void f(int n) {
  printf("%d\n", n);
  int i = n / (1000 - n);
  f(n + 1);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
jmp    1120 <f+0x10>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @f(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %5, %2 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add nsw i32 %3, 1
br label %2
}
void XtAppGetSelectionTimeout() {}


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

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

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

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