xunge/DecIR huggingface dataset:
/* Type definitions */
struct buffer {
  int dummy;
};
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ buffer_read(struct buffer *, short *, int);
short buffer_read_short(struct buffer *__restrict buf) {
  short data;
  buffer_read(buf, &data, sizeof(data));
  return data;
}


x86 assembly (clang, -O0):
<buffer_read_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rsi
mov    $0x2,%edx
call   1030 <buffer_read@plt>
movswl -0xa(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_read_short>:
push   %rax
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <buffer_read@plt>
movzwl 0x6(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
define signext i16 @buffer_read_short(%struct.buffer* noalias %0) {
%2 = alloca %struct.buffer*
%3 = alloca i16
store %struct.buffer* %0, %struct.buffer** %2
%4 = load %struct.buffer*, %struct.buffer** %2
%5 = call i32 @buffer_read(%struct.buffer* %4, i16* %3, i32 2)
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define signext i16 @buffer_read_short(%struct.buffer* noalias %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
%4 = call i32 @buffer_read(%struct.buffer* %0, i16* %2, i32 2)
%5 = load i16, i16* %2
ret i16 %5
}
void arm_mem_config_default(struct config_t *config) {}


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

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

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

LLVM IR (-O2):
%struct.config_t = type opaque
define void @arm_mem_config_default(%struct.config_t* nocapture %0) {
ret void
}
/* Type definitions */
struct catmc_atomic_unsigned_short {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct catmc_atomic_unsigned_short *);
void catmc_atomic_unsigned_short_destroy(
    struct catmc_atomic_unsigned_short *wrapper) {
  free(wrapper);
}


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

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

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

LLVM IR (-O2):
%struct.catmc_atomic_unsigned_short = type { i32 }
define void @catmc_atomic_unsigned_short_destroy(%struct.catmc_atomic_unsigned_short* nocapture %0) {
%2 = tail call i32 @free(%struct.catmc_atomic_unsigned_short* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
size_t wcsnlen(int /*<<< orphan*/ const *, size_t);
int /*<<< orphan*/ wmemcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                           size_t);
int /*<<< orphan*/ wmemset(int /*<<< orphan*/ *, int /*<<< orphan*/, size_t);
wchar_t *wcsncpy(wchar_t *restrict whither, const wchar_t *restrict whence,
                 size_t maxlen) {
  size_t n = wcsnlen(whence, maxlen);
  wmemcpy(whither, whence, n);
  wmemset(whither + n, 0, maxlen - n);
  return whither;
}


x86 assembly (clang, -O0):
<wcsncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <wcsnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <wmemcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
sub    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1040 <wmemset@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsncpy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1050 <wcsnlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1030 <wmemcpy@plt>
lea    (%r15,%rbx,4),%rdi
sub    %rbx,%r12
xor    %esi,%esi
mov    %r12,%rdx
call   1040 <wmemset@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @wcsncpy(i32* noalias %0, i32* noalias %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = call i64 @wcsnlen(i32* %8, i64 %9)
store i64 %10, i64* %7
%11 = load i32*, i32** %4
%12 = load i32*, i32** %5
%13 = load i64, i64* %7
%14 = call i32 @wmemcpy(i32* %11, i32* %12, i64 %13)
%15 = load i32*, i32** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i32, i32* %15, i64 %16
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = sub i64 %18, %19
%21 = call i32 @wmemset(i32* %17, i32 0, i64 %20)
%22 = load i32*, i32** %4
ret i32* %22
}

LLVM IR (-O2):
define i32* @wcsncpy(i32* noalias returned %0, i32* noalias %1, i64 %2) {
%4 = tail call i64 @wcsnlen(i32* %1, i64 %2)
%5 = tail call i32 @wmemcpy(i32* %0, i32* %1, i64 %4)
%6 = getelementptr inbounds i32, i32* %0, i64 %4
%7 = sub i64 %2, %4
%8 = tail call i32 @wmemset(i32* %6, i32 0, i64 %7)
ret i32* %0
}
void INT_Excep_BUSERR(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_BUSERR() {
ret void
}
unsigned bit_RXBRK(unsigned reg_value) {
  return (reg_value & 0x0200) == 0x0200;
}


x86 assembly (clang, -O0):
<bit_RXBRK>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x200,%eax
cmp    $0x200,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_RXBRK>:
mov    %edi,%eax
shr    $0x9,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bit_RXBRK(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 512
%5 = icmp eq i32 %4, 512
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @bit_RXBRK(i32 %0) {
%2 = lshr i32 %0, 9
%3 = and i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ be32enc(int /*<<< orphan*/ *, int /*<<< orphan*/);
void be64enc(uint8_t *buf, uint64_t u) {
  be32enc(buf, (uint32_t)(u >> 32));
  be32enc(buf + sizeof(uint32_t), (uint32_t)(u & 0xffffffffULL));
}


x86 assembly (clang, -O0):
<be64enc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x20,%ecx
sar    %cl,%esi
call   1030 <be32enc@plt>
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
movslq -0xc(%rbp),%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
mov    %eax,%esi
call   1030 <be32enc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<be64enc>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <be32enc@plt>
add    $0x10,%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <be32enc@plt>

LLVM IR (-O0):
define void @be64enc(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 = ashr i32 %6, 32
%8 = call i32 @be32enc(i32* %5, i32 %7)
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 4
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = and i64 %12, 4294967295
%14 = trunc i64 %13 to i32
%15 = call i32 @be32enc(i32* %10, i32 %14)
ret void
}

LLVM IR (-O2):
define void @be64enc(i32* %0, i32 %1) {
%3 = tail call i32 @be32enc(i32* %0, i32 poison)
%4 = getelementptr inbounds i32, i32* %0, i64 4
%5 = tail call i32 @be32enc(i32* %4, i32 %1)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solcon_write_multprec_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(451, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_write_multprec_solutions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1c3,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_write_multprec_solutions>:
mov    $0x1c3,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @solcon_write_multprec_solutions() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 451, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @solcon_write_multprec_solutions() {
%1 = tail call i32 @_ada_use_c2phc(i32 451, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ AVOID_MEMSET_OPTIMIZE(void *);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void erase_area(void *addr, size_t size) {
  memset(addr, 0, size);
  AVOID_MEMSET_OPTIMIZE(addr);
}


x86 assembly (clang, -O0):
<erase_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
call   1040 <AVOID_MEMSET_OPTIMIZE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erase_area>:
push   %rbx
mov    %rsi,%rdx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <AVOID_MEMSET_OPTIMIZE@plt>

LLVM IR (-O0):
define void @erase_area(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @memset(i8* %5, i32 0, i64 %6)
%8 = load i8*, i8** %3
%9 = call i32 @AVOID_MEMSET_OPTIMIZE(i8* %8)
ret void
}

LLVM IR (-O2):
define void @erase_area(i8* %0, i64 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i64 %1)
%4 = tail call i32 @AVOID_MEMSET_OPTIMIZE(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ another_function(int *);
int /*<<< orphan*/ function_which_gives_up(int *);
scalar_t__ malloc(int);
void coverage4(int *x) {
  *x += another_function(x);
  function_which_gives_up(x);
  char *m = (char *)malloc(12);
}


x86 assembly (clang, -O0):
<coverage4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <another_function@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
add    %rdx,%rcx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <function_which_gives_up@plt>
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coverage4>:
push   %rbx
mov    %rdi,%rbx
call   1040 <another_function@plt>
add    %eax,(%rbx)
mov    %rbx,%rdi
call   1030 <function_which_gives_up@plt>
mov    $0xc,%edi
pop    %rbx
jmp    1050 <malloc@plt>

LLVM IR (-O0):
define void @coverage4(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i64 @another_function(i32* %4)
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
%9 = add nsw i64 %8, %5
%10 = trunc i64 %9 to i32
store i32 %10, i32* %6
%11 = load i32*, i32** %2
%12 = call i32 @function_which_gives_up(i32* %11)
%13 = call i64 @malloc(i32 12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %3
ret void
}

LLVM IR (-O2):
define void @coverage4(i32* %0) {
%2 = tail call i64 @another_function(i32* %0)
%3 = load i32, i32* %0
%4 = trunc i64 %2 to i32
%5 = add i32 %3, %4
store i32 %5, i32* %0
%6 = tail call i32 @function_which_gives_up(i32* %0)
%7 = tail call i64 @malloc(i32 12)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *extname(const char *filename) {
  const char *slash = strrchr(filename, '/');
  const char *loc = strrchr(slash ? slash : filename, '.');
  return loc ? loc : "";
}


x86 assembly (clang, -O0):
<extname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <extname+0x36>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    114e <extname+0x3e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1178 <extname+0x68>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1188 <extname+0x78>
lea    0xe81(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1188 <extname+0x78>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extname>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
cmovne %rax,%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
lea    0xec4(%rip),%rcx
cmove  %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @extname(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* %0, i8* %2
%5 = tail call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 46)
%6 = icmp eq i8* %5, null
%7 = select i1 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %5
ret i8* %7
}
void check_negative_sized_VLA_11_sub(int x) { int vla[x]; }


x86 assembly (clang, -O0):
<check_negative_sized_VLA_11_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @check_negative_sized_VLA_11_sub(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %3
%8 = alloca i32, i64 %6
store i64 %6, i64* %4
%9 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @check_negative_sized_VLA_11_sub(i32 %0) {
ret void
}
int half(int x) { return x / 2; }


x86 assembly (clang, -O0):
<half>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<half>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @half(i32 %0) {
%2 = sdiv i32 %0, 2
ret i32 %2
}
/* Type definitions */
struct bstree_node {
  int dummy;
};

/* Variables and functions */
struct bstree_node *get_left(struct bstree_node *);
struct bstree_node *get_first(struct bstree_node *node) {
  struct bstree_node *left;
  while ((left = get_left(node)))
    node = left;
  return node;
}


x86 assembly (clang, -O0):
<get_first>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_left@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1140 <get_first+0x30>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    111c <get_first+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_first>:
push   %rbx
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <get_left@plt>
test   %rax,%rax
jne    1120 <get_first+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.bstree_node = type { i32 }
define %struct.bstree_node* @get_first(%struct.bstree_node* %0) {
%2 = alloca %struct.bstree_node*
%3 = alloca %struct.bstree_node*
store %struct.bstree_node* %0, %struct.bstree_node** %2
br label %4
4: ; preds = %8, %1
%5 = load %struct.bstree_node*, %struct.bstree_node** %2
%6 = call %struct.bstree_node* @get_left(%struct.bstree_node* %5)
store %struct.bstree_node* %6, %struct.bstree_node** %3
%7 = icmp ne %struct.bstree_node* %6, null
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = load %struct.bstree_node*, %struct.bstree_node** %3
store %struct.bstree_node* %9, %struct.bstree_node** %2
br label %4
10: ; preds = %4
%11 = load %struct.bstree_node*, %struct.bstree_node** %2
ret %struct.bstree_node* %11
}

LLVM IR (-O2):
%struct.bstree_node = type { i32 }
define %struct.bstree_node* @get_first(%struct.bstree_node* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi %struct.bstree_node* [ %0, %1 ], [ %4, %2 ]
%4 = tail call %struct.bstree_node* @get_left(%struct.bstree_node* %3)
%5 = icmp eq %struct.bstree_node* %4, null
br i1 %5, label %6, label %2
6: ; preds = %2
ret %struct.bstree_node* %3
}
int foo(int *v, int A, int B) {
  int r = 0;
  int a = 2;
  int b = 4;
#pragma omp target map(to : v [a:b])
  r |= v[3];
#pragma omp target map(to : v [A:B])
  r |= v[3];
  return r;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    0xc(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32 %1, i32 %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void constants() {
  const int NUM = 5;
  printf("%d\n", NUM);
}


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

x86 assembly (clang, -O2):
<constants>:
lea    0xee9(%rip),%rdi
mov    $0x5,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @constants() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ install_pte(unsigned long *, int, void *, unsigned long);
void install_large_page(unsigned long *cr3, unsigned long phys, void *virt) {
  install_pte(cr3, 2, virt, phys | (1ull << 0) | (1ull << 1) | (1ull << 7));
}


x86 assembly (clang, -O0):
<install_large_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
or     $0x1,%rcx
or     $0x2,%rcx
or     $0x80,%rcx
mov    $0x2,%esi
call   1030 <install_pte@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<install_large_page>:
mov    %rsi,%rcx
or     $0x83,%rcx
mov    $0x2,%esi
jmp    1030 <install_pte@plt>

LLVM IR (-O0):
define void @install_large_page(i64* %0, i64 %1, i8* %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i8*
store i64* %0, i64** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i64*, i64** %4
%8 = load i8*, i8** %6
%9 = load i64, i64* %5
%10 = or i64 %9, 1
%11 = or i64 %10, 2
%12 = or i64 %11, 128
%13 = call i32 @install_pte(i64* %7, i32 2, i8* %8, i64 %12)
ret void
}

LLVM IR (-O2):
define void @install_large_page(i64* %0, i64 %1, i8* %2) {
%4 = or i64 %1, 131
%5 = tail call i32 @install_pte(i64* %0, i32 2, i8* %2, i64 %4)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int crc_reflect(int, int);
uint32_t crc_finalize(uint32_t crc) {
  return crc_reflect(crc, 32) ^ 0xffffffff;
}


x86 assembly (clang, -O0):
<crc_finalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%esi
call   1030 <crc_reflect@plt>
xor    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc_finalize>:
push   %rax
mov    $0x20,%esi
call   1030 <crc_reflect@plt>
not    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @crc_finalize(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @crc_reflect(i32 %3, i32 32)
%5 = xor i32 %4, -1
ret i32 %5
}

LLVM IR (-O2):
define i32 @crc_finalize(i32 %0) {
%2 = tail call i32 @crc_reflect(i32 %0, i32 32)
%3 = xor i32 %2, -1
ret i32 %3
}
/* Variables and functions */
char dir_sep_char();
char *path_from_slash(char *dir) {
  char sep = dir_sep_char();
  int i;
  for (i = 0; dir[i]; i++) {
    if (dir[i] == '/') {
      dir[i] = sep;
    }
  }
  return dir;
}


x86 assembly (clang, -O0):
<path_from_slash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <dir_sep_char@plt>
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1175 <path_from_slash+0x65>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1162 <path_from_slash+0x52>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1167 <path_from_slash+0x57>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <path_from_slash+0x1d>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_from_slash>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <dir_sep_char@plt>
mov    %rbx,%rcx
jmp    1126 <path_from_slash+0x16>
mov    %al,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x2f,%dl
je     1120 <path_from_slash+0x10>
test   %dl,%dl
jne    1122 <path_from_slash+0x12>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @path_from_slash(i8* returned %0) {
%2 = tail call signext i8 (...) @dir_sep_char()
br label %3
3: ; preds = %8, %1
%4 = phi i64 [ %9, %8 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %8 [
i8 0, label %10
i8 47, label %7
]
7: ; preds = %3
store i8 %2, i8* %5
br label %8
8: ; preds = %3, %7
%9 = add nuw i64 %4, 1
br label %3
10: ; preds = %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ StudentModel_modifyStudent(char *, char *, int, char *,
                                              char *, char *, char *);
void Controller_updateStudentInfo(char name[], char course[], int year,
                                  char studentNumber[], char newStudentNumber[],
                                  char subjects[], char grades[]) {
  StudentModel_modifyStudent(name, course, year, studentNumber,
                             newStudentNumber, subjects, grades);
  return;
}


x86 assembly (clang, -O0):
<Controller_updateStudentInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <StudentModel_modifyStudent@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Controller_updateStudentInfo>:
jmp    1030 <StudentModel_modifyStudent@plt>

LLVM IR (-O0):
define void @Controller_updateStudentInfo(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i8* %6, i8** %14
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = load i32, i32* %10
%18 = load i8*, i8** %11
%19 = load i8*, i8** %12
%20 = load i8*, i8** %13
%21 = load i8*, i8** %14
%22 = call i32 @StudentModel_modifyStudent(i8* %15, i8* %16, i32 %17, i8* %18, i8* %19, i8* %20, i8* %21)
ret void
}

LLVM IR (-O2):
define void @Controller_updateStudentInfo(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = tail call i32 @StudentModel_modifyStudent(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ SHA_DIGEST_LENGTH;
uint32_t BF_hashDataLen() { return SHA_DIGEST_LENGTH; }


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

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

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

LLVM IR (-O2):
@SHA_DIGEST_LENGTH = global i32 0
define i32 @BF_hashDataLen() {
%1 = load i32, i32* @SHA_DIGEST_LENGTH
ret i32 %1
}
void EthernetDefaultHandler() {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<EthernetDefaultHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <EthernetDefaultHandler+0x9>
jmp    1109 <EthernetDefaultHandler+0x9>

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

LLVM IR (-O0):
define void @EthernetDefaultHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @EthernetDefaultHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int shift = 3;
  int samples = 32;
  printf("%zu %zu %zu\n", (samples >> (shift)), (samples >> (shift - 1)),
         (samples >> (shift - 2)));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
movl   $0x20,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%ecx
sar    %cl,%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
sar    %cl,%edx
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
sar    %cl,%eax
mov    %eax,%ecx
lea    0xeb3(%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
mov    $0x4,%esi
mov    $0x8,%edx
mov    $0x10,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%zu %zu %zu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 3, i32* %1
store i32 32, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %1
%5 = ashr i32 %3, %4
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = sub nsw i32 %7, 1
%9 = ashr i32 %6, %8
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = sub nsw i32 %11, 2
%13 = ashr i32 %10, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %9, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%zu %zu %zu\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 4, i32 8, i32 16)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, int);
void _memory_unmap(void *ptr, size_t page_count) {
  munmap(ptr, 4096 * page_count);
}


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

x86 assembly (clang, -O2):
<_memory_unmap>:
shl    $0xc,%esi
jmp    1030 <munmap@plt>

LLVM IR (-O0):
define void @_memory_unmap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = mul i64 4096, %6
%8 = trunc i64 %7 to i32
%9 = call i32 @munmap(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @_memory_unmap(i8* %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl i32 %3, 12
%5 = tail call i32 @munmap(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mf_write_meta_event(int, char *, int);
void copy_metaseqnum(int seq) { mf_write_meta_event(0x00, (char *)seq, 2); }


x86 assembly (clang, -O0):
<copy_metaseqnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rsi
xor    %edi,%edi
mov    $0x2,%edx
call   1030 <mf_write_meta_event@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_metaseqnum>:
movslq %edi,%rsi
xor    %edi,%edi
mov    $0x2,%edx
jmp    1030 <mf_write_meta_event@plt>

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

LLVM IR (-O2):
define void @copy_metaseqnum(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @mf_write_meta_event(i32 0, i8* %3, i32 2)
ret void
}
void enter_generated_code(void *addr) {
  __asm__ __volatile__("jmp *%0" ::"r"(addr) :);
}


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

x86 assembly (clang, -O2):
<enter_generated_code>:
jmp    *%rdi
ret

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

LLVM IR (-O2):
define void @enter_generated_code(i8* %0) {
tail call void asm sideeffect "jmp *$0", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void zapSomeStack() {
  char buf[4096];
  memset(buf, 0, sizeof(buf));
}


x86 assembly (clang, -O0):
<zapSomeStack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1000,%rsp
lea    -0x1000(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1030 <memset@plt>
add    $0x1000,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zapSomeStack>:
sub    $0x1008,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1030 <memset@plt>
add    $0x1008,%rsp
ret

LLVM IR (-O0):
define void @zapSomeStack() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 4096)
ret void
}

LLVM IR (-O2):
define void @zapSomeStack() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 4096)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ callout_process(int);
int /*<<< orphan*/ usb_idle();
int /*<<< orphan*/ usb_init();
int /*<<< orphan*/ usb_uninit();
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  uint32_t time;
  usb_init();
  time = 0;
  while (1) {
    usb_idle();
    usleep(1000);
    if (++time >= (1000 / 1000)) {
      time = 0;
      callout_process(1);
    }
  }
  usb_uninit();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <usb_init@plt>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <usb_idle@plt>
mov    $0x3e8,%edi
call   1060 <usleep@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x1,%eax
jl     1198 <main+0x58>
movl   $0x0,-0x14(%rbp)
mov    $0x1,%edi
call   1040 <callout_process@plt>
jmp    1164 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <usb_init@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <usb_idle@plt>
mov    $0x3e8,%edi
call   1060 <usleep@plt>
mov    $0x1,%edi
call   1040 <callout_process@plt>
jmp    1150 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @usb_init()
store i32 0, i32* %6
br label %8
8: ; preds = %2, %16
%9 = call i32 (...) @usb_idle()
%10 = call i32 @usleep(i32 1000)
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
store i32 %12, i32* %6
%13 = icmp sge i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %8
store i32 0, i32* %6
%15 = call i32 @callout_process(i32 1)
br label %16
16: ; preds = %14, %8
br label %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @usb_init()
br label %4
4: ; preds = %4, %2
%5 = tail call i32 (...) @usb_idle()
%6 = tail call i32 @usleep(i32 1000)
%7 = tail call i32 @callout_process(i32 1)
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ scrputs(char *);
void scrclrdn(void) { scrputs("\033[1J"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[1J\00"
define void @scrclrdn() {
%1 = call i32 @scrputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[1J\00"
define void @scrclrdn() {
%1 = tail call i32 @scrputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
void _machine_check() { printf("Exception: %s\n", __FUNCTION__); }


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

x86 assembly (clang, -O2):
<_machine_check>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"Exception: %s\0A\00"
@__FUNCTION__._machine_check = [15 x i8] c"_machine_check\00"
define void @_machine_check() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__._machine_check, i64 0, i64 0))
ret void
}
/* Type definitions */
struct bst_table {
  int dummy;
};

/* Variables and functions */
void **bst_probe(struct bst_table *, void *);
void *bst_replace(struct bst_table *table, void *item) {
  void **p = bst_probe(table, item);
  if (p == NULL || *p == item)
    return NULL;
  else {
    void *r = *p;
    *p = item;
    return r;
  }
}


x86 assembly (clang, -O0):
<bst_replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <bst_probe@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     114d <bst_replace+0x3d>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jne    115a <bst_replace+0x4a>
movq   $0x0,-0x8(%rbp)
jmp    1178 <bst_replace+0x68>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bst_replace>:
push   %rbx
mov    %rsi,%rbx
call   1030 <bst_probe@plt>
test   %rax,%rax
je     112e <bst_replace+0x1e>
mov    %rax,%rcx
mov    (%rax),%rax
cmp    %rbx,%rax
je     112e <bst_replace+0x1e>
mov    %rbx,(%rcx)
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.bst_table = type { i32 }
define i8* @bst_replace(%struct.bst_table* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca %struct.bst_table*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
store %struct.bst_table* %0, %struct.bst_table** %4
store i8* %1, i8** %5
%8 = load %struct.bst_table*, %struct.bst_table** %4
%9 = load i8*, i8** %5
%10 = call i8** @bst_probe(%struct.bst_table* %8, i8* %9)
store i8** %10, i8*** %6
%11 = load i8**, i8*** %6
%12 = icmp eq i8** %11, null
br i1 %12, label %18, label %13
13: ; preds = %2
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
%16 = load i8*, i8** %5
%17 = icmp eq i8* %15, %16
br i1 %17, label %18, label %19
18: ; preds = %13, %2
store i8* null, i8** %3
br label %25
19: ; preds = %13
%20 = load i8**, i8*** %6
%21 = load i8*, i8** %20
store i8* %21, i8** %7
%22 = load i8*, i8** %5
%23 = load i8**, i8*** %6
store i8* %22, i8** %23
%24 = load i8*, i8** %7
store i8* %24, i8** %3
br label %25
25: ; preds = %19, %18
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
%struct.bst_table = type { i32 }
define i8* @bst_replace(%struct.bst_table* %0, i8* %1) {
%3 = tail call i8** @bst_probe(%struct.bst_table* %0, i8* %1)
%4 = icmp eq i8** %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
br i1 %7, label %9, label %8
8: ; preds = %5
store i8* %1, i8** %3
br label %9
9: ; preds = %2, %5, %8
%10 = phi i8* [ %6, %8 ], [ null, %5 ], [ null, %2 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
char get_SW0(void) {
  char buf[2];
  int SW0;
  SW0 = open("/dev/rtswitch0", O_RDONLY);
  read(SW0, buf, 2);
  close(SW0);
  return buf[0];
}


x86 assembly (clang, -O0):
<get_SW0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x2(%rbp),%rsi
mov    $0x2,%edx
call   1040 <read@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
movsbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_SW0>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
lea    0xebb(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
lea    0xe(%rsp),%rsi
mov    %eax,%edi
mov    $0x2,%edx
call   1040 <read@plt>
mov    %ebx,%edi
call   1030 <close@plt>
mov    0xe(%rsp),%al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/dev/rtswitch0\00"
@O_RDONLY = global i32 0
define signext i8 @get_SW0() {
%1 = alloca [2 x i8]
%2 = alloca i32
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%7 = call i32 @read(i32 %5, i8* %6, i32 2)
%8 = load i32, i32* %2
%9 = call i32 @close(i32 %8)
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%11 = load i8, i8* %10
ret i8 %11
}

LLVM IR (-O2):
@.str = [15 x i8] c"/dev/rtswitch0\00"
@O_RDONLY = global i32 0
define signext i8 @get_SW0() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @read(i32 %4, i8* %2, i32 2)
%6 = tail call i32 @close(i32 %4)
%7 = load i8, i8* %2
ret i8 %7
}
void free(void *ptr) {
  *((char *)ptr) = 0;
  return;
}


x86 assembly (clang, -O0):
<free>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<free>:
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @free(i8* nocapture writeonly %0) {
store i8 0, i8* %0
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int y;
};
struct TYPE_4__ {
  TYPE_1__ xexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xexpose_y(void *_p, int _v) {
  ((XEvent *)_p)->xexpose.y = (int)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xexpose_y>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XEvent_xexpose_y>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xexpose_y(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xexpose_y(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isalnum(char);
bool is_valid_query_ch(char ch) {
  switch (ch) {
  case '=':
  case '&':
  case '%':
    return true;
  default:
    if (isalnum(ch))
      return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<is_valid_query_ch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffdb,%eax
sub    $0x2,%eax
jb     1147 <is_valid_query_ch+0x37>
jmp    1136 <is_valid_query_ch+0x26>
mov    -0xc(%rbp),%eax
sub    $0x3d,%eax
jne    1153 <is_valid_query_ch+0x43>
jmp    1147 <is_valid_query_ch+0x37>
movl   $0x1,-0x4(%rbp)
jmp    117d <is_valid_query_ch+0x6d>
movsbl -0x5(%rbp),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
je     1171 <is_valid_query_ch+0x61>
movl   $0x1,-0x4(%rbp)
jmp    117d <is_valid_query_ch+0x6d>
jmp    1176 <is_valid_query_ch+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_query_ch>:
cmp    $0x3d,%edi
ja     112d <is_valid_query_ch+0x1d>
mov    $0x1,%eax
mov    %edi,%ecx
movabs $0x2000006000000000,%rdx
bt     %rcx,%rdx
jae    112d <is_valid_query_ch+0x1d>
ret
push   %rax
movsbl %dil,%edi
call   1030 <isalnum@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @is_valid_query_ch(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 61, label %6
i32 38, label %6
i32 37, label %6
]
6: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %14
7: ; preds = %1
%8 = load i8, i8* %3
%9 = call i32 @isalnum(i8 signext %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %14
12: ; preds = %7
br label %13
13: ; preds = %12
store i32 0, i32* %2
br label %14
14: ; preds = %13, %11, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @is_valid_query_ch(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %3 [
i32 61, label %7
i32 38, label %7
i32 37, label %7
]
3: ; preds = %1
%4 = tail call i32 @isalnum(i8 signext %0)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1, %1, %1
%8 = phi i32 [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ %6, %3 ]
ret i32 %8
}