xunge/DecIR huggingface dataset:
const char *__attribute__((weak)) __attribute__((long_call))
__attribute__((section(".test.c"))) __attribute__((no)) weak_l3(void) {
  return "weak_l3";
}


x86 assembly (clang, -O0):
<weak_l3>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<weak_l3>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"weak_l3\00"
define weak i8* @weak_l3() section ".test.c" {
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [8 x i8] c"weak_l3\00"
define weak i8* @weak_l3() section ".test.c" {
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
char *newDbSerializeDevsDev(int, int, int, char *);
char *newDbSerializeLamps(int MAXBUF, char *buf) {
  return newDbSerializeDevsDev(6, 6, MAXBUF, buf);
}


x86 assembly (clang, -O0):
<newDbSerializeLamps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x6,%esi
mov    %esi,%edi
call   1030 <newDbSerializeDevsDev@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newDbSerializeLamps>:
mov    %rsi,%rcx
mov    %edi,%edx
mov    $0x6,%edi
mov    $0x6,%esi
jmp    1030 <newDbSerializeDevsDev@plt>

LLVM IR (-O0):
define i8* @newDbSerializeLamps(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 = load i8*, i8** %4
%7 = call i8* @newDbSerializeDevsDev(i32 6, i32 6, i32 %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @newDbSerializeLamps(i32 %0, i8* %1) {
%3 = tail call i8* @newDbSerializeDevsDev(i32 6, i32 6, i32 %0, i8* %1)
ret i8* %3
}
void test_libsym1_1(void) {}


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

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

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

LLVM IR (-O2):
define void @test_libsym1_1() {
ret void
}
/* Variables and functions */
int foo(int *);
int bar(int i) {
  int big[50000];
  return foo(big) + 2;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d50,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x30d50(%rbp),%rdi
call   1030 <foo@plt>
add    $0x2,%eax
add    $0x30d50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
sub    $0x30d48,%rsp
mov    %rsp,%rdi
call   1030 <foo@plt>
add    $0x2,%eax
add    $0x30d48,%rsp
ret

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca [50000 x i32]
store i32 %0, i32* %2
%4 = getelementptr inbounds [50000 x i32], [50000 x i32]* %3, i64 0, i64 0
%5 = call i32 @foo(i32* %4)
%6 = add nsw i32 %5, 2
ret i32 %6
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = alloca [50000 x i32]
%3 = bitcast [50000 x i32]* %2 to i8*
%4 = getelementptr inbounds [50000 x i32], [50000 x i32]* %2, i64 0, i64 0
%5 = call i32 @foo(i32* %4)
%6 = add nsw i32 %5, 2
ret i32 %6
}
int lowercase(int ch) {
  if ('A' <= ch && ch <= 'Z')
    return ch - 'A' + 'a';
  return ch;
}


x86 assembly (clang, -O0):
<lowercase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jg     1130 <lowercase+0x30>
cmpl   $0x5a,-0x8(%rbp)
jg     1130 <lowercase+0x30>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <lowercase+0x36>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @lowercase(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
unsigned invert(unsigned x, int p, int n) {
  return x & (~(~0 << n) << (p + 1 - n));
}


x86 assembly (clang, -O0):
<invert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert>:
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shl    %cl,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @invert(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* %6
%9 = shl i32 -1, %8
%10 = xor i32 %9, -1
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %6
%14 = sub nsw i32 %12, %13
%15 = shl i32 %10, %14
%16 = and i32 %7, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @invert(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = add nsw i32 %1, 1
%7 = sub i32 %6, %2
%8 = shl i32 %5, %7
%9 = and i32 %8, %0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
pideDatos(int *semilla, int *numDatos) {
  printf("Introduce un número para al semilla: ");
  scanf("%d", semilla);
  printf("Introduce el número de datos:");
  scanf("%d", numDatos);
}


x86 assembly (clang, -O0):
<pideDatos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xee0(%rip),%rdi
call   1040 <scanf@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pideDatos>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Introduce un n\C3\BAmero para al semilla: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Introduce el n\C3\BAmero de datos:\00"
define i32 @pideDatos(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32*, i32** %5
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [39 x i8] c"Introduce un n\C3\BAmero para al semilla: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Introduce el n\C3\BAmero de datos:\00"
define i32 @pideDatos(i32* %0, i32* %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %0)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
ret i32 undef
}
int cmd_get_33() { return 1; }


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

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

LLVM IR (-O0):
define i32 @cmd_get_33() {
ret i32 1
}

LLVM IR (-O2):
define i32 @cmd_get_33() {
ret i32 1
}
/* Variables and functions */
int berechne_wievielter_tag_seit_beginn(int, int, int);
int ermittle_die_startspalte(int monat, int jahr) {
  int wievielter_tag = berechne_wievielter_tag_seit_beginn(1, monat, jahr);
  int startspalte = ((wievielter_tag % 7) + 6) % 7;
  return startspalte;
}


x86 assembly (clang, -O0):
<ermittle_die_startspalte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x1,%edi
call   1030 <berechne_wievielter_tag_seit_beginn@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x6,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ermittle_die_startspalte>:
push   %rax
mov    %esi,%edx
mov    %edi,%esi
mov    $0x1,%edi
call   1030 <berechne_wievielter_tag_seit_beginn@plt>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
add    $0x6,%cl
movzbl %cl,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ermittle_die_startspalte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @berechne_wievielter_tag_seit_beginn(i32 1, i32 %7, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = srem i32 %10, 7
%12 = add nsw i32 %11, 6
%13 = srem i32 %12, 7
store i32 %13, i32* %6
%14 = load i32, i32* %6
ret i32 %14
}

LLVM IR (-O2):
define i32 @ermittle_die_startspalte(i32 %0, i32 %1) {
%3 = tail call i32 @berechne_wievielter_tag_seit_beginn(i32 1, i32 %0, i32 %1)
%4 = srem i32 %3, 7
%5 = trunc i32 %4 to i8
%6 = add nsw i8 %5, 6
%7 = urem i8 %6, 7
%8 = zext i8 %7 to i32
ret i32 %8
}
/* Variables and functions */
int kill(int, int);
int send_signal(int pid, int signum) { return kill(pid, signum); }


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

x86 assembly (clang, -O2):
<send_signal>:
jmp    1030 <kill@plt>

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

LLVM IR (-O2):
define i32 @send_signal(i32 %0, i32 %1) {
%3 = tail call i32 @kill(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void *threadfunc(void *parm) {
  sleep(5);
  return NULL;
}


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

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

LLVM IR (-O0):
define i8* @threadfunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 5)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @threadfunc(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 5)
ret i8* null
}
/* Variables and functions */
size_t INT_MAX;
int size_t_to_int(size_t val) {
  if (val > INT_MAX) {
    return -1;
  } else {
    return (int)val;
  }
}


x86 assembly (clang, -O0):
<size_t_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ed5(%rip),%rcx
cmp    (%rcx),%rax
jbe    1128 <size_t_to_int+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    112f <size_t_to_int+0x2f>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_t_to_int>:
mov    0x2ee1(%rip),%rax
cmp    %rdi,(%rax)
mov    $0xffffffff,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
@INT_MAX = global i64 0
define i32 @size_t_to_int(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = load i64, i64* @INT_MAX
%6 = icmp ugt i64 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %11
8: ; preds = %1
%9 = load i64, i64* %3
%10 = trunc i64 %9 to i32
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define i32 @size_t_to_int(i64 %0) {
%2 = load i64, i64* @INT_MAX
%3 = icmp ult i64 %2, %0
%4 = trunc i64 %0 to i32
%5 = select i1 %3, i32 -1, i32 %4
ret i32 %5
}
int test_imm_C1int32_reg(int val) { return ((val) & (0xC1 << 0)) ? -20 : -40; }


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

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

LLVM IR (-O0):
define i32 @test_imm_C1int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 193
%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_C1int32_reg(i32 %0) {
%2 = and i32 %0, 193
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
void discard_line(FILE *fp) {
  int c;
  do {
    c = fgetc(fp);
    if (c == '\n')
      break;
  } while (c != EOF);
}


x86 assembly (clang, -O0):
<discard_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    1137 <discard_line+0x27>
jmp    114e <discard_line+0x3e>
jmp    113c <discard_line+0x2c>
mov    -0xc(%rbp),%eax
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%eax
jne    111c <discard_line+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<discard_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eca(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1132 <discard_line+0x22>
cmp    (%r14),%eax
jne    1120 <discard_line+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @discard_line(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %11, %1
%5 = load i32*, i32** %2
%6 = call i32 @fgetc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %4
br label %15
10: ; preds = %4
br label %11
11: ; preds = %10
%12 = load i32, i32* %3
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %4, label %15
15: ; preds = %11, %9
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @discard_line(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = icmp eq i32 %3, 10
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %3, %5
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %8, label %2
8: ; preds = %2
ret void
}
/* Type definitions */
struct token {
  int dummy;
};
struct compile_state {
  int dummy;
};

/* Variables and functions */
struct token *do_eat_token(struct compile_state *, int);
int /*<<< orphan*/ pp_peek(struct compile_state *);
struct token *pp_eat(struct compile_state *state, int tok) {
  pp_peek(state);
  return do_eat_token(state, tok);
}


x86 assembly (clang, -O0):
<pp_eat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pp_peek@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <do_eat_token@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.token = type { i32 }
%struct.compile_state = type { i32 }
define %struct.token* @pp_eat(%struct.compile_state* %0, i32 %1) {
%3 = alloca %struct.compile_state*
%4 = alloca i32
store %struct.compile_state* %0, %struct.compile_state** %3
store i32 %1, i32* %4
%5 = load %struct.compile_state*, %struct.compile_state** %3
%6 = call i32 @pp_peek(%struct.compile_state* %5)
%7 = load %struct.compile_state*, %struct.compile_state** %3
%8 = load i32, i32* %4
%9 = call %struct.token* @do_eat_token(%struct.compile_state* %7, i32 %8)
ret %struct.token* %9
}

LLVM IR (-O2):
%struct.token = type { i32 }
%struct.compile_state = type { i32 }
define %struct.token* @pp_eat(%struct.compile_state* %0, i32 %1) {
%3 = tail call i32 @pp_peek(%struct.compile_state* %0)
%4 = tail call %struct.token* @do_eat_token(%struct.compile_state* %0, i32 %1)
ret %struct.token* %4
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void *, size_t);
void sd_array_push(void *mem, size_t item_size, int *num_size, void *new_item) {
  memcpy((char *)mem + item_size * (*num_size), new_item, item_size);
  (*num_size)++;
}


x86 assembly (clang, -O0):
<sd_array_push>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
imul   %rcx,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_array_push>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdx
movslq (%rbx),%rax
imul   %rsi,%rax
add    %rax,%rdi
mov    %rcx,%rsi
call   1030 <memcpy@plt>
addl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @sd_array_push(i8* %0, i64 %1, i32* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i32*, i32** %7
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = mul i64 %10, %13
%15 = getelementptr inbounds i8, i8* %9, i64 %14
%16 = load i8*, i8** %8
%17 = load i64, i64* %6
%18 = call i32 @memcpy(i8* %15, i8* %16, i64 %17)
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = add nsw i32 %20, 1
store i32 %21, i32* %19
ret void
}

LLVM IR (-O2):
define void @sd_array_push(i8* %0, i64 %1, i32* nocapture %2, i8* %3) {
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %6, %1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @memcpy(i8* %8, i8* %3, i64 %1)
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int get_seq(int seq[]) {
  int i, m;
  scanf("%d", &m);
  for (i = 0; i < m; i++)
    scanf("%d", &seq[i]);
  return m;
}


x86 assembly (clang, -O0):
<get_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1168 <get_seq+0x58>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeab(%rip),%rdi
call   1030 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <get_seq+0x23>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_seq>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
lea    0xedd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    115d <get_seq+0x4d>
xor    %ebx,%ebx
lea    0xec2(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1140 <get_seq+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @get_seq(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %1, %7
%8 = phi i64 [ %11, %7 ], [ 0, %1 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = add nuw nsw i64 %8, 1
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %11, %13
br i1 %14, label %7, label %15
15: ; preds = %7, %1
%16 = phi i32 [ %5, %1 ], [ %12, %7 ]
ret i32 %16
}
int search(int key, int *base, int num) {
  int i;
  for (i = 0; i < num; i++)
    if (base[i] == key)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<search>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <search+0x53>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x8(%rbp),%eax
jne    1140 <search+0x40>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <search+0x5a>
jmp    1145 <search+0x45>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <search+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    111e <search+0x1e>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edi,(%rsi,%rcx,4)
je     111f <search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @search(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %1, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
int switch_odd_even_bits(int reg) {
  return (reg & 0xaaaaaaaa) >> 1 | (reg & 0x55555555) << 1;
}


x86 assembly (clang, -O0):
<switch_odd_even_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaaaaaa,%eax
shr    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x55555555,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<switch_odd_even_bits>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
and    $0xd5555555,%edi
lea    (%rax,%rdi,2),%eax
ret

LLVM IR (-O0):
define i32 @switch_odd_even_bits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -1431655766
%5 = lshr i32 %4, 1
%6 = load i32, i32* %2
%7 = and i32 %6, 1431655765
%8 = shl i32 %7, 1
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @switch_odd_even_bits(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = shl i32 %0, 1
%5 = and i32 %4, -1431655766
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
unsigned char SCCMallocLut(size_t size) { return 0; }


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

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

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

LLVM IR (-O2):
define zeroext i8 @SCCMallocLut(i64 %0) {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a, b;
  scanf("%d%d", &a, &b);
  printf("%d\n", a + b);
  while (1)
    continue;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    1155 <main+0x35>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
add    0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
nopl   0x0(%rax,%rax,1)
jmp    1150 <main+0x30>

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %0, %9
br label %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, %6
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %10, %0
br label %10
}
int test_imm_67uint32_mem(unsigned int *val) {
  return ((*val) & (0x67 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_67uint32_mem>:
testb  $0x67,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_67uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 103
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ syscall3(int, int, int);
void set_xy(char x, char y) { syscall3(514, (int)x, (int)y); }


x86 assembly (clang, -O0):
<set_xy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%esi
movsbl -0x2(%rbp),%edx
mov    $0x202,%edi
call   1030 <syscall3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_xy>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x202,%edi
jmp    1030 <syscall3@plt>

LLVM IR (-O0):
define void @set_xy(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = call i32 @syscall3(i32 514, i32 %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @set_xy(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
%4 = sext i8 %1 to i32
%5 = tail call i32 @syscall3(i32 514, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "Usage: test_getcwd "
                        " [<path> ...\n]");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: test_getcwd [<path> ...\0A]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: test_getcwd [<path> ...\0A]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
scalar_t__ dup2(int, int);
int /*<<< orphan*/ err(int, char *);
void xdup2(int fd1, int fd2) {
  if (dup2(fd1, fd2) < 0)
    err(1, "dup2");
}


x86 assembly (clang, -O0):
<xdup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <dup2@plt>
cmp    $0x0,%rax
jge    1154 <xdup2+0x34>
mov    $0x1,%edi
lea    0xeb1(%rip),%rsi
call   1040 <err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdup2>:
push   %rax
call   1030 <dup2@plt>
test   %rax,%rax
js     112d <xdup2+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rsi
mov    $0x1,%edi
pop    %rax
jmp    1040 <err@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"dup2\00"
define void @xdup2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i64 @dup2(i32 %5, i32 %6)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"dup2\00"
define void @xdup2(i32 %0, i32 %1) {
%3 = tail call i64 @dup2(i32 %0, i32 %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fd_nrf8001_disconnect_error(int);
int /*<<< orphan*/ fd_nrf8001_disconnect_success();
void fd_nrf8001_dispatch_disconnect_response(uint8_t status,
                                             uint8_t *response_data
                                             __attribute__((unused)),
                                             uint32_t response_data_length
                                             __attribute__((unused))) {
  if (status != 0x00) {
    fd_nrf8001_disconnect_error(status);
    return;
  }
  fd_nrf8001_disconnect_success();
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1149 <fd_nrf8001_dispatch_disconnect_response+0x29>
mov    -0x4(%rbp),%edi
call   1030 <fd_nrf8001_disconnect_error@plt>
jmp    1150 <fd_nrf8001_dispatch_disconnect_response+0x30>
mov    $0x0,%al
call   1040 <fd_nrf8001_disconnect_success@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
test   %edi,%edi
je     1129 <fd_nrf8001_dispatch_disconnect_response+0x9>
jmp    1030 <fd_nrf8001_disconnect_error@plt>
xor    %eax,%eax
jmp    1040 <fd_nrf8001_disconnect_success@plt>

LLVM IR (-O0):
define void @fd_nrf8001_dispatch_disconnect_response(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 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32, i32* %4
%11 = call i32 @fd_nrf8001_disconnect_error(i32 %10)
br label %14
12: ; preds = %3
%13 = call i32 (...) @fd_nrf8001_disconnect_success()
br label %14
14: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_dispatch_disconnect_response(i32 %0, i32* nocapture readnone %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @fd_nrf8001_disconnect_error(i32 %0)
br label %9
7: ; preds = %3
%8 = tail call i32 (...) @fd_nrf8001_disconnect_success()
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void PrintBite(int x) {
  if (x < 10) {
    printf("%c", '0' + x);
  } else {
    int y = x - 10;
    printf("%c", 'A' + y);
  }
}


x86 assembly (clang, -O0):
<PrintBite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    113f <PrintBite+0x2f>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
lea    0xece(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
jmp    115d <PrintBite+0x4d>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x41,%eax
lea    0xeab(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintBite>:
cmp    $0xa,%edi
mov    $0x30,%eax
mov    $0x37,%ecx
cmovl  %eax,%ecx
add    %dil,%cl
movsbl %cl,%esi
lea    0xed3(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @PrintBite(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = trunc i32 %0 to i8
%4 = select i1 %2, i8 48, i8 55
%5 = add i8 %4, %3
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %5)
ret void
}
char *get_cmdline(const char *args[]) {
  char *cat = ((void *)0);
  for (; *args != ((void *)0); args++)
    cat = av_stradd(cat, *args, " ", ((void *)0));
  return cat;
}


x86 assembly (clang, -O0):
<get_cmdline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1166 <get_cmdline+0x56>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xebc(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    $0x0,%al
call   1030 <av_stradd@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <get_cmdline+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cmdline>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rsi
test   %rsi,%rsi
je     114d <get_cmdline+0x3d>
mov    %rdi,%rbx
add    $0x8,%rbx
lea    0xed6(%rip),%r14
xor    %edi,%edi
nopl   0x0(%rax)
mov    %r14,%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <av_stradd@plt>
movslq %eax,%rdi
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <get_cmdline+0x20>
jmp    114f <get_cmdline+0x3f>
xor    %edi,%edi
mov    %rdi,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i8* @get_cmdline(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ null, %1 ]
%7 = phi i8** [ %11, %4 ], [ %0, %1 ]
%8 = tail call i32 (i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @av_stradd to i32 (i8*, i8*, i8*, i8*, ...)*)(i8* %6, i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* null)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = getelementptr inbounds i8*, i8** %7, i64 1
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = inttoptr i64 %9 to i8*
br label %16
16: ; preds = %14, %1
%17 = phi i8* [ null, %1 ], [ %15, %14 ]
ret i8* %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ swap_int(int *, int *);
int main(void) {
  int a;
  int b;
  a = 98;
  b = 42;
  printf("a=%d, b=%d\n", a, b);
  swap_int(&a, &b);
  printf("a=%d, b=%d\n", a, b);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x62,-0x8(%rbp)
movl   $0x2a,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <swap_int@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x62,0xc(%rsp)
movl   $0x2a,0x8(%rsp)
lea    0xec4(%rip),%rbx
mov    %rbx,%rdi
mov    $0x62,%esi
mov    $0x2a,%edx
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <swap_int@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 98, i32* %2
store i32 42, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = call i32 @swap_int(i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 98, i32* %1
store i32 42, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 98, i32 42)
%6 = call i32 @swap_int(i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
/* Variables and functions */
void *ft_memset(void *s, int c, size_t n) {
  unsigned char *s_cursor;
  s_cursor = (unsigned char *)s;
  while (n-- != 0)
    *s_cursor++ = (unsigned char)c;
  return (s);
}


x86 assembly (clang, -O0):
<ft_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     114b <ft_memset+0x4b>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    1117 <ft_memset+0x17>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_memset>:
push   %rbx
mov    %rdi,%rbx
test   %rdx,%rdx
je     1121 <ft_memset+0x11>
mov    %rbx,%rdi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @ft_memset(i8* returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %3
ret i8* %0
}
void *w_quick_sort_string_new() {
  char **key = (char **)malloc(sizeof(char *));
  return key;
}


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

x86 assembly (clang, -O2):
<w_quick_sort_string_new>:
mov    $0x8,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @w_quick_sort_string_new() {
%1 = alloca i8**
%2 = call i8* @malloc(i64 8)
%3 = bitcast i8* %2 to i8**
store i8** %3, i8*** %1
%4 = load i8**, i8*** %1
%5 = bitcast i8** %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define noalias i8* @w_quick_sort_string_new() {
%1 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void update_entropy(uint64_t symbol) {}


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

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

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

LLVM IR (-O2):
define void @update_entropy(i32 %0) {
ret void
}
void destroy_component_array(char **array) {
  char **current;
  for (current = array; *current; current++)
    free(*current);
  free(array);
}


x86 assembly (clang, -O0):
<destroy_component_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     114f <destroy_component_array+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <destroy_component_array+0x14>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy_component_array>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <destroy_component_array+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <destroy_component_array+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @destroy_component_array(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %8, %4 ], [ %2, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
tail call void @free(i8* %5)
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %4
10: ; preds = %4, %1
%11 = bitcast i8** %0 to i8*
tail call void @free(i8* %11)
ret void
}