xunge/DecIR huggingface dataset:
/* Type definitions */
struct slist_t {
  int dummy;
};
struct slist_item_t {
  int dummy;
};

/* Variables and functions */
struct slist_item_t *_bsearch_slist(char const *, struct slist_t const *, int);
struct slist_item_t *bsearch_slist_aux(const char *str,
                                       const struct slist_t *list) {
  return _bsearch_slist(str, list, 1);
}


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

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

LLVM IR (-O0):
%struct.slist_item_t = type { i32 }
%struct.slist_t = type { i32 }
define %struct.slist_item_t* @bsearch_slist_aux(i8* %0, %struct.slist_t* %1) {
%3 = alloca i8*
%4 = alloca %struct.slist_t*
store i8* %0, i8** %3
store %struct.slist_t* %1, %struct.slist_t** %4
%5 = load i8*, i8** %3
%6 = load %struct.slist_t*, %struct.slist_t** %4
%7 = call %struct.slist_item_t* @_bsearch_slist(i8* %5, %struct.slist_t* %6, i32 1)
ret %struct.slist_item_t* %7
}

LLVM IR (-O2):
%struct.slist_item_t = type { i32 }
%struct.slist_t = type { i32 }
define %struct.slist_item_t* @bsearch_slist_aux(i8* %0, %struct.slist_t* %1) {
%3 = tail call %struct.slist_item_t* @_bsearch_slist(i8* %0, %struct.slist_t* %1, i32 1)
ret %struct.slist_item_t* %3
}
/* Variables and functions */
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glRectf(float, float, float, float);
void display() {
  glClear(GL_COLOR_BUFFER_BIT);
  glRectf(-.5f, -.5f, .5f, .5f);
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movss  0xeb6(%rip),%xmm1
movss  0xeb2(%rip),%xmm3
movaps %xmm1,%xmm0
movaps %xmm3,%xmm2
call   1040 <glRectf@plt>
mov    $0x0,%al
call   1050 <glFlush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movss  0xeb9(%rip),%xmm0
movss  0xeb5(%rip),%xmm2
movaps %xmm0,%xmm1
movaps %xmm2,%xmm3
call   1040 <glRectf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = call i32 @glClear(i32 %1)
%3 = call i32 @glRectf(float -5.000000e-01, float -5.000000e-01, float 5.000000e-01, float 5.000000e-01)
%4 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = tail call i32 @glRectf(float -5.000000e-01, float -5.000000e-01, float 5.000000e-01, float 5.000000e-01)
%4 = tail call i32 (...) @glFlush()
ret void
}
/* Variables and functions */
char itoc(int);
char check_digit(unsigned int count) { return itoc((10 - (count % 10)) % 10); }


x86 assembly (clang, -O0):
<check_digit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    $0xa,%eax
sub    %edx,%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
call   1030 <itoc@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_digit>:
mov    %edi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%edi
mov    $0xa,%al
sub    %dil,%al
movzbl %al,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movzbl %al,%edi
jmp    1030 <itoc@plt>

LLVM IR (-O0):
define signext i8 @check_digit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = urem i32 %3, 10
%5 = sub i32 10, %4
%6 = urem i32 %5, 10
%7 = call signext i8 @itoc(i32 %6)
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @check_digit(i32 %0) {
%2 = urem i32 %0, 10
%3 = trunc i32 %2 to i8
%4 = sub nuw nsw i8 10, %3
%5 = urem i8 %4, 10
%6 = zext i8 %5 to i32
%7 = tail call signext i8 @itoc(i32 %6)
ret i8 %7
}
int test_imm_52uint16_reg(unsigned short val) {
  return ((val) & (0x52 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_52uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x52,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_52uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 82
%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_52uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 82
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned int CAM_CALDeviceName(char *DevName) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @CAM_CALDeviceName(i8* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
void *aligned_alloc(size_t, int);
int /*<<< orphan*/ handle_out_of_memory();
void *mem_unmanaged_allocate(size_t bytes) {
  void *memory = aligned_alloc(bytes, 8);
  if (!memory)
    handle_out_of_memory();
  return memory;
}


x86 assembly (clang, -O0):
<mem_unmanaged_allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1040 <aligned_alloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <mem_unmanaged_allocate+0x30>
mov    $0x0,%al
call   1030 <handle_out_of_memory@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_unmanaged_allocate>:
push   %rbx
mov    $0x8,%esi
call   1040 <aligned_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <mem_unmanaged_allocate+0x1a>
xor    %eax,%eax
call   1030 <handle_out_of_memory@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @mem_unmanaged_allocate(i64 %0) {
%2 = tail call dereferenceable_or_null(8) i8* @aligned_alloc(i64 %0, i32 8)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @handle_out_of_memory()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
void foo395() {}


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

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

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

LLVM IR (-O2):
define void @foo395() {
ret void
}
/* Variables and functions */
int foo(int);
int main(void) { return foo(1) + foo(2); }


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1030 <foo@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1030 <foo@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1)
%2 = tail call i32 @foo(i32 2)
%3 = add nsw i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ runAllTests_osijoin();
int main(void) {
  runAllTests_osijoin();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @runAllTests_osijoin()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @runAllTests_osijoin()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int logger_printf(char *buf, int buf_len) {
  FILE *fp;
  fp = fopen("/usrdata/tmp.log", "w+");
  fwrite(buf, 1, buf_len, fp);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<logger_printf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_printf>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/usrdata/tmp.log\00"
@.str.1 = [3 x i8] c"w+\00"
define i32 @logger_printf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %5
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = load i32*, i32** %5
%10 = call i32 @fwrite(i8* %7, i32 1, i32 %8, i32* %9)
%11 = load i32*, i32** %5
%12 = call i32 @fclose(i32* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"/usrdata/tmp.log\00"
@.str.1 = [3 x i8] c"w+\00"
define i32 @logger_printf(i8* nocapture %0, i32 %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @fwrite(i8* %0, i32 1, i32 %1, i32* %3)
%5 = tail call i32 @fclose(i32* %3)
ret i32 0
}
double wdcos(double *x) { double wdcos_(double *x); }


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

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

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

LLVM IR (-O2):
define double @wdcos(double* nocapture readnone %0) {
ret double undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *exe) {
  if (exe) {
    printf("\nUsage:\n");
    printf("%s <button_device>\n", exe);
  }
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1147 <usage+0x37>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
test   %rdi,%rdi
je     1147 <usage+0x27>
push   %rbx
mov    %rdi,%rbx
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\0AUsage:\0A\00"
@.str.1 = [20 x i8] c"%s <button_device>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%s <button_device>\0A\00"
@str = [8 x i8] c"\0AUsage:\00"
define void @usage(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ printf(char *);
void bar(void) {
  printf("bar, pre-foo!\n");
  foo();
  printf("bar, post-foo!\n");
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <foo@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <foo@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"bar, pre-foo!\0A\00"
@.str.1 = [16 x i8] c"bar, post-foo!\0A\00"
define void @bar() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @foo()
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"bar, pre-foo!\00"
@str.2 = [15 x i8] c"bar, post-foo!\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @foo()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
ret void
}
unsigned long long fac_intern(int n, unsigned long long akk) {
  if (n <= 1) {
    return akk;
  } else {
    return fac_intern(n - 1, akk * n);
  }
}


x86 assembly (clang, -O0):
<fac_intern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     1136 <fac_intern+0x26>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1151 <fac_intern+0x41>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x18(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   %rax,%rsi
call   1030 <fac_intern@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fac_intern>:
mov    %rsi,%rax
cmp    $0x2,%edi
jl     1121 <fac_intern+0x21>
mov    %edi,%ecx
nopw   0x0(%rax,%rax,1)
imul   %rcx,%rax
lea    -0x1(%rcx),%rdx
cmp    $0x2,%rcx
mov    %rdx,%rcx
ja     1110 <fac_intern+0x10>
ret

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

LLVM IR (-O2):
define i64 @fac_intern(i32 %0, i64 %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %9, %6 ]
%8 = phi i64 [ %1, %4 ], [ %10, %6 ]
%9 = add nsw i64 %7, -1
%10 = mul i64 %8, %7
%11 = icmp ult i64 %7, 3
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = phi i64 [ %1, %2 ], [ %10, %6 ]
ret i64 %13
}
/* Variables and functions */
int helper(int);
int numSquares1(int n) { return helper(n); }


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

x86 assembly (clang, -O2):
<numSquares1>:
jmp    1030 <helper@plt>

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

LLVM IR (-O2):
define i32 @numSquares1(i32 %0) {
%2 = tail call i32 @helper(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
gen_convert_primary_reg_value_to_bool() { gen_call("ccbool"); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"ccbool\00"
define i32 @gen_convert_primary_reg_value_to_bool() {
%1 = tail call i32 @gen_call(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int isoperator(char digito) {
  if ((digito == '+') || (digito == '-') || (digito == '*') || (digito == '^'))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isoperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     113e <isoperator+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
je     113e <isoperator+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     113e <isoperator+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x5e,%eax
jne    114a <isoperator+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <isoperator+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isoperator>:
add    $0xd6,%dil
cmp    $0x34,%dil
ja     1124 <isoperator+0x24>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x1000000000000b,%rdx
bt     %rcx,%rdx
jae    1124 <isoperator+0x24>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isoperator(i8 signext %0) {
switch i8 %0, label %2 [
i8 94, label %3
i8 45, label %3
i8 43, label %3
i8 42, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
double floor(double);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, double *);
double Floor(double a) {
  printf("Enter a decimal number: ");
  scanf("%lf", &a);
  return (floor(a));
}


x86 assembly (clang, -O0):
<Floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
call   1050 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Floor>:
push   %rax
movsd  %xmm0,(%rsp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
pop    %rax
jmp    1050 <floor@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Enter a decimal number: \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @Floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%5 = load double, double* %2
%6 = call double @llvm.floor.f64(double %5)
ret double %6
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter a decimal number: \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @Floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%5 = load double, double* %2
%6 = call double @llvm.floor.f64(double %5)
ret double %6
}
/* Variables and functions */
int binary_search(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int number;
  scanf("%d", &number);
  int array[] = {1, 2, 3, 5, 7, 20, 34, 56};
  printf("%d\n", binary_search(array, number, 8));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    0xeb3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x8,%edx
call   1040 <binary_search@plt>
mov    %eax,%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rdi
mov    $0x8,%edx
call   1040 <binary_search@plt>
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@__const.main.array = [8 x i32] [i32 1, i32 2, i32 3, i32 5, i32 7, i32 20, i32 34, i32 56]
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [8 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%9 = bitcast [8 x i32]* %7 to i8*
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%11 = load i32, i32* %6
%12 = call i32 @binary_search(i32* %10, i32 %11, i32 8)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@__const.main.array = [8 x i32] [i32 1, i32 2, i32 3, i32 5, i32 7, i32 20, i32 34, i32 56]
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [8 x i32]
%5 = bitcast i32* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = bitcast [8 x i32]* %4 to i8*
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @binary_search(i32* %8, i32 %9, i32 8)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void check_malloc(char *p) {
  if (p == NULL) {
    printf("Bellek ayirilamiyor!");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114d <check_malloc+0x2d>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_malloc>:
test   %rdi,%rdi
je     1126 <check_malloc+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Bellek ayirilamiyor!\00"
define void @check_malloc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Bellek ayirilamiyor!\00"
define void @check_malloc(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
ret void
}
/* Variables and functions */
void *malloc(long);
int /*<<< orphan*/ panic1(char *, int, char *, char *);
void *Marrayalloc(long size) {
  void *p;
  if (!(p = malloc(size)))
    panic1("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/tomgr/graphviz-cmake/refs/heads/master/"
           "cmd/lefty/mem.c",
           173, "Marrayallocate", "cannot allocate array");
  return p;
}


x86 assembly (clang, -O0):
<Marrayalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1162 <Marrayalloc+0x42>
lea    0xeb6(%rip),%rdi
mov    $0xad,%esi
lea    0xf3b(%rip),%rdx
lea    0xf43(%rip),%rcx
call   1030 <panic1@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Marrayalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114d <Marrayalloc+0x2d>
lea    0xecb(%rip),%rdi
lea    0xf55(%rip),%rdx
lea    0xf5d(%rip),%rcx
mov    $0xad,%esi
call   1030 <panic1@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tomgr/graphviz-cmake/refs/heads/master/cmd/lefty/mem.c\00"
@.str.1 = [15 x i8] c"Marrayallocate\00"
@.str.2 = [22 x i8] c"cannot allocate array\00"
define i8* @Marrayalloc(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 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @panic1(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 173, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tomgr/graphviz-cmake/refs/heads/master/cmd/lefty/mem.c\00"
@.str.1 = [15 x i8] c"Marrayallocate\00"
@.str.2 = [22 x i8] c"cannot allocate array\00"
define noalias i8* @Marrayalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @panic1(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 173, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
void RTS3GetBucketKeys(void) {}


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

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

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

LLVM IR (-O2):
define void @RTS3GetBucketKeys() {
ret void
}
void yyerror(const char *msg) { (void)msg; }


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

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

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

LLVM IR (-O2):
define void @yyerror(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ Get_Byte(int /*<<< orphan*/ *, int /*<<< orphan*/);
int32_t Abs_Get_Byte(int32_t address) { return Get_Byte(NULL, address); }


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

x86 assembly (clang, -O2):
<Abs_Get_Byte>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <Get_Byte@plt>

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

LLVM IR (-O2):
define i32 @Abs_Get_Byte(i32 %0) {
%2 = tail call i32 @Get_Byte(i32* null, i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char const *, int /*<<< orphan*/);
int open_config(const char *file) { return open(file, O_RDONLY); }


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

x86 assembly (clang, -O2):
<open_config>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @open_config(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @open_config(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
ret i32 %3
}
void _gfortran_caf_end_critical(void) {}


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

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

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

LLVM IR (-O2):
define void @_gfortran_caf_end_critical() {
ret void
}
/* Variables and functions */
int rand();
double rand1() { return (double)(rand() & 0x7FFFFFFF) / (double)0x7FFFFFFF; }


x86 assembly (clang, -O0):
<rand1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0x7fffffff,%eax
cvtsi2sd %eax,%xmm0
movsd  0xed4(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand1>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x7fffffff,%eax
cvtsi2sd %eax,%xmm0
divsd  0xed7(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rand1() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 2147483647
%3 = sitofp i32 %2 to double
%4 = fdiv double %3, 0x41DFFFFFFFC00000
ret double %4
}

LLVM IR (-O2):
define double @rand1() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 2147483647
%3 = sitofp i32 %2 to double
%4 = fdiv double %3, 0x41DFFFFFFFC00000
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int countWords(char[]);
  char line[81];
  printf("Write a line of text to count its words.\n");
  while (true) {
    printf("> ");
    gets(line);
    printf("\n  There are %i words.\n\n", countWords(line));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1040 <countWords@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%r14
mov    %rsp,%rbx
lea    0xe9d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1050 <countWords@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [42 x i8] c"Write a line of text to count its words.\0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [25 x i8] c"\0A There are %i words.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%9 = call i32 @countWords(i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %4
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [25 x i8] c"\0A There are %i words.\0A\0A\00"
@str = [41 x i8] c"Write a line of text to count its words.\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @gets(i8* %2)
%7 = call i32 @countWords(i8* %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %4
}
int FindMax(int x, int y) {
  if (x > y)
    return x;
  else
    return y;
}


x86 assembly (clang, -O0):
<FindMax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <FindMax+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <FindMax+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindMax>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @FindMax(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int error(char *msg, int n) {
  fprintf(stderr, "%s\n", msg);
  return n;
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @error(i8* %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %1
}
void hanoi(int n, char one, char two, char three) {
  void move(char x, char y);
  if (n == 1)
    move(one, three);
  else {
    hanoi(n - 1, one, three, two);
    move(one, three);
    hanoi(n - 1, two, one, three);
  }
}


x86 assembly (clang, -O0):
<hanoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1159 <hanoi+0x39>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x7(%rbp),%esi
call   1040 <move@plt>
jmp    119e <hanoi+0x7e>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x5(%rbp),%cl
mov    -0x7(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <hanoi@plt>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x7(%rbp),%esi
call   1040 <move@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x6(%rbp),%cl
mov    -0x5(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x7(%rbp),%ecx
call   1030 <hanoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hanoi>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
movsbl %cl,%r14d
cmp    $0x1,%edi
jne    1139 <hanoi+0x19>
mov    %r15d,%r12d
jmp    116b <hanoi+0x4b>
mov    %edi,%ebx
add    $0xffffffff,%ebx
xchg   %ax,%ax
mov    %edx,%r12d
movsbl %r15b,%ebp
movsbl %dl,%ecx
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <hanoi@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1040 <move@plt>
mov    %r15d,%edx
mov    %r12d,%r15d
add    $0xffffffff,%ebx
jne    1140 <hanoi+0x20>
movsbl %r12b,%edi
mov    %r14d,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <move@plt>

LLVM IR (-O0):
define void @hanoi(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i32 %0, i32* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i8, i8* %6
%13 = load i8, i8* %8
br label %27
14: ; preds = %4
%15 = load i32, i32* %5
%16 = sub nsw i32 %15, 1
%17 = load i8, i8* %6
%18 = load i8, i8* %8
%19 = load i8, i8* %7
%20 = load i8, i8* %6
%21 = load i8, i8* %8
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 1
%24 = load i8, i8* %7
%25 = load i8, i8* %6
%26 = load i8, i8* %8
br label %27
27: ; preds = %14, %11
ret void
}

LLVM IR (-O2):
define void @hanoi(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = icmp eq i32 %0, 1
br i1 %5, label %6, label %8
6: ; preds = %8, %4
%7 = phi i8 [ %1, %4 ], [ %9, %8 ]
tail call void @move(i8 signext %7, i8 signext %3)
ret void
8: ; preds = %4, %8
%9 = phi i8 [ %10, %8 ], [ %2, %4 ]
%10 = phi i8 [ %9, %8 ], [ %1, %4 ]
%11 = phi i32 [ %12, %8 ], [ %0, %4 ]
%12 = add nsw i32 %11, -1
tail call void @hanoi(i32 %12, i8 signext %10, i8 signext %3, i8 signext %9)
tail call void @move(i8 signext %10, i8 signext %3)
%13 = icmp eq i32 %12, 1
br i1 %13, label %6, label %8
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(struct tm *, struct tm const *, int);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
void copy_TM64_to_tm(const struct tm *src, struct tm *dest) {
  if (src == NULL) {
    memset(dest, 0, sizeof(*dest));
  } else {
    memcpy(dest, src, sizeof(*dest));
  }
}


x86 assembly (clang, -O0):
<copy_TM64_to_tm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1150 <copy_TM64_to_tm+0x30>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
jmp    1162 <copy_TM64_to_tm+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_TM64_to_tm>:
test   %rdi,%rdi
je     1138 <copy_TM64_to_tm+0x18>
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x4,%edx
jmp    1040 <memcpy@plt>
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x4,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @copy_TM64_to_tm(%struct.tm* %0, %struct.tm* %1) {
%3 = alloca %struct.tm*
%4 = alloca %struct.tm*
store %struct.tm* %0, %struct.tm** %3
store %struct.tm* %1, %struct.tm** %4
%5 = load %struct.tm*, %struct.tm** %3
%6 = icmp eq %struct.tm* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load %struct.tm*, %struct.tm** %4
%9 = call i32 @memset(%struct.tm* %8, i32 0, i32 4)
br label %14
10: ; preds = %2
%11 = load %struct.tm*, %struct.tm** %4
%12 = load %struct.tm*, %struct.tm** %3
%13 = call i32 @memcpy(%struct.tm* %11, %struct.tm* %12, i32 4)
br label %14
14: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @copy_TM64_to_tm(%struct.tm* %0, %struct.tm* %1) {
%3 = icmp eq %struct.tm* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @memset(%struct.tm* %1, i32 0, i32 4)
br label %8
6: ; preds = %2
%7 = tail call i32 @memcpy(%struct.tm* %1, %struct.tm* %0, i32 4)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int get_return_code();
__attribute__((visibility("default"))) int test_lib_bar_global(void) {
  return get_return_code();
}


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

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

LLVM IR (-O0):
define i32 @test_lib_bar_global() {
%1 = call i32 (...) @get_return_code()
ret i32 %1
}

LLVM IR (-O2):
define i32 @test_lib_bar_global() {
%1 = tail call i32 (...) @get_return_code()
ret i32 %1
}
/* Variables and functions */
scalar_t__ isalnum(int);
scalar_t__ ispunct(int);
int isgraph(int c) { return (isalnum(c) || ispunct(c)); }


x86 assembly (clang, -O0):
<isgraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1157 <isgraph+0x37>
mov    -0x4(%rbp),%edi
call   1040 <ispunct@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgraph>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <isgraph+0x17>
pop    %rbx
ret
mov    %ebx,%edi
call   1040 <ispunct@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isgraph(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isalnum(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i64 @ispunct(i32 %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isgraph(i32 %0) {
%2 = tail call i64 @isalnum(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @ispunct(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fwrite(void *, size_t, size_t, int /*<<< orphan*/ *);
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *input) {
  return fwrite(ptr, size, nmemb, input);
}


x86 assembly (clang, -O0):
<write_data>:
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),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_data>:
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define i64 @write_data(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i64 @fwrite(i8* %9, i64 %10, i64 %11, i32* %12)
ret i64 %13
}

LLVM IR (-O2):
define i64 @write_data(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
ret i64 %5
}
void hugo_stopsample(void) {}


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

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

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

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