xunge/DecIR huggingface dataset:
void __attribute__((no_instrument_function))
__cyg_profile_func_exit(void *this_fn, void *call_site) {}


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

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

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

LLVM IR (-O2):
define void @__cyg_profile_func_exit(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int uint64_t;
struct pcg_state_128 {
  int dummy;
};

/* Variables and functions */
int pcg_unique_128_xsl_rr_64_random_r(struct pcg_state_128 *);
uint64_t pcg_unique_128_xsl_rr_64_boundedrand_r(struct pcg_state_128 *rng,
                                                uint64_t bound) {
  uint64_t threshold = -bound % bound;
  for (;;) {
    uint64_t r = pcg_unique_128_xsl_rr_64_random_r(rng);
    if (r >= threshold)
      return r % bound;
  }
}


x86 assembly (clang, -O0):
<pcg_unique_128_xsl_rr_64_boundedrand_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pcg_unique_128_xsl_rr_64_random_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1152 <pcg_unique_128_xsl_rr_64_boundedrand_r+0x42>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    112b <pcg_unique_128_xsl_rr_64_boundedrand_r+0x1b>

x86 assembly (clang, -O2):
<pcg_unique_128_xsl_rr_64_boundedrand_r>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <pcg_unique_128_xsl_rr_64_random_r@plt>
test   %eax,%eax
js     1120 <pcg_unique_128_xsl_rr_64_boundedrand_r+0x10>
cltd
idiv   %ebp
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.pcg_state_128 = type { i32 }
define i32 @pcg_unique_128_xsl_rr_64_boundedrand_r(%struct.pcg_state_128* %0, i32 %1) {
%3 = alloca %struct.pcg_state_128*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.pcg_state_128* %0, %struct.pcg_state_128** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sub nsw i32 0, %7
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
store i32 %10, i32* %5
br label %11
11: ; preds = %21, %2
%12 = load %struct.pcg_state_128*, %struct.pcg_state_128** %3
%13 = call i32 @pcg_unique_128_xsl_rr_64_random_r(%struct.pcg_state_128* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = icmp sge i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = srem i32 %18, %19
ret i32 %20
21: ; preds = %11
br label %11
}

LLVM IR (-O2):
%struct.pcg_state_128 = type { i32 }
define i32 @pcg_unique_128_xsl_rr_64_boundedrand_r(%struct.pcg_state_128* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @pcg_unique_128_xsl_rr_64_random_r(%struct.pcg_state_128* %0)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = srem i32 %4, %1
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ uint_least32_t;

/* Variables and functions */
bool SHAREMIND_SET_KEY_EQUALS_uint_least32_t(uint_least32_t const k1,
                                             uint_least32_t const k2) {
  return k1 == k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_EQUALS_uint_least32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_EQUALS_uint_least32_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_SET_KEY_EQUALS_uint_least32_t(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 eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_EQUALS_uint_least32_t(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void lll_prof_exit_lll(void) {}


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

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

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

LLVM IR (-O2):
define void @lll_prof_exit_lll() {
ret void
}
float cosf_neon_hfp(float x) {}


x86 assembly (clang, -O0):
<cosf_neon_hfp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @cosf_neon_hfp(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %2
ret float %4
}

LLVM IR (-O2):
define float @cosf_neon_hfp(float %0) {
ret float undef
}
int cl_dev_getsize(const void *cfg) { return (1 * 1024 * 1024); }


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

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

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

LLVM IR (-O2):
define i32 @cl_dev_getsize(i8* nocapture readnone %0) {
ret i32 1048576
}
/* Variables and functions */
int lruCacheGet(int);
int get(int key) { return lruCacheGet(key); }


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

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

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

LLVM IR (-O2):
define i32 @get(i32 %0) {
%2 = tail call i32 @lruCacheGet(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ posix_spawnattr_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int posix_spawnattr_getsigmask(const posix_spawnattr_t *attr,
                               sigset_t *sigmask) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<posix_spawnattr_getsigmask>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_spawnattr_getsigmask>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @posix_spawnattr_getsigmask(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @posix_spawnattr_getsigmask(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo() { printf("foo() called\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"foo() called\00"
define void @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
char *graph_guid_compress_number(char *w, unsigned long long val) {
  while (val != 0) {
    *--w = "0123456789abcdef"[val & 0xF];
    val >>= 4;
  }
  return w;
}


x86 assembly (clang, -O0):
<graph_guid_compress_number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114c <graph_guid_compress_number+0x4c>
mov    -0x10(%rbp),%rcx
and    $0xf,%rcx
lea    0xeda(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x10(%rbp),%rax
shr    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <graph_guid_compress_number+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<graph_guid_compress_number>:
mov    %rdi,%rax
test   %rsi,%rsi
je     113e <graph_guid_compress_number+0x3e>
lea    0xef1(%rip),%r8
mov    %rsi,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %esi,%edi
and    $0xf,%edi
movzbl (%rdi,%r8,1),%ecx
mov    %cl,-0x1(%rax)
add    $0xffffffffffffffff,%rax
shr    $0x4,%rdx
cmp    $0xf,%rsi
mov    %rdx,%rsi
ja     1120 <graph_guid_compress_number+0x20>
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789abcdef\00"
define i8* @graph_guid_compress_number(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %8, %2
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i64, i64* %4
%10 = and i64 %9, 15
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 -1
store i8* %14, i8** %3
store i8 %12, i8* %14
%15 = load i64, i64* %4
%16 = lshr i64 %15, 4
store i64 %16, i64* %4
br label %5
17: ; preds = %5
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define i8* @graph_guid_compress_number(i8* writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %11, %4 ], [ %1, %2 ]
%6 = phi i8* [ %10, %4 ], [ %0, %2 ]
%7 = and i64 %5, 15
%8 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %6, i64 -1
store i8 %9, i8* %10
%11 = lshr i64 %5, 4
%12 = icmp ult i64 %5, 16
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i8* [ %0, %2 ], [ %10, %4 ]
ret i8* %14
}
void init_str(char *str, int size) {
  for (int i = 0; i < size; i++) {
    str[i] = '\0';
  }
}


x86 assembly (clang, -O0):
<init_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <init_str+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <init_str+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_str>:
test   %esi,%esi
jle    1122 <init_str+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @init_str(i8* %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 = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_str(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Type definitions */
struct mt19937_state {
  int dummy;
};

/* Variables and functions */
scalar_t__ mt19937_genrand_int32(struct mt19937_state *);
double mt19937_genrand_real3(struct mt19937_state *rng) {
  return (((double)mt19937_genrand_int32(rng)) + 0.5) * (1.0 / 4294967296.0);
}


x86 assembly (clang, -O0):
<mt19937_genrand_real3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mt19937_genrand_int32@plt>
cvtsi2sd %rax,%xmm0
movsd  0xed6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xec2(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mt19937_genrand_real3>:
push   %rax
call   1030 <mt19937_genrand_int32@plt>
cvtsi2sd %rax,%xmm0
addsd  0xedd(%rip),%xmm0
mulsd  0xedd(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.mt19937_state = type { i32 }
define double @mt19937_genrand_real3(%struct.mt19937_state* %0) {
%2 = alloca %struct.mt19937_state*
store %struct.mt19937_state* %0, %struct.mt19937_state** %2
%3 = load %struct.mt19937_state*, %struct.mt19937_state** %2
%4 = call i64 @mt19937_genrand_int32(%struct.mt19937_state* %3)
%5 = sitofp i64 %4 to double
%6 = fadd double %5, 5.000000e-01
%7 = fmul double %6, 0x3DF0000000000000
ret double %7
}

LLVM IR (-O2):
%struct.mt19937_state = type { i32 }
define double @mt19937_genrand_real3(%struct.mt19937_state* %0) {
%2 = tail call i64 @mt19937_genrand_int32(%struct.mt19937_state* %0)
%3 = sitofp i64 %2 to double
%4 = fadd double %3, 5.000000e-01
%5 = fmul double %4, 0x3DF0000000000000
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int aes() {
  printf("AES is not supported.");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"AES is not supported.\00"
define i32 @aes() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"AES is not supported.\00"
define i32 @aes() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_imm_12uint32_reg(unsigned int val) {
  return ((val) & (0x12 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_12uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x12,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_12uint32_reg>:
test   $0x12,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_12uint32_reg(i32 %0) {
%2 = and i32 %0, 18
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void consoleSetBackColor(int color) {}


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

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

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

LLVM IR (-O2):
define void @consoleSetBackColor(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
scalar_t__ ESRCH;
int /*<<< orphan*/ SIGKILL;
scalar_t__ errno;
int /*<<< orphan*/ error(char *);
int kill(int, int /*<<< orphan*/);
void terminate(pid_t pid) {
  int v;
  v = kill(-1, SIGKILL);
  if (v < 0)
    if (errno != ESRCH)
      error("error en terminate\n");
}


x86 assembly (clang, -O0):
<terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
call   1030 <kill@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1176 <terminate+0x56>
mov    0x2e8e(%rip),%rax
mov    (%rax),%rax
mov    0x2e6c(%rip),%rcx
cmp    (%rcx),%rax
je     1171 <terminate+0x51>
lea    0xe94(%rip),%rdi
call   1040 <error@plt>
jmp    1176 <terminate+0x56>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminate>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
call   1030 <kill@plt>
test   %eax,%eax
jns    114e <terminate+0x2e>
mov    0x2ea1(%rip),%rax
mov    (%rax),%rax
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
jne    1150 <terminate+0x30>
pop    %rax
ret
lea    0xea9(%rip),%rdi
pop    %rax
jmp    1040 <error@plt>

LLVM IR (-O0):
@SIGKILL = global i32 0
@errno = global i64 0
@ESRCH = global i64 0
@.str = [20 x i8] c"error en terminate\0A\00"
define void @terminate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @SIGKILL
%5 = call i32 @kill(i32 -1, i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = load i64, i64* @errno
%10 = load i64, i64* @ESRCH
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
br label %15
15: ; preds = %14, %1
ret void
}

LLVM IR (-O2):
@SIGKILL = global i32 0
@errno = global i64 0
@ESRCH = global i64 0
@.str = [20 x i8] c"error en terminate\0A\00"
define void @terminate(i32 %0) {
%2 = load i32, i32* @SIGKILL
%3 = tail call i32 @kill(i32 -1, i32 %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i64, i64* @errno
%7 = load i64, i64* @ESRCH
%8 = icmp eq i64 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %5, %9, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bubbleSort();
ordena() { bubbleSort(); }


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

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

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

LLVM IR (-O2):
define i32 @ordena() {
%1 = tail call i32 (...) @bubbleSort()
ret i32 undef
}
/* Variables and functions */
double sqrt(int);
double type2(int a, int b, int c) {
  int s = a + b + c;
  int p = s * (s - a) * (s - b) * (s - c);
  double area = sqrt(p);
  return area;
}


x86 assembly (clang, -O0):
<type2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x4(%rbp),%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type2>:
lea    (%rsi,%rdi,1),%ecx
lea    (%rdx,%rcx,1),%eax
mov    %eax,%edx
sub    %edi,%edx
mov    %eax,%edi
sub    %esi,%edi
imul   %edx,%edi
imul   %ecx,%eax
imul   %edi,%eax
mov    %eax,%edi
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @type2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %6
%14 = add nsw i32 %12, %13
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = load i32, i32* %7
%17 = load i32, i32* %4
%18 = sub nsw i32 %16, %17
%19 = mul nsw i32 %15, %18
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = sub nsw i32 %20, %21
%23 = mul nsw i32 %19, %22
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = sub nsw i32 %24, %25
%27 = mul nsw i32 %23, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = call double @sqrt(i32 %28)
store double %29, double* %9
%30 = load double, double* %9
ret double %30
}

LLVM IR (-O2):
define double @type2(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
%6 = sub nsw i32 %5, %0
%7 = sub nsw i32 %5, %1
%8 = mul i32 %5, %4
%9 = mul i32 %8, %6
%10 = mul i32 %9, %7
%11 = tail call double @sqrt(i32 %10)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(unsigned long);
void *realloc(void *, unsigned int);
void f4(int i) {
  unsigned long j = 10;
  void *ptr = malloc(j);
  if (i > 0)
    ptr = realloc(ptr, (unsigned)i);
  free(ptr);
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0xa,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    116a <f4+0x3a>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
push   %rbx
mov    %edi,%ebx
mov    $0xa,%edi
call   1040 <malloc@plt>
test   %ebx,%ebx
jle    114b <f4+0x1b>
mov    %rax,%rdi
mov    %ebx,%esi
call   1050 <realloc@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @f4(i32 %0) {
%2 = tail call dereferenceable_or_null(10) i8* @malloc(i64 10)
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @realloc(i8* %2, i32 %0)
br label %6
6: ; preds = %4, %1
%7 = phi i8* [ %5, %4 ], [ %2, %1 ]
%8 = tail call i32 @free(i8* %7)
ret void
}
int main() {
  long int j = 0;
  do {
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
jmp    1118 <main+0x18>
mov    $0x1,%al
test   $0x1,%al
jne    1113 <main+0x13>
jmp    1127 <main+0x27>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
br label %3
3: ; preds = %4, %0
br label %4
4: ; preds = %3
br i1 true, label %3, label %5
5: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ lstat(char *, struct stat *);
int is_symlink(char *path) {
  struct stat st;
  return lstat(path, &st) >= 0 && S_ISLNK(st.st_mode);
}


x86 assembly (clang, -O0):
<is_symlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <lstat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jl     115d <is_symlink+0x3d>
mov    -0x10(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_symlink>:
push   %rax
mov    %rsp,%rsi
call   1040 <lstat@plt>
test   %rax,%rax
js     1143 <is_symlink+0x23>
mov    (%rsp),%edi
call   1030 <S_ISLNK@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @is_symlink(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @lstat(i8* %4, %struct.stat* %3)
%6 = icmp sge i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @S_ISLNK(i32 %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_symlink(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @lstat(i8* %0, %struct.stat* %2)
%5 = icmp sgt i64 %4, -1
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i64 @S_ISLNK(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}
unsigned long long int factorial(unsigned int number) {
  if (number <= 1) {
    return 1;
  } else {
    return (number * factorial(number - 1));
  }
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
ja     1132 <factorial+0x22>
movq   $0x1,-0x8(%rbp)
jmp    1153 <factorial+0x43>
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factorial@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1130 <factorial+0x30>
mov    %edi,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rcx,%rax
add    $0xffffffffffffffff,%rcx
test   $0xfffffffe,%ecx
jne    1120 <factorial+0x20>
ret

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

LLVM IR (-O2):
define i64 @factorial(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = phi i64 [ 1, %3 ], [ %9, %5 ]
%8 = add nsw i64 %6, -1
%9 = mul i64 %7, %6
%10 = and i64 %8, 4294967294
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i64 [ 1, %1 ], [ %9, %5 ]
ret i64 %13
}
/* Variables and functions */
int bar();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("The answer is %d\n", bar());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"The answer is %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @bar()
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"The answer is %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void uDMAErrorStatusClear(void) {
  (*((volatile unsigned long *)(0x400FF04C))) = 1;
}


x86 assembly (clang, -O0):
<uDMAErrorStatusClear>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400ff04c,%eax
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAErrorStatusClear>:
movq   $0x1,0x400ff04c
ret

LLVM IR (-O0):
define void @uDMAErrorStatusClear() {
store volatile i64 1, i64* inttoptr (i64 1074786380 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAErrorStatusClear() {
store volatile i64 1, i64* inttoptr (i64 1074786380 to i64*)
ret void
}
/* Variables and functions */
void *object_init(size_t);
void *object(size_t size) { return object_init(size); }


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

x86 assembly (clang, -O2):
<object>:
jmp    1030 <object_init@plt>

LLVM IR (-O0):
define i8* @object(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @object_init(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @object(i64 %0) {
%2 = tail call i8* @object_init(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void func1(void *args) {
  while (1) {
    sleep(1);
    printf("I am PTHREAD_1 : hello world!\n");
  }
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <func1+0xc>

x86 assembly (clang, -O2):
<func1>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1130 <func1+0x10>

LLVM IR (-O0):
@.str = [31 x i8] c"I am PTHREAD_1 : hello world!\0A\00"
define void @func1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 @sleep(i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@str = [30 x i8] c"I am PTHREAD_1 : hello world!\00"
define void @func1(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t a52_get_acmod(const uint8_t *p_a52) { return (p_a52[6] & 0xe0) >> 5; }


x86 assembly (clang, -O0):
<a52_get_acmod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
and    $0xe0,%eax
sar    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a52_get_acmod>:
mov    0x18(%rdi),%eax
shr    $0x5,%eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @a52_get_acmod(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 6
%5 = load i32, i32* %4
%6 = and i32 %5, 224
%7 = ashr i32 %6, 5
ret i32 %7
}

LLVM IR (-O2):
define i32 @a52_get_acmod(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 6
%3 = load i32, i32* %2
%4 = lshr i32 %3, 5
%5 = and i32 %4, 7
ret i32 %5
}
int write_SInt32Number(int d, char *p) {
  ((signed char *)p)[0] = (signed char)(d >> 24);
  ((unsigned char *)p)[1] = (unsigned char)(d >> 16);
  ((unsigned char *)p)[2] = (unsigned char)(d >> 8);
  ((unsigned char *)p)[3] = (unsigned char)(d);
  return 0;
}


x86 assembly (clang, -O0):
<write_SInt32Number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_SInt32Number>:
bswap  %edi
mov    %edi,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @write_SInt32Number(i32 %0, i8* nocapture writeonly %1) {
%3 = lshr i32 %0, 24
%4 = trunc i32 %3 to i8
store i8 %4, i8* %1
%5 = lshr i32 %0, 16
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %0, 8
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %9, i8* %10
%11 = trunc i32 %0 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello world (autotools)\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"Hello world (autotools)\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"Hello world (autotools)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct snd_mask {
  int dummy;
};

/* Variables and functions */
int snd_mask_min(struct snd_mask const *);
int snd_mask_value(const struct snd_mask *mask) { return snd_mask_min(mask); }


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

x86 assembly (clang, -O2):
<snd_mask_value>:
jmp    1030 <snd_mask_min@plt>

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

LLVM IR (-O2):
%struct.snd_mask = type { i32 }
define i32 @snd_mask_value(%struct.snd_mask* %0) {
%2 = tail call i32 @snd_mask_min(%struct.snd_mask* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ doub2unico(double, char *);
int /*<<< orphan*/ strcat(char *, char *);
void haiba(double h, char ch[]) {
  char *s = "6d7762d4";
  char *s1 = "7c733002";
  strcat(ch, s);
  doub2unico(h, ch);
  strcat(ch, s1);
}


x86 assembly (clang, -O0):
<haiba>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
lea    0xec8(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xec6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <doub2unico@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<haiba>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
lea    0xecb(%rip),%rsi
call   1040 <strcat@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <doub2unico@plt>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"6d7762d4\00"
@.str.1 = [9 x i8] c"7c733002\00"
define void @haiba(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store double %0, double* %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @strcat(i8* %7, i8* %8)
%10 = load double, double* %3
%11 = load i8*, i8** %4
%12 = call i32 @doub2unico(double %10, i8* %11)
%13 = load i8*, i8** %4
%14 = load i8*, i8** %6
%15 = call i32 @strcat(i8* %13, i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"6d7762d4\00"
@.str.1 = [9 x i8] c"7c733002\00"
define void @haiba(double %0, i8* %1) {
%3 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @doub2unico(double %0, i8* %1)
%5 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int dumbCall(int, int);
int main() {
  int z1 = 0;
  long z2 = 5;
  int z3 = (int)z2;
  int z4 = dumbCall(1, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movq   $0x5,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <dumbCall@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @dumbCall(i32 1, i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ A(int);
int main(int argc, char **argv) {
  A(1);
  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    $0x1,%edi
call   1030 <A@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 @A(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @A(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, char *);
char inject_letter(void) {
  char l;
  scanf(" %c", &l);
  return l;
}


x86 assembly (clang, -O0):
<inject_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1030 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inject_letter>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %c\00"
define signext i8 @inject_letter() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
ret i8 %3
}
/* Variables and functions */
int ioctl(int, int, int *);
int __gnat_socket_ioctl(int fd, int req, int *arg) {
  return ioctl(fd, req, arg);
}


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

x86 assembly (clang, -O2):
<__gnat_socket_ioctl>:
jmp    1030 <ioctl@plt>

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

LLVM IR (-O2):
define i32 @__gnat_socket_ioctl(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @ioctl(i32 %0, i32 %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
int /*<<< orphan*/ strcmp(char *, char *);
bool strings_equals(char *string1, char *string2) {
  assert(string1);
  assert(string2);
  return !strcmp(string1, string2);
}


x86 assembly (clang, -O0):
<strings_equals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_equals>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %r14,%rdi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @strings_equals(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @assert(i8* %7)
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @strcmp(i8* %9, i8* %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @strings_equals(i8* %0, i8* %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = tail call i32 @assert(i8* %1)
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
void allow_port_reuse(int sockfd) {
  int yes = 1;
  int err = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
  if (err) {
    perror("setsockopt");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<allow_port_reuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1189 <allow_port_reuse+0x59>
lea    0xe86(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allow_port_reuse>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %eax,%eax
jne    1161 <allow_port_reuse+0x31>
pop    %rax
ret
lea    0xe98(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [11 x i8] c"setsockopt\00"
define void @allow_port_reuse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_REUSEADDR
%8 = call i32 @setsockopt(i32 %5, i32 %6, i32 %7, i32* %3, i32 4)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %1
ret void
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [11 x i8] c"setsockopt\00"
define void @allow_port_reuse(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sub();
int main(void) {
  printf("main\n");
  sub();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"main\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @sub()
ret i32 0
}