xunge/DecIR huggingface dataset:
double perimeter(double side1, double side2) { return 2 * (side1 + side2); }


x86 assembly (clang, -O0):
<perimeter>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xee0(%rip),%xmm0
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<perimeter>:
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @perimeter(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 = load double, double* %4
%7 = fadd double %5, %6
%8 = fmul double 2.000000e+00, %7
ret double %8
}

LLVM IR (-O2):
define double @perimeter(double %0, double %1) {
%3 = fadd double %0, %1
%4 = fmul double %3, 2.000000e+00
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main() {
  int *p;
  unsigned int n;
  p = malloc(sizeof(int) * 2);
  free(p);
  free(p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @malloc(i32 8)
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32 @free(i32* %4)
%6 = load i32*, i32** %1
%7 = call i32 @free(i32* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 8)
%2 = tail call i32 @free(i32* %1)
%3 = tail call i32 @free(i32* %1)
ret i32 0
}
main() {
  struct {
    int : 2;
  } a;
  struct {
    int f1 : 3;
    int : 2;
    int f2 : 1;
    int : 0;
    int f3 : 5;
    int f4 : 7;
    unsigned int f5 : 7;
  } b;
}


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

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

LLVM IR (-O0):
%struct.anon = type { i8 }
%struct.anon.0 = type { i8, i24 }
define i32 @main() {
%1 = alloca %struct.anon
%2 = alloca %struct.anon.0
ret i32 0
}

LLVM IR (-O2):
%struct.anon.0 = type { i8, i24 }
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void tostr(int *m, char *outstr) { sprintf(outstr, "0x%08X", *m); }


x86 assembly (clang, -O0):
<tostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xecf(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tostr>:
mov    %rsi,%rax
mov    (%rdi),%edx
lea    0xee4(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"0x%08X\00"
define void @tostr(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void read_set_io(char *args) { printf("read set io\n%s\n", args); }


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

x86 assembly (clang, -O2):
<read_set_io>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"read set io\0A%s\0A\00"
define void @read_set_io(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"read set io\0A%s\0A\00"
define void @read_set_io(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void LOG(char *s, ...) {}


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

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

LLVM IR (-O0):
define void @LOG(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @LOG(i8* nocapture %0, ...) {
ret void
}
void st_relayfs_write(unsigned int id, unsigned int source, unsigned char *buf,
                      unsigned int len, void *info) {}


x86 assembly (clang, -O0):
<st_relayfs_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @st_relayfs_write(i32 %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
define void @st_relayfs_write(i32 %0, i32 %1, i8* nocapture %2, i32 %3, i8* nocapture %4) {
ret void
}
int add(int a, int b) {
  int sum = a + b;
  return sum;
}


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

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
int fun1212() { return 1212; }


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

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

LLVM IR (-O0):
define i32 @fun1212() {
ret i32 1212
}

LLVM IR (-O2):
define i32 @fun1212() {
ret i32 1212
}
void gdk_pixmap_colormap_create_from_xpm() {}


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

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

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

LLVM IR (-O2):
define void @gdk_pixmap_colormap_create_from_xpm() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int random_range(int, int);
int random_range_step(int floor, int ceil, int step) {
  assert(step > 0);
  return random_range((int)(floor / step), (int)(ceil / step)) * step;
}


x86 assembly (clang, -O0):
<random_range_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%esi
call   1040 <random_range@plt>
imul   -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_range_step>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %edi,%edi
test   %edx,%edx
setg   %dil
call   1030 <assert@plt>
mov    %ebp,%eax
cltd
idiv   %ebx
mov    %eax,%edi
mov    %r14d,%eax
cltd
idiv   %ebx
mov    %eax,%esi
call   1040 <random_range@plt>
imul   %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_range_step(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 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = sdiv i32 %11, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = sdiv i32 %14, %15
%17 = call i32 @random_range(i32 %13, i32 %16)
%18 = load i32, i32* %6
%19 = mul nsw i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @random_range_step(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = sdiv i32 %0, %2
%8 = sdiv i32 %1, %2
%9 = tail call i32 @random_range(i32 %7, i32 %8)
%10 = mul nsw i32 %9, %2
ret i32 %10
}
void test_align() {}


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

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

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

LLVM IR (-O2):
define void @test_align() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ parser(char *);
int main(int argc, char **argv) {
  init();
  parser("test.txt");
  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)
mov    $0x0,%al
call   1040 <init@plt>
lea    0xebc(%rip),%rdi
call   1030 <parser@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init@plt>
lea    0xed1(%rip),%rdi
call   1030 <parser@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"test.txt\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 (...) @init()
%7 = call i32 @parser(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init()
%4 = tail call i32 @parser(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void foo802(int p) {}


x86 assembly (clang, -O0):
<foo802>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo802(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @foo802(i32 %0) {
ret void
}
/* Type definitions */
struct term {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct term *);
void dealloc_term(struct term *term) { free(term); }


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

x86 assembly (clang, -O2):
<dealloc_term>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.term = type { i32 }
define void @dealloc_term(%struct.term* nocapture %0) {
%2 = tail call i32 @free(%struct.term* %0)
ret void
}
void check_logfs_disk_super(void) { ; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ htole16(int /*<<< orphan*/);
void st_i16_le(void *x, int16_t i) { ((int16_t *)x)[0] = htole16(i); }


x86 assembly (clang, -O0):
<st_i16_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <htole16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_i16_le>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htole16@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @st_i16_le(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
%6 = call i32 @htole16(i32 %5)
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %6, i32* %9
ret void
}

LLVM IR (-O2):
define void @st_i16_le(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @htole16(i32 %1)
%4 = bitcast i8* %0 to i32*
store i32 %3, i32* %4
ret void
}
/* Variables and functions */
scalar_t__ DWC_IN_IRQ();
char *dwc_irq(void) { return DWC_IN_IRQ() ? "IRQ" : ""; }


x86 assembly (clang, -O0):
<dwc_irq>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <DWC_IN_IRQ@plt>
mov    %rax,%rdx
lea    0xede(%rip),%rax
lea    0xed4(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dwc_irq>:
push   %rax
xor    %eax,%eax
call   1030 <DWC_IN_IRQ@plt>
test   %rax,%rax
lea    0xee1(%rip),%rcx
lea    0xed7(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"IRQ\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @dwc_irq() {
%1 = call i64 (...) @DWC_IN_IRQ()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
ret i8* %4
}

LLVM IR (-O2):
@.str = [4 x i8] c"IRQ\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @dwc_irq() {
%1 = tail call i64 (...) @DWC_IN_IRQ()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
double pow2i(int);
__attribute__((always_)) const double ldexp2k(double d, int e) {
  return d * pow2i(e >> 1) * pow2i(e - (e >> 1));
}


x86 assembly (clang, -O0):
<ldexp2k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
sar    $0x1,%edi
call   1030 <pow2i@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
sub    %eax,%edi
call   1030 <pow2i@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexp2k>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
movsd  %xmm0,(%rsp)
mov    %edi,%ebp
sar    %ebp
mov    %ebp,%edi
call   1030 <pow2i@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
sub    %ebp,%ebx
mov    %ebx,%edi
call   1030 <pow2i@plt>
mulsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @ldexp2k(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 1
%8 = call double @pow2i(i32 %7)
%9 = fmul double %5, %8
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = ashr i32 %11, 1
%13 = sub nsw i32 %10, %12
%14 = call double @pow2i(i32 %13)
%15 = fmul double %9, %14
ret double %15
}

LLVM IR (-O2):
define double @ldexp2k(double %0, i32 %1) {
%3 = ashr i32 %1, 1
%4 = tail call double @pow2i(i32 %3)
%5 = fmul double %4, %0
%6 = sub nsw i32 %1, %3
%7 = tail call double @pow2i(i32 %6)
%8 = fmul double %5, %7
ret double %8
}
/* Variables and functions */
char *util_file_search(char const *, char *, char *);
char *util_path_search(char const *prog) {
  return util_file_search(prog, ((char *)0), (char *)"x");
}


x86 assembly (clang, -O0):
<util_path_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
lea    0xed5(%rip),%rdx
call   1030 <util_file_search@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_path_search>:
lea    0xee9(%rip),%rdx
xor    %esi,%esi
jmp    1030 <util_file_search@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"x\00"
define i8* @util_path_search(i8* %0) {
%2 = tail call i8* @util_file_search(i8* %0, i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void *_realloc(void *ptr, size_t size, size_t previous_size) {
  void *res;
  res = (void *)malloc(size);
  if (size < previous_size)
    (void)memcpy(res, ptr, size);
  else
    (void)memcpy(res, ptr, previous_size);
  free(ptr);
  return res;
}


x86 assembly (clang, -O0):
<_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1175 <_realloc+0x45>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
jmp    1186 <_realloc+0x56>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_realloc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <malloc@plt>
mov    %rax,%r12
cmp    %rbx,%r14
cmovb  %r14,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @_realloc(i8* %0, i64 %1, i64 %2) {
%4 = tail call i64 @malloc(i64 %1)
%5 = inttoptr i64 %4 to i8*
%6 = icmp ult i64 %1, %2
%7 = select i1 %6, i64 %1, i64 %2
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %7)
%9 = tail call i32 @free(i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(size_t);
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
void *xmalloc(size_t size) {
  void *t = malloc(size);
  if (t == NULL) {
    perror(NULL);
    exit(8);
  }
  return t;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <xmalloc+0x37>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <perror@plt>
mov    $0x8,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <xmalloc+0xd>
pop    %rcx
ret
xor    %edi,%edi
call   1040 <perror@plt>
mov    $0x8,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i32* null)
%10 = call i32 @exit(i32 8)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i32* null)
%6 = tail call i32 @exit(i32 8)
unreachable
7: ; preds = %1
ret i8* %2
}
int map2check_non_det_int() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @map2check_non_det_int() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void input_ext() { printf("input_ext\n"); }


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"input_ext\00"
define void @input_ext() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int unqliteCoreInitialize();
int unqlite_lib_init(void) {
  int rc;
  rc = unqliteCoreInitialize();
  return rc;
}


x86 assembly (clang, -O0):
<unqlite_lib_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <unqliteCoreInitialize@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @unqlite_lib_init() {
%1 = alloca i32
%2 = call i32 (...) @unqliteCoreInitialize()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @unqlite_lib_init() {
%1 = tail call i32 (...) @unqliteCoreInitialize()
ret i32 %1
}
/* Type definitions */
struct stat {
  scalar_t__ st_atime;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
scalar_t__ time(int /*<<< orphan*/ *);
int idletime(const char *tty) {
  struct stat sbuf;
  if (stat(tty, &sbuf) != 0)
    return 0;
  return (int)(time(NULL) - sbuf.st_atime);
}


x86 assembly (clang, -O0):
<idletime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     114f <idletime+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    115f <idletime+0x3f>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
sub    -0x18(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idletime>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <idletime+0x15>
pop    %rcx
ret
xor    %edi,%edi
call   1040 <time@plt>
sub    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @idletime(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %15
9: ; preds = %1
%10 = call i64 @time(i32* null)
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%12 = load i64, i64* %11
%13 = sub nsw i64 %10, %12
%14 = trunc i64 %13 to i32
store i32 %14, i32* %2
br label %15
15: ; preds = %9, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @idletime(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = call i64 @time(i32* null)
%8 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sub nsw i64 %7, %9
%11 = trunc i64 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ 0, %1 ]
ret i32 %13
}
void cpuidle_disable_device(struct cpuidle_device *dev) {}


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

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

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

LLVM IR (-O2):
%struct.cpuidle_device = type opaque
define void @cpuidle_disable_device(%struct.cpuidle_device* nocapture %0) {
ret void
}
/* Variables and functions */
int apples_get();
int /*<<< orphan*/ apples_set(int);
int oranges_get();
int /*<<< orphan*/ oranges_set(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  apples_set(5);
  oranges_set(10);
  printf("apples=%d oranges=%d\n", apples_get(), oranges_get());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1070 <apples_set@plt>
mov    $0xa,%edi
call   1060 <oranges_set@plt>
mov    $0x0,%al
call   1050 <apples_get@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <oranges_get@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
call   1070 <apples_set@plt>
mov    $0xa,%edi
call   1060 <oranges_set@plt>
xor    %eax,%eax
call   1050 <apples_get@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <oranges_get@plt>
lea    0xe84(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"apples=%d oranges=%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @apples_set(i32 5)
%3 = call i32 @oranges_set(i32 10)
%4 = call i32 (...) @apples_get()
%5 = call i32 (...) @oranges_get()
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"apples=%d oranges=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @apples_set(i32 5)
%2 = tail call i32 @oranges_set(i32 10)
%3 = tail call i32 (...) @apples_get()
%4 = tail call i32 (...) @oranges_get()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
int /*<<< orphan*/ puts(char *);
main() {
  bar(0);
  bar(1);
  bar(-1);
  bar(10);
  bar(-10);
  bar(11);
  bar(-11);
  bar(0x7fffffff);
  bar(-0x7fffffff);
  puts("");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <bar@plt>
mov    $0x1,%edi
call   1040 <bar@plt>
mov    $0xffffffff,%edi
call   1040 <bar@plt>
mov    $0xa,%edi
call   1040 <bar@plt>
mov    $0xfffffff6,%edi
call   1040 <bar@plt>
mov    $0xb,%edi
call   1040 <bar@plt>
mov    $0xfffffff5,%edi
call   1040 <bar@plt>
mov    $0x7fffffff,%edi
call   1040 <bar@plt>
mov    $0x80000001,%edi
call   1040 <bar@plt>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <bar@plt>
mov    $0x1,%edi
call   1040 <bar@plt>
mov    $0xffffffff,%edi
call   1040 <bar@plt>
mov    $0xa,%edi
call   1040 <bar@plt>
mov    $0xfffffff6,%edi
call   1040 <bar@plt>
mov    $0xb,%edi
call   1040 <bar@plt>
mov    $0xfffffff5,%edi
call   1040 <bar@plt>
mov    $0x7fffffff,%edi
call   1040 <bar@plt>
mov    $0x80000001,%edi
call   1040 <bar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = call i32 @bar(i32 0)
%2 = call i32 @bar(i32 1)
%3 = call i32 @bar(i32 -1)
%4 = call i32 @bar(i32 10)
%5 = call i32 @bar(i32 -10)
%6 = call i32 @bar(i32 11)
%7 = call i32 @bar(i32 -11)
%8 = call i32 @bar(i32 2147483647)
%9 = call i32 @bar(i32 -2147483647)
%10 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @bar(i32 0)
%2 = tail call i32 @bar(i32 1)
%3 = tail call i32 @bar(i32 -1)
%4 = tail call i32 @bar(i32 10)
%5 = tail call i32 @bar(i32 -10)
%6 = tail call i32 @bar(i32 11)
%7 = tail call i32 @bar(i32 -11)
%8 = tail call i32 @bar(i32 2147483647)
%9 = tail call i32 @bar(i32 -2147483647)
%10 = tail call i32 @putchar(i32 10)
ret i32 0
}
char sat_polarisation(struct transponder *t) { return 'h'; }


x86 assembly (clang, -O0):
<sat_polarisation>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x68,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sat_polarisation>:
mov    $0x68,%al
ret

LLVM IR (-O0):
%struct.transponder = type opaque
define signext i8 @sat_polarisation(%struct.transponder* %0) {
%2 = alloca %struct.transponder*
store %struct.transponder* %0, %struct.transponder** %2
ret i8 104
}

LLVM IR (-O2):
%struct.transponder = type opaque
define signext i8 @sat_polarisation(%struct.transponder* nocapture readnone %0) {
ret i8 104
}
int firstone(char *s, int c, int n) {
  char *s2 = s + n;
  int i = 0;
  while (s != s2) {
    if (*s == c)
      return (i);
    i++;
    s++;
  }
  return (-1);
}


x86 assembly (clang, -O0):
<firstone>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1167 <firstone+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    114d <firstone+0x4d>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <firstone+0x6e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <firstone+0x24>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<firstone>:
mov    $0xffffffff,%eax
test   %edx,%edx
je     1121 <firstone+0x21>
movslq %edx,%r8
xor    %ecx,%ecx
xchg   %ax,%ax
movsbl (%rdi,%rcx,1),%edx
cmp    %esi,%edx
je     1122 <firstone+0x22>
add    $0x1,%rcx
cmp    %rcx,%r8
jne    1110 <firstone+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @firstone(i8* %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = icmp eq i32 %2, 0
br i1 %6, label %17, label %7
7: ; preds = %3, %13
%8 = phi i32 [ %14, %13 ], [ 0, %3 ]
%9 = phi i8* [ %15, %13 ], [ %0, %3 ]
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, %1
br i1 %12, label %17, label %13
13: ; preds = %7
%14 = add nuw nsw i32 %8, 1
%15 = getelementptr inbounds i8, i8* %9, i64 1
%16 = icmp eq i8* %15, %5
br i1 %16, label %17, label %7
17: ; preds = %7, %13, %3
%18 = phi i32 [ -1, %3 ], [ -1, %13 ], [ %8, %7 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void putstr(const char *str) {
  char p;
  for (p = *str; p != 0; ++str, p = *str)
    putchar(p);
}


x86 assembly (clang, -O0):
<putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
je     1155 <putstr+0x45>
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
jmp    1125 <putstr+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @putchar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int binFromRangeExtended(int, int);
int binFromRangeStandard(int, int);
int binFromRange(int start, int end) {
  if (end <= (512 * 1024 * 1024))
    return binFromRangeStandard(start, end);
  else
    return binFromRangeExtended(start, end);
}


x86 assembly (clang, -O0):
<binFromRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x20000000,-0xc(%rbp)
jg     114e <binFromRange+0x2e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <binFromRangeStandard@plt>
mov    %eax,-0x4(%rbp)
jmp    115c <binFromRange+0x3c>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <binFromRangeExtended@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binFromRange>:
cmp    $0x20000000,%esi
jg     112d <binFromRange+0xd>
jmp    1030 <binFromRangeStandard@plt>
jmp    1040 <binFromRangeExtended@plt>

LLVM IR (-O0):
define i32 @binFromRange(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sle i32 %6, 536870912
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @binFromRangeStandard(i32 %9, i32 %10)
store i32 %11, i32* %3
br label %16
12: ; preds = %2
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @binFromRangeExtended(i32 %13, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @binFromRange(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 536870913
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @binFromRangeStandard(i32 %0, i32 %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @binFromRangeExtended(i32 %0, i32 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int printchar(char ch, int times) {
  int i;
  for (i = 0; i < times; i++) {
    printf("%c", ch);
  }
  return 0;
}


x86 assembly (clang, -O0):
<printchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1152 <printchar+0x42>
lea    0xec5(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <printchar+0x18>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printchar>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    113f <printchar+0x2f>
mov    %esi,%ebx
movsbl %dil,%ebp
lea    0xedb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1130 <printchar+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @printchar(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i8, i8* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @printchar(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret i32 0
}
int icp(char opr) {
  if (opr == '^')
    return 3;
  if (opr == '*' || opr == '/')
    return 2;
  if (opr == '+' || opr == '-')
    return 1;
  if (opr == '(')
    return 4;
}


x86 assembly (clang, -O0):
<icp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x5e,%eax
jne    1123 <icp+0x23>
movl   $0x3,-0x4(%rbp)
jmp    1183 <icp+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     113d <icp+0x3d>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    1149 <icp+0x49>
movl   $0x2,-0x4(%rbp)
jmp    1183 <icp+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     1163 <icp+0x63>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    116f <icp+0x6f>
movl   $0x1,-0x4(%rbp)
jmp    1183 <icp+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x28,%eax
jne    1183 <icp+0x83>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<icp>:
cmp    $0x2e,%dil
jg     1114 <icp+0x14>
cmp    $0x28,%dil
je     1132 <icp+0x32>
cmp    $0x2a,%dil
je     1126 <icp+0x26>
jmp    112c <icp+0x2c>
cmp    $0x2f,%dil
je     1126 <icp+0x26>
mov    $0x3,%eax
cmp    $0x5e,%dil
jne    112c <icp+0x2c>
ret
mov    $0x2,%eax
ret
mov    $0x1,%eax
ret
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @icp(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 94
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 3, i32* %2
br label %31
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 42
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 47
br i1 %15, label %16, label %17
16: ; preds = %12, %8
store i32 2, i32* %2
br label %31
17: ; preds = %12
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 43
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 45
br i1 %24, label %25, label %26
25: ; preds = %21, %17
store i32 1, i32* %2
br label %31
26: ; preds = %21
%27 = load i8, i8* %3
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 40
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 4, i32* %2
br label %31
31: ; preds = %7, %16, %25, %30, %26
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @icp(i8 signext %0) {
switch i8 %0, label %4 [
i8 94, label %5
i8 47, label %3
i8 42, label %3
i8 40, label %2
]
2: ; preds = %1
br label %5
3: ; preds = %1, %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3, %2
%6 = phi i32 [ 4, %2 ], [ 3, %1 ], [ 2, %3 ], [ 1, %4 ]
ret i32 %6
}
/* Variables and functions */
char *getlogin();
char *strcpy(char *, char *);
char *cuserid(char *s) {
  char *name = getlogin();
  if (s)
    return strcpy(s, name ? name : "");
  return name;
}


x86 assembly (clang, -O0):
<cuserid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getlogin@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1188 <cuserid+0x68>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1162 <cuserid+0x42>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1172 <cuserid+0x52>
lea    0xe97(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1172 <cuserid+0x52>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x8(%rbp)
jmp    1190 <cuserid+0x70>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cuserid>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <getlogin@plt>
test   %rbx,%rbx
je     1148 <cuserid+0x28>
test   %rax,%rax
lea    0xec6(%rip),%rsi
cmovne %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
jmp    114b <cuserid+0x2b>
mov    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @cuserid(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = call i8* (...) @getlogin()
store i8* %5, i8** %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %18
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = load i8*, i8** %4
br label %15
14: ; preds = %8
br label %15
15: ; preds = %14, %12
%16 = phi i8* [ %13, %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %14 ]
%17 = call i8* @strcpy(i8* %9, i8* %16)
store i8* %17, i8** %2
br label %20
18: ; preds = %1
%19 = load i8*, i8** %4
store i8* %19, i8** %2
br label %20
20: ; preds = %18, %15
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @cuserid(i8* %0) {
%2 = tail call i8* (...) @getlogin()
%3 = icmp eq i8* %0, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = icmp eq i8* %2, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
%7 = tail call i8* @strcpy(i8* %0, i8* dereferenceable(1) %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %0, %4 ], [ %2, %1 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void PrintMinMaxArity(FILE *Stream, double Arity) {
  if (Arity == -1) {
    fprintf(Stream, "-");
  } else {
    fprintf(Stream, "%.0f", Arity);
  }
}


x86 assembly (clang, -O0):
<PrintMinMaxArity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1155 <PrintMinMaxArity+0x45>
jp     1155 <PrintMinMaxArity+0x45>
mov    -0x8(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    116c <PrintMinMaxArity+0x5c>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xea5(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintMinMaxArity>:
mov    %rdi,%rax
ucomisd 0xed5(%rip),%xmm0
jne    113c <PrintMinMaxArity+0x1c>
jp     113c <PrintMinMaxArity+0x1c>
mov    $0x2d,%edi
mov    %rax,%rsi
jmp    1030 <fputc@plt>
lea    0xec5(%rip),%rsi
mov    %rax,%rdi
mov    $0x1,%al
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [5 x i8] c"%.0f\00"
define void @PrintMinMaxArity(i32* %0, double %1) {
%3 = alloca i32*
%4 = alloca double
store i32* %0, i32** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp oeq double %5, -1.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = load double, double* %4
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %12)
br label %14
14: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%.0f\00"
define void @PrintMinMaxArity(i32* nocapture %0, double %1) {
%3 = fcmp oeq double %1, -1.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @fputc(i32 45, i32* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %1)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ veripac9_writeMemory(int, int);
void veripac9_step() {
  veripac9_writeMemory(0xCA, 1);
  veripac9_writeMemory(0xCA, 0);
}


x86 assembly (clang, -O0):
<veripac9_step>:
push   %rbp
mov    %rsp,%rbp
mov    $0xca,%edi
mov    $0x1,%esi
call   1030 <veripac9_writeMemory@plt>
mov    $0xca,%edi
xor    %esi,%esi
call   1030 <veripac9_writeMemory@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<veripac9_step>:
push   %rax
mov    $0xca,%edi
mov    $0x1,%esi
call   1030 <veripac9_writeMemory@plt>
mov    $0xca,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <veripac9_writeMemory@plt>

LLVM IR (-O0):
define void @veripac9_step() {
%1 = call i32 @veripac9_writeMemory(i32 202, i32 1)
%2 = call i32 @veripac9_writeMemory(i32 202, i32 0)
ret void
}

LLVM IR (-O2):
define void @veripac9_step() {
%1 = tail call i32 @veripac9_writeMemory(i32 202, i32 1)
%2 = tail call i32 @veripac9_writeMemory(i32 202, i32 0)
ret void
}