xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ GL_FLAT;
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glShadeModel(int /*<<< orphan*/);
void lines_init(void) {
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glShadeModel(GL_FLAT);
}


x86 assembly (clang, -O0):
<lines_init>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1030 <glClearColor@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <glShadeModel@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lines_init>:
push   %rax
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   1030 <glClearColor@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <glShadeModel@plt>

LLVM IR (-O0):
@GL_FLAT = global i32 0
define void @lines_init() {
%1 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%2 = load i32, i32* @GL_FLAT
%3 = call i32 @glShadeModel(i32 %2)
ret void
}

LLVM IR (-O2):
@GL_FLAT = global i32 0
define void @lines_init() {
%1 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%2 = load i32, i32* @GL_FLAT
%3 = tail call i32 @glShadeModel(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int fileExists(char *fileName) { return access(fileName, R_OK) == 0; }


x86 assembly (clang, -O0):
<fileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileExists>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@R_OK = global i32 0
define i32 @fileExists(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @R_OK
%5 = call i64 @access(i8* %3, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@R_OK = global i32 0
define i32 @fileExists(i8* nocapture %0) {
%2 = load i32, i32* @R_OK
%3 = tail call i64 @access(i8* %0, i32 %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ calloc(unsigned int, int);
void *MXAlloc(unsigned int nSize) { return (void *)calloc(nSize, 1); }


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

x86 assembly (clang, -O2):
<MXAlloc>:
mov    $0x1,%esi
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @MXAlloc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @calloc(i32 %3, i32 1)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @MXAlloc(i32 %0) {
%2 = tail call i64 @calloc(i32 %0, i32 1)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello World !\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello World !\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int foo() {
  int a = -100;
  while (a < 0)
    a++;
  a -= 77;
  while (a < 0)
    a += 3;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0xffffff9c,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1123 <foo+0x23>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110b <foo+0xb>
mov    -0x8(%rbp),%eax
sub    $0x4d,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1144 <foo+0x44>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <foo+0x2c>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
store i32 -100, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 77
store i32 %11, i32* %2
br label %12
12: ; preds = %15, %9
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 3
store i32 %17, i32* %2
br label %12
18: ; preds = %12
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 undef
}
int test_imm_B7uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xB7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B7uint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0xb7,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_B7uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 785979015168
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
void Default_UARTE2_SPIM2_SPIS2_TWIM2_TWIS2_IRQHandler(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @Default_UARTE2_SPIM2_SPIS2_TWIM2_TWIS2_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
char const *Timidity_ErrorMsg();
const char *DLL_ErrorMsg() { return Timidity_ErrorMsg(); }


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

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

LLVM IR (-O0):
define i8* @DLL_ErrorMsg() {
%1 = call i8* (...) @Timidity_ErrorMsg()
ret i8* %1
}

LLVM IR (-O2):
define i8* @DLL_ErrorMsg() {
%1 = tail call i8* (...) @Timidity_ErrorMsg()
ret i8* %1
}
void troca(int a, int b) {
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}


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

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

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

LLVM IR (-O2):
define void @troca(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int strlen(char *);
int action_hash(void *vstr) {
  char *str = vstr;
  int len = strlen(str);
  return (len * str[0]) % 200;
}


x86 assembly (clang, -O0):
<action_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
imul   %ecx,%eax
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<action_hash>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movsbl (%rbx),%ecx
imul   %eax,%ecx
movslq %ecx,%rax
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0xc8,%ecx,%ecx
sub    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @action_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = mul nsw i32 %8, %12
%14 = srem i32 %13, 200
ret i32 %14
}

LLVM IR (-O2):
define i32 @action_hash(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = mul nsw i32 %2, %4
%6 = srem i32 %5, 200
ret i32 %6
}
/* Variables and functions */
char *graph_strerror(int);
char const *strerror(int);
char const *graph_xstrerror(int err) {
  char const *st = graph_strerror(err);
  if (st != NULL)
    return st;
  return strerror(err);
}


x86 assembly (clang, -O0):
<graph_xstrerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <graph_strerror@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114f <graph_xstrerror+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <graph_xstrerror+0x3b>
mov    -0xc(%rbp),%edi
call   1040 <strerror@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graph_xstrerror>:
push   %rbx
mov    %edi,%ebx
call   1030 <graph_strerror@plt>
test   %rax,%rax
je     112f <graph_xstrerror+0xf>
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1040 <strerror@plt>

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

LLVM IR (-O2):
define i8* @graph_xstrerror(i32 %0) {
%2 = tail call i8* @graph_strerror(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @strerror(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ %2, %1 ]
ret i8* %7
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
float stdlib_strided_sminabs(int, float *, int);
int main() {
  float x[] = {1.0, -2.0, -3.0, 4.0, -5.0, -6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  float v = stdlib_strided_sminabs(N, x, stride);
  printf("minabs: %f\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1040 <stdlib_strided_sminabs@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_sminabs@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x float] [float 1.000000e+00, float -2.000000e+00, float -3.000000e+00, float 4.000000e+00, float -5.000000e+00, float -6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [12 x i8] c"minabs: %f\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast [8 x float]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call float @stdlib_strided_sminabs(i32 %6, float* %7, i32 %8)
store float %9, float* %4
%10 = load float, float* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x float] [float 1.000000e+00, float -2.000000e+00, float -3.000000e+00, float 4.000000e+00, float -5.000000e+00, float -6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [12 x i8] c"minabs: %f\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = bitcast [8 x float]* %1 to i8*
%3 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%4 = call float @stdlib_strided_sminabs(i32 4, float* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), float %4)
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ printf(char *, void *);
void *verbose_malloc(size_t size) {
  void *p = malloc(size);
  printf("Allocated %p.\n", p);
  return p;
}


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

x86 assembly (clang, -O2):
<verbose_malloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xed0(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"Allocated %p.\0A\00"
define i8* @verbose_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void bailout(const char *msg, const char *arg) {
  fprintf(stderr, "logger: %s %s\n", msg, arg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<bailout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bailout>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"logger: %s %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @bailout(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"logger: %s %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @bailout(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
unsigned isLeapYear(unsigned year) {
  if ((year % 100) == 0) {
    if ((year % 400) == 0)
      return 0;
    else
      return 1;
  } else if ((year % 4) == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1149 <isLeapYear+0x49>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    113d <isLeapYear+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    116b <isLeapYear+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    116b <isLeapYear+0x6b>
mov    -0x8(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
jne    1164 <isLeapYear+0x64>
movl   $0x1,-0x4(%rbp)
jmp    116b <isLeapYear+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeapYear>:
imul   $0xc28f5c29,%edi,%eax
mov    %eax,%ecx
ror    $0x2,%ecx
cmp    $0x28f5c28,%ecx
jbe    111e <isLeapYear+0x1e>
test   $0x3,%dil
sete   %al
movzbl %al,%eax
ret
ror    $0x4,%eax
cmp    $0xa3d70b,%eax
setae  %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isLeapYear(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = urem i32 %4, 100
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = urem i32 %8, 400
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 0, i32* %2
br label %19
12: ; preds = %7
store i32 1, i32* %2
br label %19
13: ; preds = %1
%14 = load i32, i32* %3
%15 = urem i32 %14, 4
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %2
br label %19
18: ; preds = %13
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17, %12, %11
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
%2 = urem i32 %0, 100
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = urem i32 %0, 400
%6 = icmp ne i32 %5, 0
br label %10
7: ; preds = %1
%8 = and i32 %0, 3
%9 = icmp eq i32 %8, 0
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ %6, %4 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int format_devices(char **, int, int);
int recovery_format(char **args, int num_args) {
  return format_devices(args, num_args, 1);
}


x86 assembly (clang, -O0):
<recovery_format>:
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    $0x1,%edx
call   1030 <format_devices@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recovery_format>:
mov    $0x1,%edx
jmp    1030 <format_devices@plt>

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

LLVM IR (-O2):
define i32 @recovery_format(i8** %0, i32 %1) {
%3 = tail call i32 @format_devices(i8** %0, i32 %1, i32 1)
ret i32 %3
}
swap(char *v[], int i, int j) {
  char *temp = v[i];
  v[i] = v[j];
  v[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rcx
movslq %edx,%rdx
mov    (%rdi,%rdx,8),%rsi
mov    %rsi,(%rdi,%rax,8)
mov    %rcx,(%rdi,%rdx,8)
ret

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

LLVM IR (-O2):
define i32 @swap(i8** nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
store i8* %9, i8** %5
store i8* %6, i8** %8
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
unsigned int ones32(int);
unsigned int lzc(uint32_t w) {
  w |= (w >> 1);
  w |= (w >> 2);
  w |= (w >> 4);
  w |= (w >> 8);
  w |= (w >> 16);
  return (32 - ones32(w));
}


x86 assembly (clang, -O0):
<lzc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ones32@plt>
mov    %eax,%ecx
mov    $0x20,%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lzc>:
push   %rax
mov    %edi,%eax
sar    %eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x2,%eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x4,%eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x8,%eax
or     %eax,%edi
mov    %edi,%eax
sar    $0x10,%eax
or     %eax,%edi
call   1030 <ones32@plt>
mov    $0x20,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @lzc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = ashr i32 %7, 2
%9 = load i32, i32* %2
%10 = or i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 4
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 8
%17 = load i32, i32* %2
%18 = or i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = ashr i32 %19, 16
%21 = load i32, i32* %2
%22 = or i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = call i32 @ones32(i32 %23)
%25 = sub i32 32, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @lzc(i32 %0) {
%2 = ashr i32 %0, 1
%3 = or i32 %2, %0
%4 = ashr i32 %3, 2
%5 = or i32 %4, %3
%6 = ashr i32 %5, 4
%7 = or i32 %6, %5
%8 = ashr i32 %7, 8
%9 = or i32 %8, %7
%10 = ashr i32 %9, 16
%11 = or i32 %10, %9
%12 = tail call i32 @ones32(i32 %11)
%13 = sub i32 32, %12
ret i32 %13
}
/* Variables and functions */
unsigned long pdp_invert(unsigned long l) {
  unsigned short *s = &l;
  return (s[0] << 16) + s[1];
}


x86 assembly (clang, -O0):
<pdp_invert>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
shl    $0x10,%eax
mov    -0x10(%rbp),%rcx
movzwl 0x2(%rcx),%ecx
add    %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdp_invert>:
rol    $0x10,%edi
movslq %edi,%rax
ret

LLVM IR (-O0):
define i64 @pdp_invert(i64 %0) {
%2 = alloca i64
%3 = alloca i16*
store i64 %0, i64* %2
%4 = bitcast i64* %2 to i16*
store i16* %4, i16** %3
%5 = load i16*, i16** %3
%6 = getelementptr inbounds i16, i16* %5, i64 0
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = shl i32 %8, 16
%10 = load i16*, i16** %3
%11 = getelementptr inbounds i16, i16* %10, i64 1
%12 = load i16, i16* %11
%13 = zext i16 %12 to i32
%14 = add nsw i32 %9, %13
%15 = sext i32 %14 to i64
ret i64 %15
}

LLVM IR (-O2):
define i64 @pdp_invert(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 16)
%4 = sext i32 %3 to i64
ret i64 %4
}
int zzzstrlen(char *str) {
  if (str[1] == 0)
    return 2;
  else
    return 10;
}


x86 assembly (clang, -O0):
<zzzstrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1125 <zzzstrlen+0x25>
movl   $0x2,-0x4(%rbp)
jmp    112c <zzzstrlen+0x2c>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zzzstrlen>:
xor    %eax,%eax
cmpb   $0x0,0x1(%rdi)
setne  %al
lea    0x2(,%rax,8),%eax
ret

LLVM IR (-O0):
define i32 @zzzstrlen(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 2, i32* %2
br label %11
10: ; preds = %1
store i32 10, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @zzzstrlen(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 2, i32 10
ret i32 %5
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int c, nl;
  nl = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      nl = nl + 1;
    }
  }
  printf("%d\n", nl);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1167 <main+0x47>
cmpl   $0xa,-0x8(%rbp)
jne    1162 <main+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
cmp    (%r14),%eax
je     1156 <main+0x36>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1140 <main+0x20>
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ %1, %0 ]
%6 = phi i32 [ %9, %4 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 10
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %6, %8
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %0
%14 = phi i32 [ 0, %0 ], [ %9, %4 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Directory scan of /home:\n");
  printf("/home/aurelien/\n");
  printf("done.\n");
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Directory scan of /home:\0A\00"
@.str.1 = [17 x i8] c"/home/aurelien/\0A\00"
@.str.2 = [7 x i8] c"done.\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"Directory scan of /home:\00"
@str.3 = [16 x i8] c"/home/aurelien/\00"
@str.4 = [6 x i8] c"done.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ z_stream;

/* Variables and functions */
int /*<<< orphan*/ Z_FINISH;
int deflate(int /*<<< orphan*/ *, int /*<<< orphan*/);
int streaming_commons_call_deflate_finish(z_stream *stream) {
  return deflate(stream, Z_FINISH);
}


x86 assembly (clang, -O0):
<streaming_commons_call_deflate_finish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <deflate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<streaming_commons_call_deflate_finish>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <deflate@plt>

LLVM IR (-O0):
@Z_FINISH = global i32 0
define i32 @streaming_commons_call_deflate_finish(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @Z_FINISH
%5 = call i32 @deflate(i32* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@Z_FINISH = global i32 0
define i32 @streaming_commons_call_deflate_finish(i32* %0) {
%2 = load i32, i32* @Z_FINISH
%3 = tail call i32 @deflate(i32* %0, i32 %2)
ret i32 %3
}
int set_bit(int number, int bit) { return number | (1 << bit); }


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %edi,%eax
bts    %esi,%eax
ret

LLVM IR (-O0):
define i32 @set_bit(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 = shl i32 1, %6
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @set_bit(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = or i32 %3, %0
ret i32 %4
}
/* Variables and functions */
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ perror_reply(int, char *);
int /*<<< orphan*/ reply(int, char *);
void makedir(char *name) {
  if (mkdir(name, 0777) < 0)
    perror_reply(550, name);
  else
    reply(257, "MKD command successful.");
}


x86 assembly (clang, -O0):
<makedir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jge    1167 <makedir+0x37>
mov    -0x8(%rbp),%rsi
mov    $0x226,%edi
call   1050 <perror_reply@plt>
jmp    1178 <makedir+0x48>
mov    $0x101,%edi
lea    0xe8d(%rip),%rsi
call   1040 <reply@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makedir>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
js     1155 <makedir+0x25>
lea    0xeb6(%rip),%rsi
mov    $0x101,%edi
pop    %rbx
jmp    1040 <reply@plt>
mov    $0x226,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <perror_reply@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"MKD command successful.\00"
define void @makedir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mkdir(i8* %3, i32 511)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @perror_reply(i32 550, i8* %7)
br label %11
9: ; preds = %1
%10 = call i32 @reply(i32 257, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"MKD command successful.\00"
define void @makedir(i8* %0) {
%2 = tail call i64 @mkdir(i8* %0, i32 511)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror_reply(i32 550, i8* %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @reply(i32 257, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
sideeffect() { abort(); }


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

x86 assembly (clang, -O2):
<sideeffect>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @sideeffect() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define i32 @sideeffect() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ put8(unsigned char);
void jne_rj(unsigned char saut) {
  put8(0x75);
  put8(saut);
}


x86 assembly (clang, -O0):
<jne_rj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x75,%edi
call   1030 <put8@plt>
movzbl -0x1(%rbp),%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jne_rj>:
push   %rbx
mov    %edi,%ebx
mov    $0x75,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @jne_rj(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @put8(i8 zeroext 117)
%4 = load i8, i8* %2
%5 = call i32 @put8(i8 zeroext %4)
ret void
}

LLVM IR (-O2):
define void @jne_rj(i8 zeroext %0) {
%2 = tail call i32 @put8(i8 zeroext 117)
%3 = tail call i32 @put8(i8 zeroext %0)
ret void
}
void file3() { printf("Control in function %s\n", __func__); }


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

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

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

LLVM IR (-O2):
@.str = [24 x i8] c"Control in function %s\0A\00"
@__func__.file3 = [6 x i8] c"file3\00"
define void @file3() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.file3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test4();
int main() { test4(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test4()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test4()
ret i32 0
}
void some_other_func(void) { return; }


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

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

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

LLVM IR (-O2):
define void @some_other_func() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int print_usage() {
  printf(" Usage: asp_sequence [options]\n");
  printf(" Option:\n");
  printf(" \t[ -s <vector size> ] (default: %d)\n", 1024);
  return 1;
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x400,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c" Usage: asp_sequence [options]\0A\00"
@.str.1 = [10 x i8] c" Option:\0A\00"
@.str.2 = [38 x i8] c" \09[ -s <vector size> ] (default: %d)\0A\00"
define i32 @print_usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 1024)
ret i32 1
}

LLVM IR (-O2):
@.str.2 = [38 x i8] c" \09[ -s <vector size> ] (default: %d)\0A\00"
@str = [31 x i8] c" Usage: asp_sequence [options]\00"
@str.3 = [9 x i8] c" Option:\00"
define i32 @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 1024)
ret i32 1
}
void kill_crypto_locks(void) {}


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

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

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

LLVM IR (-O2):
define void @kill_crypto_locks() {
ret void
}
/* Variables and functions */
int ejtag_switch(int, long);
int mips_ejtag_write_h(unsigned int addr, unsigned int data) {
  int cmd[2];
  addr &= 0x1fffffff;
  cmd[0] = addr;
  cmd[1] = data;
  return ejtag_switch(0x2010, (long)cmd);
}


x86 assembly (clang, -O0):
<mips_ejtag_write_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1fffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rsi
mov    $0x2010,%edi
call   1030 <ejtag_switch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_ejtag_write_h>:
push   %rax
and    $0x1fffffff,%edi
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x2010,%edi
call   1030 <ejtag_switch@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mips_ejtag_write_h(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = and i32 %6, 536870911
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 %10, i32* %11
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%13 = ptrtoint i32* %12 to i64
%14 = call i32 @ejtag_switch(i32 8208, i64 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @mips_ejtag_write_h(i32 %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = and i32 %0, 536870911
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %5, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %1, i32* %7
%8 = ptrtoint [2 x i32]* %3 to i64
%9 = call i32 @ejtag_switch(i32 8208, i64 %8)
ret i32 %9
}
/* Variables and functions */
int function(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  scanf("%d", &a);
  printf("%d\n", function(a));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @function(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIOCSIFNETMASK;
int /*<<< orphan*/ do_ip_set(char *, int /*<<< orphan*/, char *);
void do_ip_mask_set(char *p) { do_ip_set(p, SIOCSIFNETMASK, "netmask"); }


x86 assembly (clang, -O0):
<do_ip_mask_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
lea    0xed0(%rip),%rdx
call   1030 <do_ip_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_ip_mask_set>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdx
jmp    1030 <do_ip_set@plt>

LLVM IR (-O0):
@SIOCSIFNETMASK = global i32 0
@.str = [8 x i8] c"netmask\00"
define void @do_ip_mask_set(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @SIOCSIFNETMASK
%5 = call i32 @do_ip_set(i8* %3, i32 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIOCSIFNETMASK = global i32 0
@.str = [8 x i8] c"netmask\00"
define void @do_ip_mask_set(i8* %0) {
%2 = load i32, i32* @SIOCSIFNETMASK
%3 = tail call i32 @do_ip_set(i8* %0, i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RegWriteA(int, int);
void AfDrvSw(unsigned char UcDrvSw) {
  if (UcDrvSw == 0x01) {
    RegWriteA(0x0081, 0x10);
    RegWriteA(0x00A0, 0x80);
  } else {
    RegWriteA(0x00A0, 0x00);
  }
}


x86 assembly (clang, -O0):
<AfDrvSw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    114e <AfDrvSw+0x3e>
mov    $0x81,%edi
mov    $0x10,%esi
call   1030 <RegWriteA@plt>
mov    $0xa0,%edi
mov    $0x80,%esi
call   1030 <RegWriteA@plt>
jmp    115a <AfDrvSw+0x4a>
mov    $0xa0,%edi
xor    %esi,%esi
call   1030 <RegWriteA@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AfDrvSw>:
xor    %esi,%esi
cmp    $0x1,%dil
jne    1131 <AfDrvSw+0x21>
push   %rax
mov    $0x81,%edi
mov    $0x10,%esi
call   1030 <RegWriteA@plt>
mov    $0x80,%esi
add    $0x8,%rsp
mov    $0xa0,%edi
jmp    1030 <RegWriteA@plt>

LLVM IR (-O0):
define void @AfDrvSw(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @RegWriteA(i32 129, i32 16)
%8 = call i32 @RegWriteA(i32 160, i32 128)
br label %11
9: ; preds = %1
%10 = call i32 @RegWriteA(i32 160, i32 0)
br label %11
11: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
define void @AfDrvSw(i8 zeroext %0) {
%2 = icmp eq i8 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @RegWriteA(i32 129, i32 16)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 128, %3 ], [ 0, %1 ]
%7 = tail call i32 @RegWriteA(i32 160, i32 %6)
ret void
}
void tegra_tsc_wait_for_resume(void) {}


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

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

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

LLVM IR (-O2):
define void @tegra_tsc_wait_for_resume() {
ret void
}
void XCirculateSubwindows() {}


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

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

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

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