xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void Handle(int sig) {
  printf("Application got SIGUSR1\n");
  exit(0);
}


x86 assembly (clang, -O0):
<Handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Handle>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Application got SIGUSR1\0A\00"
define void @Handle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [24 x i8] c"Application got SIGUSR1\00"
define void @Handle(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void seventeen(const int d) {
  printf("The radius of the circle is: %f.\n", d / 2.);
}


x86 assembly (clang, -O0):
<seventeen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seventeen>:
cvtsi2sd %edi,%xmm0
mulsd  0xee4(%rip),%xmm0
cvttsd2si %xmm0,%esi
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"The radius of the circle is: %f.\0A\00"
define void @seventeen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 2.000000e+00
%6 = fptosi double %5 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"The radius of the circle is: %f.\0A\00"
define void @seventeen(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 5.000000e-01
%4 = fptosi double %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(unsigned char *);
uint32_t spy_mach_read_from_4(unsigned char *b) {
  assert(b);
  return ((uint32_t)(b[0] << 24) | (uint32_t)(b[1] << 16) |
          (uint32_t)(b[2] << 8) | (uint32_t)(b[3]));
}


x86 assembly (clang, -O0):
<spy_mach_read_from_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spy_mach_read_from_4>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%eax
bswap  %eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @spy_mach_read_from_4(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = shl nuw i32 %4, 24
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl nuw nsw i32 %8, 16
%10 = or i32 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = or i32 %10, %14
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = or i32 %15, %18
ret i32 %19
}
/* Type definitions */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int Mystrlen(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char str[] = "Hello World";
  printf("%d\n", Mystrlen(str));
  printf("%d\n", (int)sizeof(str));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <Mystrlen@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,(%rsp)
movl   $0x646c72,0x8(%rsp)
mov    %rsp,%rdi
call   1040 <Mystrlen@plt>
lea    0xec2(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [12 x i8] c"Hello World\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = bitcast [12 x i8]* %1 to i8*
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = call i32 @Mystrlen(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [12 x i8] c"Hello World\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @Mystrlen(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 12)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
void clr_n_exit(int sig) {
  endwin();
  exit(sig);
}


x86 assembly (clang, -O0):
<clr_n_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <endwin@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<clr_n_exit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <endwin@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @clr_n_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @endwin()
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
define void @clr_n_exit(i32 %0) {
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_string(char const *);
void print_debug(const char *str) { console_tx_string(str); }


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

x86 assembly (clang, -O2):
<print_debug>:
jmp    1030 <console_tx_string@plt>

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

LLVM IR (-O2):
define void @print_debug(i8* %0) {
%2 = tail call i32 @console_tx_string(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ test_func();
int main(void) {
  int i = 0;
  while (1) {
    sleep(1);
    printf("%d: ", i++);
    test_func();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x8(%rbp)
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <test_func@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0x1(%rbx),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <test_func@plt>
mov    %ebp,%ebx
jmp    1140 <main+0x10>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d: \00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @sleep(i32 1)
%4 = add nuw nsw i32 %2, 1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 (...) @test_func()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: fallocate [-npt] [-o offset] -l length filename\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"Usage: fallocate [-npt] [-o offset] -l length filename\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [55 x i8] c"Usage: fallocate [-npt] [-o offset] -l length filename\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
void XtRealizeWidget() {}


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

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

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

LLVM IR (-O2):
define void @XtRealizeWidget() {
ret void
}
int dfs(int x) {
  if (x >= 0)
    return 5;
  return dfs(x + 1) + dfs(x + 2) + 1;
}


x86 assembly (clang, -O0):
<dfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1131 <dfs+0x21>
movl   $0x5,-0x4(%rbp)
jmp    1157 <dfs+0x47>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <dfs@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1030 <dfs@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dfs>:
mov    $0x5,%eax
test   %edi,%edi
js     111a <dfs+0xa>
ret
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x1(%rbx),%edi
call   1030 <dfs@plt>
mov    %eax,%r14d
add    $0x2,%ebx
mov    %ebx,%edi
call   1030 <dfs@plt>
add    %r14d,%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @dfs(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %11, %5 ], [ 5, %1 ]
ret i32 %4
5: ; preds = %1
%6 = add nsw i32 %0, 1
%7 = tail call i32 @dfs(i32 %6)
%8 = add nsw i32 %0, 2
%9 = tail call i32 @dfs(i32 %8)
%10 = add i32 %7, 1
%11 = add i32 %10, %9
br label %3
}
void deinitTLSsession() {}


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

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

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

LLVM IR (-O2):
define void @deinitTLSsession() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sig_intr(int signo) { printf("caughted sig_intr\n"); }


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

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

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

LLVM IR (-O2):
@str = [18 x i8] c"caughted sig_intr\00"
define void @sig_intr(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
int test_imm_91uint16_mem(unsigned short *val) {
  return ((*val) & (0x91 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_91uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 145
%7 = icmp ne i32 %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_91uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 145
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
scalar_t__ perfect_square(int);
scalar_t__ sqrt(double);
int pentagonal(uint32_t x) {
  uint32_t tmp = 24 * x + 1;
  return (perfect_square(tmp) && (uint32_t)sqrt((double)tmp) % 6 == 5);
}


x86 assembly (clang, -O0):
<pentagonal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x18,-0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <perfect_square@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     116a <pentagonal+0x4a>
cvtsi2sdl -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
cmp    $0x5,%edx
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pentagonal>:
push   %rbx
shl    $0x3,%edi
lea    (%rdi,%rdi,2),%ebx
or     $0x1,%ebx
mov    %ebx,%edi
call   1030 <perfect_square@plt>
test   %rax,%rax
je     1167 <pentagonal+0x47>
cvtsi2sd %ebx,%xmm0
call   1040 <sqrt@plt>
movslq %eax,%rcx
imul   $0x2aaaaaab,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
add    %edx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @pentagonal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 24, %4
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i64 @perfect_square(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %1
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to double
%13 = call i64 @sqrt(double %12)
%14 = trunc i64 %13 to i32
%15 = srem i32 %14, 6
%16 = icmp eq i32 %15, 5
br label %17
17: ; preds = %10, %1
%18 = phi i1 [ false, %1 ], [ %16, %10 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @pentagonal(i32 %0) {
%2 = mul nsw i32 %0, 24
%3 = or i32 %2, 1
%4 = tail call i64 @perfect_square(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %1
%7 = sitofp i32 %3 to double
%8 = tail call i64 @sqrt(double %7)
%9 = trunc i64 %8 to i32
%10 = srem i32 %9, 6
%11 = icmp eq i32 %10, 5
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %6, %1
%14 = phi i32 [ 0, %1 ], [ %12, %6 ]
ret i32 %14
}
int ld_bgt_mm2(long double *a1, long double *a2) {
  return !(__builtin_isgreater(*a1, *a2));
}


x86 assembly (clang, -O0):
<ld_bgt_mm2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    -0x10(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_bgt_mm2>:
fldt   (%rdi)
fldt   (%rsi)
xor    %eax,%eax
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setbe  %al
ret

LLVM IR (-O0):
define i32 @ld_bgt_mm2(x86_fp80* %0, x86_fp80* %1) {
%3 = alloca x86_fp80*
%4 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %3
store x86_fp80* %1, x86_fp80** %4
%5 = load x86_fp80*, x86_fp80** %3
%6 = load x86_fp80, x86_fp80* %5
%7 = load x86_fp80*, x86_fp80** %4
%8 = load x86_fp80, x86_fp80* %7
%9 = fcmp ogt x86_fp80 %6, %8
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @ld_bgt_mm2(x86_fp80* nocapture %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = load x86_fp80, x86_fp80* %1
%5 = fcmp ule x86_fp80 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
int absolute(int a) {
  if (a < 0) {
    a = -a;
  }
  return a;
}


x86 assembly (clang, -O0):
<absolute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1119 <absolute+0x19>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<absolute>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @absolute(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
store i32 %7, i32* %2
br label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @absolute(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int jiecheng(int);
int /*<<< orphan*/ printf(char *, int);
int main_(void) {
  printf("%d\n", jiecheng(3));
  return 0;
}


x86 assembly (clang, -O0):
<main_>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <jiecheng@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_>:
push   %rax
mov    $0x3,%edi
call   1030 <jiecheng@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main_() {
%1 = tail call i32 @jiecheng(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int fun1084() { return 1084; }


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

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

LLVM IR (-O0):
define i32 @fun1084() {
ret i32 1084
}

LLVM IR (-O2):
define i32 @fun1084() {
ret i32 1084
}
/* Type definitions */
struct mntent {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct mntent *getmntent_r(FILE *fp __attribute__((unused)),
                           struct mntent *mntbuf __attribute__((unused)),
                           char *buf __attribute__((unused)),
                           int buflen __attribute__((unused))) {
  return NULL;
}


x86 assembly (clang, -O0):
<getmntent_r>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mntent = type { i32 }
define %struct.mntent* @getmntent_r(i32* %0, %struct.mntent* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca %struct.mntent*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store %struct.mntent* %1, %struct.mntent** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret %struct.mntent* null
}

LLVM IR (-O2):
%struct.mntent = type { i32 }
define noalias %struct.mntent* @getmntent_r(i32* nocapture readnone %0, %struct.mntent* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret %struct.mntent* null
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *, char const *);
void die(const char *message) {
  if (errno) {
    perror(message);
  } else {
    printf("ERROR: %s", message);
  }
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
cmpq   $0x0,(%rax)
je     115b <die+0x2b>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
jmp    116b <die+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rsi
mov    0x2ea5(%rip),%rax
cmpq   $0x0,(%rax)
je     1153 <die+0x23>
mov    %rsi,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@errno = global i64 0
@.str = [10 x i8] c"ERROR: %s\00"
define void @die(i8* %0) {
%2 = load i64, i64* @errno
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @exit(i32 1)
unreachable
}
void pread64() {}


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

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

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

LLVM IR (-O2):
define void @pread64() {
ret void
}
unsigned int is_zero_uint(unsigned int val) { return (!(val)); }


x86 assembly (clang, -O0):
<is_zero_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_zero_uint>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_zero_uint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_zero_uint(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
double exp(double x) {}


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

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

LLVM IR (-O0):
define double @exp(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 @exp(double %0) {
ret double undef
}
void lcd_off(void) { (*((volatile unsigned long *)0x7F008084)) &= ~(1 << 0); }


x86 assembly (clang, -O0):
<lcd_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f008084,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffe,%rcx
mov    $0x7f008084,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_off>:
andq   $0xfffffffffffffffe,0x7f008084
7f fe
ret

LLVM IR (-O0):
define void @lcd_off() {
%1 = load volatile i64, i64* inttoptr (i64 2130739332 to i64*)
%2 = and i64 %1, -2
store volatile i64 %2, i64* inttoptr (i64 2130739332 to i64*)
ret void
}

LLVM IR (-O2):
define void @lcd_off() {
%1 = load volatile i64, i64* inttoptr (i64 2130739332 to i64*)
%2 = and i64 %1, -2
store volatile i64 %2, i64* inttoptr (i64 2130739332 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void panic(char *filename, int line) {
  (void)fprintf(stderr, "\n?Panic in line %d of file %s\n");
  (void)perror("Unespected UNIX error");
  abort();
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xec4(%rip),%rdi
call   1050 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<panic>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xed2(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"\0A?Panic in line %d of file %s\0A\00"
@.str.1 = [22 x i8] c"Unespected UNIX error\00"
define void @panic(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 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"\0A?Panic in line %d of file %s\0A\00"
@.str.1 = [22 x i8] c"Unespected UNIX error\00"
define void @panic(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @abort()
unreachable
}
int hexdigval(int c) {
  int val = -1;
  if ((c >= '0') && (c <= '9')) {
    val = c - '0';
  } else if ((c >= 'A') && (c <= 'F')) {
    val = 10 + (c - 'A');
  } else if ((c >= 'a') && (c <= 'f')) {
    val = 10 + (c - 'a');
  }
  return val;
}


x86 assembly (clang, -O0):
<hexdigval>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     1130 <hexdigval+0x30>
cmpl   $0x39,-0x4(%rbp)
jg     1130 <hexdigval+0x30>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    117f <hexdigval+0x7f>
cmpl   $0x41,-0x4(%rbp)
jl     1155 <hexdigval+0x55>
cmpl   $0x46,-0x4(%rbp)
jg     1155 <hexdigval+0x55>
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    117a <hexdigval+0x7a>
cmpl   $0x61,-0x4(%rbp)
jl     1175 <hexdigval+0x75>
cmpl   $0x66,-0x4(%rbp)
jg     1175 <hexdigval+0x75>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    117a <hexdigval+0x7a>
jmp    117f <hexdigval+0x7f>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdigval>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
jb     1127 <hexdigval+0x27>
lea    -0x41(%rdi),%eax
cmp    $0x5,%eax
ja     1116 <hexdigval+0x16>
add    $0xffffffc9,%edi
mov    %edi,%eax
ret
lea    -0x61(%rdi),%eax
add    $0xffffffa9,%edi
cmp    $0x6,%eax
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @hexdigval(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %3
br label %34
12: ; preds = %6, %1
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 70
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 65
%21 = add nsw i32 10, %20
store i32 %21, i32* %3
br label %33
22: ; preds = %15, %12
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 97
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %2
%27 = icmp sle i32 %26, 102
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 97
%31 = add nsw i32 10, %30
store i32 %31, i32* %3
br label %32
32: ; preds = %28, %25, %22
br label %33
33: ; preds = %32, %18
br label %34
34: ; preds = %33, %9
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @hexdigval(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add i32 %0, -65
%6 = icmp ult i32 %5, 6
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i32 %0, -55
br label %14
9: ; preds = %4
%10 = add i32 %0, -97
%11 = icmp ult i32 %10, 6
%12 = add nsw i32 %0, -87
%13 = select i1 %11, i32 %12, i32 -1
br label %14
14: ; preds = %1, %9, %7
%15 = phi i32 [ %8, %7 ], [ %13, %9 ], [ %2, %1 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ assert(size_t);
void *calloc(size_t, size_t);
int /*<<< orphan*/ oom();
void *lcalloc(size_t nmemb, size_t size) {
  void *ptr;
  assert(size);
  ptr = calloc(nmemb, size);
  if (ptr == NULL)
    oom();
  return ptr;
}


x86 assembly (clang, -O0):
<lcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116c <lcalloc+0x3c>
mov    $0x0,%al
call   1030 <oom@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115c <lcalloc+0x2c>
xor    %eax,%eax
call   1030 <oom@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @lcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i32 @assert(i64 %6)
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = call i8* @calloc(i64 %8, i64 %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (...) @oom()
br label %15
15: ; preds = %13, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define noalias i8* @lcalloc(i64 %0, i64 %1) {
%3 = tail call i32 @assert(i64 %1)
%4 = tail call i8* @calloc(i64 %0, i64 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @oom()
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *);
void *malloc(size_t);
void *emalloc(size_t size) {
  void *p;
  p = malloc(size);
  if (p == NULL) {
    fail("Unable to allocate memory");
  }
  return p;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <emalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <fail@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <emalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <fail@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Unable to allocate memory\00"
define i8* @emalloc(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 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @fail(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [26 x i8] c"Unable to allocate memory\00"
define noalias i8* @emalloc(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 @fail(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
struct student {
  int dummy;
};

/* Variables and functions */
struct student *allocate();
int /*<<< orphan*/ deallocate(struct student *);
int /*<<< orphan*/ generate(struct student *);
int /*<<< orphan*/ output(struct student *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ summary(struct student *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  struct student *stud = NULL;
  stud = allocate();
  generate(stud);
  output(stud);
  summary(stud);
  deallocate(stud);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1080 <allocate@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <generate@plt>
mov    -0x10(%rbp),%rdi
call   1030 <output@plt>
mov    -0x10(%rbp),%rdi
call   1070 <summary@plt>
mov    -0x10(%rbp),%rdi
call   1050 <deallocate@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1080 <allocate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <generate@plt>
mov    %rbx,%rdi
call   1030 <output@plt>
mov    %rbx,%rdi
call   1070 <summary@plt>
mov    %rbx,%rdi
call   1050 <deallocate@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.student = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.student*
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
store %struct.student* null, %struct.student** %2
%5 = call %struct.student* (...) @allocate()
store %struct.student* %5, %struct.student** %2
%6 = load %struct.student*, %struct.student** %2
%7 = call i32 @generate(%struct.student* %6)
%8 = load %struct.student*, %struct.student** %2
%9 = call i32 @output(%struct.student* %8)
%10 = load %struct.student*, %struct.student** %2
%11 = call i32 @summary(%struct.student* %10)
%12 = load %struct.student*, %struct.student** %2
%13 = call i32 @deallocate(%struct.student* %12)
ret i32 0
}

LLVM IR (-O2):
%struct.student = type { i32 }
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call %struct.student* (...) @allocate()
%4 = tail call i32 @generate(%struct.student* %3)
%5 = tail call i32 @output(%struct.student* %3)
%6 = tail call i32 @summary(%struct.student* %3)
%7 = tail call i32 @deallocate(%struct.student* %3)
ret i32 0
}
void SekSetRealTAS(int use_real) {}


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

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

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

LLVM IR (-O2):
define void @SekSetRealTAS(i32 %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool __filt_even(void *cc, void *k, void *v) { return !(*(uint32_t *)v % 2); }


x86 assembly (clang, -O0):
<__filt_even>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__filt_even>:
mov    (%rdx),%eax
not    %eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @__filt_even(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = load i32, i32* %4
%6 = and i32 %5, 1
%7 = xor i32 %6, 1
ret i32 %7
}
/* Variables and functions */
scalar_t__ mal_malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *strsave(char *s) {
  char *p;
  p = (char *)mal_malloc(strlen(s) + 1);
  if (p != NULL)
    strcpy(p, s);
  return p;
}


x86 assembly (clang, -O0):
<strsave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <mal_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <strsave+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsave>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <mal_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <strsave+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strsave(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @mal_malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
br label %15
15: ; preds = %11, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @strsave(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @mal_malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
void SHA384_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @SHA384_Init() {
ret void
}
/* Variables and functions */
int sleep(int);
__attribute__((visibility("hidden"))) int SYS_Sleep(int iTimeVal) {
  return sleep(iTimeVal);
}


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

x86 assembly (clang, -O2):
<SYS_Sleep>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define hidden i32 @SYS_Sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void showVersion(void) {
  printf("Version: "
         "0.1"
         "\n"
         "Build date: "
         "Mar 16 2022"
         ", "
         "07:07:23"
         "\n"
         "Compiled by: "
         "<+AUTHOR+>"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [72 x i8] c"Version: 0.1\0ABuild date: Mar 16 2022, 07:07:23\0ACompiled by: <+AUTHOR+>\0A\00"
define void @showVersion() {
%1 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [71 x i8] c"Version: 0.1\0ABuild date: Mar 16 2022, 07:07:23\0ACompiled by: <+AUTHOR+>\00"
define void @showVersion() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int calc_offset(unsigned int pos) {
  unsigned int size = sizeof(unsigned char);
  return pos / size;
}


x86 assembly (clang, -O0):
<calc_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @calc_offset(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = udiv i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @calc_offset(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
float eval(int, int);
float density(int x, int y) {
  float result;
  result = eval(x, y);
  result = result / 5.0;
  return result;
}


x86 assembly (clang, -O0):
<density>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <eval@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec1(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<density>:
push   %rax
call   1030 <eval@plt>
divss  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @density(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call float @eval(i32 %6, i32 %7)
store float %8, float* %5
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = fdiv double %10, 5.000000e+00
%12 = fptrunc double %11 to float
store float %12, float* %5
%13 = load float, float* %5
ret float %13
}

LLVM IR (-O2):
define float @density(i32 %0, i32 %1) {
%3 = tail call float @eval(i32 %0, i32 %1)
%4 = fdiv float %3, 5.000000e+00
ret float %4
}
/* Type definitions */
struct sigaction {
  int /*<<< orphan*/ sa_flags;
  int /*<<< orphan*/ sa_mask;
  void *sa_handler;
};

/* Variables and functions */
int /*<<< orphan*/ SA_NODEFER;
int /*<<< orphan*/ sigaction(int, struct sigaction *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void mysignal(int signo, void *handler) {
  struct sigaction action;
  action.sa_handler = handler;
  sigemptyset(&action.sa_mask);
  action.sa_flags = SA_NODEFER;
  sigaction(signo, &action, 0);
}


x86 assembly (clang, -O0):
<mysignal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
add    $0x4,%rdi
call   1040 <sigemptyset@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysignal>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %rsi,0x8(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %rsp,%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigaction = type { i32, i32, i8* }
@SA_NODEFER = global i32 0
define void @mysignal(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 2
store i8* %6, i8** %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 1
%9 = call i32 @sigemptyset(i32* %8)
%10 = load i32, i32* @SA_NODEFER
%11 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
store i32 %10, i32* %11
%12 = load i32, i32* %3
%13 = call i32 @sigaction(i32 %12, %struct.sigaction* %5, i32 0)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32, i32, i8* }
@SA_NODEFER = global i32 0
define void @mysignal(i32 %0, i8* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 2
store i8* %1, i8** %5
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 1
%7 = call i32 @sigemptyset(i32* %6)
%8 = load i32, i32* @SA_NODEFER
%9 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store i32 %8, i32* %9
%10 = call i32 @sigaction(i32 %0, %struct.sigaction* %3, i32 0)
ret void
}