xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ add(double *, double *, double *, int);
int /*<<< orphan*/ mult(double *, double *, int, int);
void avg3(double y[], double x1[], double x2[], double x3[], int n) {
  add(y, x1, x2, n);
  add(y, y, x3, n);
  mult(y, y, 1 / 3.0, n);
}


x86 assembly (clang, -O0):
<avg3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <add@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <add@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%ecx
xor    %edx,%edx
call   1040 <mult@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<avg3>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %rdi,%rbx
mov    %r8d,%ecx
call   1030 <add@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1030 <add@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %ebp,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <mult@plt>

LLVM IR (-O0):
define void @avg3(double* %0, double* %1, double* %2, double* %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store i32 %4, i32* %10
%11 = load double*, double** %6
%12 = load double*, double** %7
%13 = load double*, double** %8
%14 = load i32, i32* %10
%15 = call i32 @add(double* %11, double* %12, double* %13, i32 %14)
%16 = load double*, double** %6
%17 = load double*, double** %6
%18 = load double*, double** %9
%19 = load i32, i32* %10
%20 = call i32 @add(double* %16, double* %17, double* %18, i32 %19)
%21 = load double*, double** %6
%22 = load double*, double** %6
%23 = load i32, i32* %10
%24 = call i32 @mult(double* %21, double* %22, i32 0, i32 %23)
ret void
}

LLVM IR (-O2):
define void @avg3(double* %0, double* %1, double* %2, double* %3, i32 %4) {
%6 = tail call i32 @add(double* %0, double* %1, double* %2, i32 %4)
%7 = tail call i32 @add(double* %0, double* %0, double* %3, i32 %4)
%8 = tail call i32 @mult(double* %0, double* %0, i32 0, i32 %4)
ret void
}
int dummy_open(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @dummy_open() {
ret i32 0
}
int test_imm_D4int8_mem(signed char *val) {
  return ((*val) & (-0xD4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D4int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff2c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D4int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff2c,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D4int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -212
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_D4int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -212
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
char *strchr(char *, char);
int endNBRF(char *s, int *addend) {
  char *a;
  if ((a = strchr(s, '*')) != NULL) {
    *a = 0;
    *addend = 1;
    return (1);
  } else if (*s == '>') {
    *addend = 0;
    return (1);
  } else
    return (0);
}


x86 assembly (clang, -O0):
<endNBRF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1159 <endNBRF+0x49>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1186 <endNBRF+0x76>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
jne    117f <endNBRF+0x6f>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1186 <endNBRF+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endNBRF>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x2a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1133 <endNBRF+0x23>
movb   $0x0,(%rax)
mov    $0x1,%eax
jmp    113a <endNBRF+0x2a>
xor    %eax,%eax
cmpb   $0x3e,(%rbx)
jne    1142 <endNBRF+0x32>
mov    %eax,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @endNBRF(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 42)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
store i8 0, i8* %3
br label %9
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 62
br i1 %8, label %9, label %11
9: ; preds = %6, %5
%10 = phi i32 [ 1, %5 ], [ 0, %6 ]
store i32 %10, i32* %1
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ 0, %6 ], [ 1, %9 ]
ret i32 %12
}
unsigned short inw(int port) {
  unsigned short value;
  asm volatile("inw %w1, %w0" : "=a"(value) : "Nd"(port));
  return value;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%ax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i16 asm sideeffect "inw ${1:w}, ${0:w}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i32 %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w}, ${0:w}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ trainer_sdt_2(int /*<<< orphan*/);
void trainer_sdt_2_launcher(void) { trainer_sdt_2(0); }


x86 assembly (clang, -O0):
<trainer_sdt_2_launcher>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <trainer_sdt_2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<trainer_sdt_2_launcher>:
xor    %edi,%edi
jmp    1030 <trainer_sdt_2@plt>

LLVM IR (-O0):
define void @trainer_sdt_2_launcher() {
%1 = call i32 @trainer_sdt_2(i32 0)
ret void
}

LLVM IR (-O2):
define void @trainer_sdt_2_launcher() {
%1 = tail call i32 @trainer_sdt_2(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PANIC();
int /*<<< orphan*/ tprint(char *);
void adderrbuf(char *strp) {
  tprint(strp);
  PANIC();
}


x86 assembly (clang, -O0):
<adderrbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <tprint@plt>
mov    $0x0,%al
call   1040 <PANIC@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adderrbuf>:
push   %rax
call   1030 <tprint@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <PANIC@plt>

LLVM IR (-O0):
define void @adderrbuf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @tprint(i8* %3)
%5 = call i32 (...) @PANIC()
ret void
}

LLVM IR (-O2):
define void @adderrbuf(i8* %0) {
%2 = tail call i32 @tprint(i8* %0)
%3 = tail call i32 (...) @PANIC()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lru_cache_get(int);
int lruCacheGet(int key) { lru_cache_get(key); }


x86 assembly (clang, -O0):
<lruCacheGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <lru_cache_get@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lruCacheGet>:
jmp    1030 <lru_cache_get@plt>

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

LLVM IR (-O2):
define i32 @lruCacheGet(i32 %0) {
%2 = tail call i32 @lru_cache_get(i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ call_f();
int main() {
  while (1) {
    call_f();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <call_f@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <call_f@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @call_f()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @call_f()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, int, char const *, char const *);
void panic(const char *e, int lineno, const char *line) {
  errx(1, "Line %d: %s\n%s\n", lineno, e, line);
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    $0x1,%edi
lea    0xec6(%rip),%rsi
call   1030 <errx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panic>:
mov    %rdx,%r8
mov    %esi,%edx
mov    %rdi,%rcx
lea    0xee1(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <errx@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Line %d: %s\0A%s\0A\00"
define void @panic(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %6
%10 = call i32 @errx(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Line %d: %s\0A%s\0A\00"
define void @panic(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %0, i8* %2)
ret void
}
/* Type definitions */
struct cdma_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void sky_cdma_endian_swap(struct cdma_t *p) {
  assert(p != NULL);
  ;
  ;
  ;
  ;
  ;
  ;
}


x86 assembly (clang, -O0):
<sky_cdma_endian_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sky_cdma_endian_swap>:
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
mov    %eax,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct.cdma_t = type { i32 }
define void @sky_cdma_endian_swap(%struct.cdma_t* %0) {
%2 = alloca %struct.cdma_t*
store %struct.cdma_t* %0, %struct.cdma_t** %2
%3 = load %struct.cdma_t*, %struct.cdma_t** %2
%4 = icmp ne %struct.cdma_t* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
%struct.cdma_t = type { i32 }
define void @sky_cdma_endian_swap(%struct.cdma_t* readnone %0) {
%2 = icmp ne %struct.cdma_t* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Variables and functions */
int SEEK_END;
__attribute__((visibility("default"))) int get_seek_end() { return SEEK_END; }


x86 assembly (clang, -O0):
<get_seek_end>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_seek_end>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @get_seek_end() {
%1 = load i32, i32* @SEEK_END
ret i32 %1
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @get_seek_end() {
%1 = load i32, i32* @SEEK_END
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned int spng_dec_read_bit(int /*<<< orphan*/ *);
unsigned int spng_dec_read_bits(FILE *fp, unsigned int length) {
  unsigned int output = 0;
  unsigned int i;
  for (i = 0; i < length; i++) {
    output |= (spng_dec_read_bit(fp) << i);
  }
  return output;
}


x86 assembly (clang, -O0):
<spng_dec_read_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    115b <spng_dec_read_bits+0x4b>
mov    -0x8(%rbp),%rdi
call   1030 <spng_dec_read_bit@plt>
mov    -0x14(%rbp),%ecx
shl    %cl,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <spng_dec_read_bits+0x1d>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spng_dec_read_bits>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
je     1148 <spng_dec_read_bits+0x38>
mov    %esi,%r15d
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1030 <spng_dec_read_bit@plt>
mov    %ebx,%ecx
shl    %cl,%eax
or     %eax,%ebp
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    1130 <spng_dec_read_bits+0x20>
jmp    114a <spng_dec_read_bits+0x3a>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @spng_dec_read_bits(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i32*, i32** %3
%13 = call i32 @spng_dec_read_bit(i32* %12)
%14 = load i32, i32* %6
%15 = shl i32 %13, %14
%16 = load i32, i32* %5
%17 = or i32 %16, %15
store i32 %17, i32* %5
br label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = add i32 %19, 1
store i32 %20, i32* %6
br label %7
21: ; preds = %7
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
define i32 @spng_dec_read_bits(i32* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ 0, %2 ]
%6 = phi i32 [ %9, %4 ], [ 0, %2 ]
%7 = tail call i32 @spng_dec_read_bit(i32* %0)
%8 = shl i32 %7, %5
%9 = or i32 %8, %6
%10 = add nuw i32 %5, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = phi i32 [ 0, %2 ], [ %9, %4 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ sfree(void *);
void mwsync_althook_free(void *chook) {
  if (chook) {
    sfree(chook);
  }
  return;
}


x86 assembly (clang, -O0):
<mwsync_althook_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <mwsync_althook_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <sfree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mwsync_althook_free>:
test   %rdi,%rdi
je     111a <mwsync_althook_free+0xa>
jmp    1030 <sfree@plt>
ret

LLVM IR (-O0):
define void @mwsync_althook_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @sfree(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @mwsync_althook_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @sfree(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void XtVaSetValues() {}


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

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

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

LLVM IR (-O2):
define void @XtVaSetValues() {
ret void
}
int pred(char *token) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @pred(i8* nocapture readnone %0) {
ret i32 0
}
void testEnvShmBarrier(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @RTVfsParsePathFree() {
ret void
}
zap(s, n) float *s;
int n;
{
  int i;
  for (i = 0; i < n; i++)
    s[i] = 0.0;
}


x86 assembly (clang, -O0):
<zap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    113c <zap+0x3c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <zap+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zap>:
test   %esi,%esi
jle    1126 <zap+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @zap(float* %0, i32 %1) {
%3 = alloca i32
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
store float* %0, float** %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %16, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load float*, float** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds float, float* %12, i64 %14
store float 0.000000e+00, float* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %7
19: ; preds = %7
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @zap(float* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast float* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ leerArchivo1();
int /*<<< orphan*/ leerArchivo2();
int /*<<< orphan*/ leerArchivo3();
int /*<<< orphan*/ leerArchivo4();
int /*<<< orphan*/ leerArchivo5();
int /*<<< orphan*/ leerArchivo6();
int /*<<< orphan*/ leerArchivo7();
void leerArchivos() {
  leerArchivo1();
  leerArchivo2();
  leerArchivo3();
  leerArchivo4();
  leerArchivo5();
  leerArchivo6();
  leerArchivo7();
}


x86 assembly (clang, -O0):
<leerArchivos>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1090 <leerArchivo1@plt>
mov    $0x0,%al
call   1050 <leerArchivo2@plt>
mov    $0x0,%al
call   1080 <leerArchivo3@plt>
mov    $0x0,%al
call   1040 <leerArchivo4@plt>
mov    $0x0,%al
call   1070 <leerArchivo5@plt>
mov    $0x0,%al
call   1030 <leerArchivo6@plt>
mov    $0x0,%al
call   1060 <leerArchivo7@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<leerArchivos>:
push   %rax
xor    %eax,%eax
call   1090 <leerArchivo1@plt>
xor    %eax,%eax
call   1050 <leerArchivo2@plt>
xor    %eax,%eax
call   1080 <leerArchivo3@plt>
xor    %eax,%eax
call   1040 <leerArchivo4@plt>
xor    %eax,%eax
call   1070 <leerArchivo5@plt>
xor    %eax,%eax
call   1030 <leerArchivo6@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <leerArchivo7@plt>

LLVM IR (-O0):
define void @leerArchivos() {
%1 = call i32 (...) @leerArchivo1()
%2 = call i32 (...) @leerArchivo2()
%3 = call i32 (...) @leerArchivo3()
%4 = call i32 (...) @leerArchivo4()
%5 = call i32 (...) @leerArchivo5()
%6 = call i32 (...) @leerArchivo6()
%7 = call i32 (...) @leerArchivo7()
ret void
}

LLVM IR (-O2):
define void @leerArchivos() {
%1 = tail call i32 (...) @leerArchivo1()
%2 = tail call i32 (...) @leerArchivo2()
%3 = tail call i32 (...) @leerArchivo3()
%4 = tail call i32 (...) @leerArchivo4()
%5 = tail call i32 (...) @leerArchivo5()
%6 = tail call i32 (...) @leerArchivo6()
%7 = tail call i32 (...) @leerArchivo7()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int foo(int i) {
  printf("i = %i\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"i = %i\0A\00"
define i32 @foo(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
float logf(float);
void __hv_log_f(float bIn, float *bOut) {
  *bOut = (bIn > 0.0f) ? logf(bIn) : 0.0f;
}


x86 assembly (clang, -O0):
<__hv_log_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1146 <__hv_log_f+0x36>
movss  -0x4(%rbp),%xmm0
call   1030 <logf@plt>
movss  %xmm0,-0x14(%rbp)
jmp    1153 <__hv_log_f+0x43>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1153 <__hv_log_f+0x43>
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hv_log_f>:
push   %rbx
mov    %rdi,%rbx
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jbe    1127 <__hv_log_f+0x17>
movaps %xmm1,%xmm0
call   1030 <logf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @__hv_log_f(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
store float %0, float* %3
store float* %1, float** %4
%5 = load float, float* %3
%6 = fcmp ogt float %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load float, float* %3
%9 = call float @logf(float %8)
br label %11
10: ; preds = %2
br label %11
11: ; preds = %10, %7
%12 = phi float [ %9, %7 ], [ 0.000000e+00, %10 ]
%13 = load float*, float** %4
store float %12, float* %13
ret void
}

LLVM IR (-O2):
define void @__hv_log_f(float %0, float* nocapture writeonly %1) {
%3 = fcmp ogt float %0, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call float @logf(float %0)
br label %6
6: ; preds = %2, %4
%7 = phi float [ %5, %4 ], [ 0.000000e+00, %2 ]
store float %7, float* %1
ret void
}
unsigned getun() { return 5; }


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

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

LLVM IR (-O0):
define i32 @getun() {
ret i32 5
}

LLVM IR (-O2):
define i32 @getun() {
ret i32 5
}
int get_token(void) {}


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

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

LLVM IR (-O0):
define i32 @get_token() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @get_token() {
ret i32 undef
}
void soma_ab(int *A, int *B) { *A = *A + *B; }


x86 assembly (clang, -O0):
<soma_ab>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @soma_ab(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
store i32 %5, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int send(int, char *, int, int /*<<< orphan*/);
int writeSocket(int sockfd, char *buff_out, int len) {
  int bytesSended = send(sockfd, buff_out, len, 0);
  if (bytesSended < 0) {
    perror("SendSocket error");
  }
  return bytesSended;
}


x86 assembly (clang, -O0):
<writeSocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    115c <writeSocket+0x3c>
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeSocket>:
push   %rbx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1132 <writeSocket+0x12>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec7(%rip),%rdi
call   1040 <perror@plt>
jmp    112e <writeSocket+0xe>

LLVM IR (-O0):
@.str = [17 x i8] c"SendSocket error\00"
define i32 @writeSocket(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 i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @send(i32 %8, i8* %9, i32 %10, i32 0)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
@.str = [17 x i8] c"SendSocket error\00"
define i32 @writeSocket(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 0)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ myfunc3();
void myfunc2(void) { myfunc3(); }


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

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

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

LLVM IR (-O2):
define void @myfunc2() {
%1 = tail call i32 (...) @myfunc3()
ret void
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
int exports_parsegoal(char *goalstr, uint8_t *goal) {
  if (*goalstr < '1' || *goalstr > '9' || *(goalstr + 1)) {
    return -1;
  }
  *goal = *goalstr - '0';
  return 0;
}


x86 assembly (clang, -O0):
<exports_parsegoal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jl     113d <exports_parsegoal+0x3d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     113d <exports_parsegoal+0x3d>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1149 <exports_parsegoal+0x49>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <exports_parsegoal+0x62>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exports_parsegoal>:
mov    (%rdi),%cl
lea    -0x3a(%rcx),%edx
mov    $0xffffffff,%eax
cmp    $0xf7,%dl
jb     1115 <exports_parsegoal+0x15>
cmpb   $0x0,0x1(%rdi)
je     1116 <exports_parsegoal+0x16>
ret
add    $0xd0,%cl
mov    %cl,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @exports_parsegoal(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = add i8 %3, -58
%5 = icmp ult i8 %4, -9
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = add nsw i8 %3, -48
store i8 %11, i8* %1
br label %12
12: ; preds = %2, %6, %10
%13 = phi i32 [ 0, %10 ], [ -1, %6 ], [ -1, %2 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void baka_handler_1() { printf("baka_handler_1 called.\n"); }


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

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

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

LLVM IR (-O2):
@str = [23 x i8] c"baka_handler_1 called.\00"
define void @baka_handler_1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int write(int, char *, int);
void make_vulnerable() {
  int oom_adj_fd;
  int r;
  oom_adj_fd = open("/proc/self/oom_adj", O_WRONLY);
  assert(oom_adj_fd != -1);
  r = write(oom_adj_fd, "0\n", 2);
  assert(r == 2);
  close(oom_adj_fd);
}


x86 assembly (clang, -O0):
<make_vulnerable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    0xea8(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
lea    0xe98(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_vulnerable>:
push   %rbx
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   1050 <assert@plt>
lea    0xea6(%rip),%rsi
mov    %ebx,%edi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"/proc/self/oom_adj\00"
@O_WRONLY = global i32 0
@.str.1 = [3 x i8] c"0\0A\00"
define void @make_vulnerable() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @O_WRONLY
%4 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @write(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %1
%16 = call i32 @close(i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"/proc/self/oom_adj\00"
@O_WRONLY = global i32 0
@.str.1 = [3 x i8] c"0\0A\00"
define void @make_vulnerable() {
%1 = load i32, i32* @O_WRONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp ne i32 %2, -1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @write(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = icmp eq i32 %6, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @close(i32 %2)
ret void
}
int main() {
  int i;
  int b = 0;
  for (i = 0; i < 3; i = i + 1) {
    b = b + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    113a <main+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ stdout;
int write(int /*<<< orphan*/, char *, int);
int term_clear_line() { return write(stdout, "\x1b[2K", 4) != 4; }


x86 assembly (clang, -O0):
<term_clear_line>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_clear_line>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    $0x4,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[2K\00"
define i32 @term_clear_line() {
%1 = load i32, i32* @stdout
%2 = call i32 @write(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[2K\00"
define i32 @term_clear_line() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned char _interlockedbittestandset(int volatile *, int);
unsigned char test_interlockedbittestandset(volatile int *ptr, int bit) {
  return _interlockedbittestandset(ptr, bit);
}


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

x86 assembly (clang, -O2):
<test_interlockedbittestandset>:
jmp    1030 <_interlockedbittestandset@plt>

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

LLVM IR (-O2):
define zeroext i8 @test_interlockedbittestandset(i32* %0, i32 %1) {
%3 = tail call zeroext i8 @_interlockedbittestandset(i32* %0, i32 %1)
ret i8 %3
}
/* Variables and functions */
int putchar(int);
main() {
  putchar(4 + putchar(putchar(52) - 4));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x34,%edi
call   1030 <putchar@plt>
mov    %eax,%edi
sub    $0x4,%edi
call   1030 <putchar@plt>
mov    %eax,%edi
add    $0x4,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x34,%edi
call   1030 <putchar@plt>
lea    -0x4(%rax),%edi
call   1030 <putchar@plt>
lea    0x4(%rax),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @putchar(i32 52)
%3 = sub nsw i32 %2, 4
%4 = call i32 @putchar(i32 %3)
%5 = add nsw i32 4, %4
%6 = call i32 @putchar(i32 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 52)
%2 = add nsw i32 %1, -4
%3 = tail call i32 @putchar(i32 %2)
%4 = add nsw i32 %3, 4
%5 = tail call i32 @putchar(i32 %4)
ret i32 0
}
double logic_e(double a, double b) { return a == b; }


x86 assembly (clang, -O0):
<logic_e>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<logic_e>:
cmpeqsd %xmm1,%xmm0
movsd  0xef3(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @logic_e(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 = fcmp oeq double %5, %6
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @logic_e(double %0, double %1) {
%3 = fcmp oeq double %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ sched_yield();
void HDeschedule(void) { sched_yield(); }


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

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

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

LLVM IR (-O2):
define void @HDeschedule() {
%1 = tail call i32 (...) @sched_yield()
ret void
}
/* Variables and functions */
scalar_t__ CLOCKS_PER_SEC;
scalar_t__ clock();
double clocktime() {
  double xtime;
  double y;
  xtime = (double)clock();
  y = xtime / (double)CLOCKS_PER_SEC;
  return y;
}


x86 assembly (clang, -O0):
<clocktime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2eb3(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clocktime>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i64 0
define double @clocktime() {
%1 = alloca double
%2 = alloca double
%3 = call i64 (...) @clock()
%4 = sitofp i64 %3 to double
store double %4, double* %1
%5 = load double, double* %1
%6 = load i64, i64* @CLOCKS_PER_SEC
%7 = sitofp i64 %6 to double
%8 = fdiv double %5, %7
store double %8, double* %2
%9 = load double, double* %2
ret double %9
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i64 0
define double @clocktime() {
%1 = tail call i64 (...) @clock()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @CLOCKS_PER_SEC
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
long long max(long long a, long long b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <max+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <max+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @max(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @max(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void ath5k_debug_dump_skb(struct ath5k_softc *sc, struct sk_buff *skb,
                          const char *prefix, int tx) {}


x86 assembly (clang, -O0):
<ath5k_debug_dump_skb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ath5k_softc = type opaque
%struct.sk_buff = type opaque
define void @ath5k_debug_dump_skb(%struct.ath5k_softc* %0, %struct.sk_buff* %1, i8* %2, i32 %3) {
%5 = alloca %struct.ath5k_softc*
%6 = alloca %struct.sk_buff*
%7 = alloca i8*
%8 = alloca i32
store %struct.ath5k_softc* %0, %struct.ath5k_softc** %5
store %struct.sk_buff* %1, %struct.sk_buff** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
%struct.ath5k_softc = type opaque
%struct.sk_buff = type opaque
define void @ath5k_debug_dump_skb(%struct.ath5k_softc* nocapture %0, %struct.sk_buff* nocapture %1, i8* nocapture %2, i32 %3) {
ret void
}
/* Variables and functions */
int factorial(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%i\n", factorial(n));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <factorial@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @factorial(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
double exp(float);
float coshf(float x) { return (exp(x) + exp(-x)) * 0.5; }


x86 assembly (clang, -O0):
<coshf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coshf>:
sub    $0x28,%rsp
movaps %xmm0,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xece(%rip),%xmm0
call   1030 <exp@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xecb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @coshf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call double @exp(float %3)
%5 = load float, float* %2
%6 = fneg float %5
%7 = call double @exp(float %6)
%8 = fadd double %4, %7
%9 = fmul double %8, 5.000000e-01
%10 = fptrunc double %9 to float
ret float %10
}

LLVM IR (-O2):
define float @coshf(float %0) {
%2 = tail call double @exp(float %0)
%3 = fneg float %0
%4 = tail call double @exp(float %3)
%5 = fadd double %2, %4
%6 = fmul double %5, 5.000000e-01
%7 = fptrunc double %6 to float
ret float %7
}
__attribute__((always_)) unsigned short inw_local(int port) {
  unsigned short value;
  __asm__ __volatile__("in"
                       "w"
                       " %w1, %"
                       "w"
                       "0"
                       : "=a"(value)
                       : "Nd"(port));
  return value;
}


x86 assembly (clang, -O0):
<inw_local>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%ax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw_local>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw_local(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i16 asm sideeffect "inw ${1:w}, ${0:w}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw_local(i32 %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w}, ${0:w}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i16 %2
}