xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ rcc_printf(char *, ...);
void emit_frame(int sz) {
  rcc_printf("  push {fp,lr}\n");
  if (sz > 0)
    rcc_printf("  add fp, sp, $4\n"
               "  sub sp, $%d\n",
               sz);
}


x86 assembly (clang, -O0):
<emit_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    1144 <emit_frame+0x34>
mov    -0x4(%rbp),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_frame>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <rcc_printf@plt>
test   %ebx,%ebx
jle    1136 <emit_frame+0x26>
lea    0xee4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <rcc_printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c" push {fp,lr}\0A\00"
@.str.1 = [32 x i8] c" add fp, sp, $4\0A sub sp, $%d\0A\00"
define void @emit_frame(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c" push {fp,lr}\0A\00"
@.str.1 = [32 x i8] c" add fp, sp, $4\0A sub sp, $%d\0A\00"
define void @emit_frame(i32 %0) {
%2 = tail call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_IPV6;
int /*<<< orphan*/ IPV6_V6ONLY;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              char *, int);
void set_dualstack_mode(int fd) {
  int mode;
  mode = 0;
  setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&mode, sizeof(mode));
}


x86 assembly (clang, -O0):
<set_dualstack_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_dualstack_mode>:
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rax
ret

LLVM IR (-O0):
@IPPROTO_IPV6 = global i32 0
@IPV6_V6ONLY = global i32 0
define void @set_dualstack_mode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_IPV6
%6 = load i32, i32* @IPV6_V6ONLY
%7 = bitcast i32* %3 to i8*
%8 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i8* %7, i32 4)
ret void
}

LLVM IR (-O2):
@IPPROTO_IPV6 = global i32 0
@IPV6_V6ONLY = global i32 0
define void @set_dualstack_mode(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = load i32, i32* @IPPROTO_IPV6
%5 = load i32, i32* @IPV6_V6ONLY
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i8* %3, i32 4)
ret void
}
int test_imm_DCuint16_reg(unsigned short val) {
  return ((val) & (0xDC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_DCuint16_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, 220
%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_DCuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 220
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct maze {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ maze_cell_exists(struct maze *, int, int);
int maze_get_cell(struct maze *, int, int);
int maze_cell_visited(struct maze *mp, int row, int col) {
  if (!maze_cell_exists(mp, row, col))
    return 1;
  return !!(maze_get_cell(mp, row, col) & 0x08000000);
}


x86 assembly (clang, -O0):
<maze_cell_visited>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <maze_cell_exists@plt>
cmp    $0x0,%eax
jne    1156 <maze_cell_visited+0x36>
movl   $0x1,-0x4(%rbp)
jmp    117c <maze_cell_visited+0x5c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <maze_get_cell@plt>
and    $0x8000000,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maze_cell_visited>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <maze_cell_exists@plt>
test   %eax,%eax
je     114a <maze_cell_visited+0x2a>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <maze_get_cell@plt>
shr    $0x1b,%eax
and    $0x1,%eax
jmp    114f <maze_cell_visited+0x2f>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.maze = type { i32 }
define i32 @maze_cell_visited(%struct.maze* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.maze*
%6 = alloca i32
%7 = alloca i32
store %struct.maze* %0, %struct.maze** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load %struct.maze*, %struct.maze** %5
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @maze_cell_exists(%struct.maze* %8, i32 %9, i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %3
store i32 1, i32* %4
br label %24
14: ; preds = %3
%15 = load %struct.maze*, %struct.maze** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = call i32 @maze_get_cell(%struct.maze* %15, i32 %16, i32 %17)
%19 = and i32 %18, 134217728
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
store i32 %23, i32* %4
br label %24
24: ; preds = %14, %13
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
%struct.maze = type { i32 }
define i32 @maze_cell_visited(%struct.maze* %0, i32 %1, i32 %2) {
%4 = tail call i32 @maze_cell_exists(%struct.maze* %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @maze_get_cell(%struct.maze* %0, i32 %1, i32 %2)
%8 = lshr i32 %7, 27
%9 = and i32 %8, 1
br label %10
10: ; preds = %3, %6
%11 = phi i32 [ %9, %6 ], [ 1, %3 ]
ret i32 %11
}
/* Variables and functions */
int f4();
int f3() {
  int x;
  x = f4();
  return 3 + x;
}


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

x86 assembly (clang, -O2):
<f3>:
push   %rax
xor    %eax,%eax
call   1030 <f4@plt>
add    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f3() {
%1 = alloca i32
%2 = call i32 (...) @f4()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = add nsw i32 3, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @f3() {
%1 = tail call i32 (...) @f4()
%2 = add nsw i32 %1, 3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void poll_close(int poll_fd) { close(poll_fd); }


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

x86 assembly (clang, -O2):
<poll_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @poll_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
void vararg(int i, ...) { (void)i; }


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

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

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

LLVM IR (-O2):
define void @vararg(i32 %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vide();
int main() {
  vide();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @vide()
ret i32 0
}
/* Variables and functions */
scalar_t__ isalpha(unsigned char);
int usable(unsigned char c) { return isalpha(c) || (c == ' ') || (c >= 0x80); }


x86 assembly (clang, -O0):
<usable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115a <usable+0x4a>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     115a <usable+0x4a>
movzbl -0x1(%rbp),%eax
cmp    $0x80,%eax
setge  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usable>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalpha@plt>
mov    %ebx,%ecx
shr    $0x7,%cl
test   %rax,%rax
movzbl %cl,%eax
mov    $0x1,%ecx
cmovne %ecx,%eax
cmp    $0x20,%bl
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @usable(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isalpha(i8 zeroext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 32
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp sge i32 %12, 128
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @usable(i8 zeroext %0) {
%2 = tail call i64 @isalpha(i8 zeroext %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i8 %0, 32
%5 = or i1 %4, %3
%6 = lshr i8 %0, 7
%7 = zext i8 %6 to i32
%8 = select i1 %5, i32 1, i32 %7
ret i32 %8
}
/* Variables and functions */
char *calloc(size_t, int);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *g_strndup(const char *str, size_t n) {
  char *res = calloc(n + 1, 1);
  strncpy(res, str, n);
  return res;
}


x86 assembly (clang, -O0):
<g_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @g_strndup(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @calloc(i64 %3, i32 1)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i64 %1)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t hostb_l(uint32_t value) { return ntohl(value); }


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

x86 assembly (clang, -O2):
<hostb_l>:
jmp    1030 <ntohl@plt>

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

LLVM IR (-O2):
define i32 @hostb_l(i32 %0) {
%2 = tail call i32 @ntohl(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_make_udp_socket_low_delay() {
  printf("NOT IMPLEMENTED:"
         "pa_make_udp_socket_low_delay"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [46 x i8] c"NOT IMPLEMENTED:pa_make_udp_socket_low_delay\0A\00"
define i32 @pa_make_udp_socket_low_delay() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [45 x i8] c"NOT IMPLEMENTED:pa_make_udp_socket_low_delay\00"
define i32 @pa_make_udp_socket_low_delay() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
double sum_omp_tasks_threshold(double *, int, int);
double sum_omp(double *v, int low, int high) {
  double s = 0;
#pragma omp parallel
  {
#pragma omp single nowait
    s = sum_omp_tasks_threshold(v, low, high);
  }
  return s;
}


x86 assembly (clang, -O0):
<sum_omp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <sum_omp_tasks_threshold@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_omp>:
jmp    1030 <sum_omp_tasks_threshold@plt>

LLVM IR (-O0):
define double @sum_omp(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %7
%8 = load double*, double** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call double @sum_omp_tasks_threshold(double* %8, i32 %9, i32 %10)
store double %11, double* %7
%12 = load double, double* %7
ret double %12
}

LLVM IR (-O2):
define double @sum_omp(double* %0, i32 %1, i32 %2) {
%4 = tail call double @sum_omp_tasks_threshold(double* %0, i32 %1, i32 %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ errno;
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ send_errno(int /*<<< orphan*/);
int /*<<< orphan*/ send_success();
void do_mv(int argc, char **argv) {
  assert(argc == 2);
  if (rename(argv[0], argv[1]) == 0)
    send_success();
  else
    send_errno(errno);
}


x86 assembly (clang, -O0):
<do_mv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1050 <rename@plt>
cmp    $0x0,%rax
jne    118a <do_mv+0x4a>
mov    $0x0,%al
call   1040 <send_success@plt>
jmp    1198 <do_mv+0x58>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1060 <send_errno@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_mv>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x2,%edi
sete   %al
mov    %eax,%edi
call   1030 <assert@plt>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
call   1050 <rename@plt>
test   %rax,%rax
je     1173 <do_mv+0x33>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1060 <send_errno@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <send_success@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @do_mv(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @rename(i8* %11, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @send_success()
br label %22
19: ; preds = %2
%20 = load i32, i32* @errno
%21 = call i32 @send_errno(i32 %20)
br label %22
22: ; preds = %19, %17
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @do_mv(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @rename(i8* %6, i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 (...) @send_success()
br label %16
13: ; preds = %2
%14 = load i32, i32* @errno
%15 = tail call i32 @send_errno(i32 %14)
br label %16
16: ; preds = %13, %11
ret void
}
unsigned long hpt_hash(unsigned long vpn, int large) {
  unsigned long vsid;
  unsigned long page;
  if (large) {
    vsid = vpn >> 4;
    page = vpn & 0xf;
  } else {
    vsid = vpn >> 16;
    page = vpn & 0xffff;
  }
  return (vsid & 0x7fffffffff) ^ page;
}


x86 assembly (clang, -O0):
<hpt_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1132 <hpt_hash+0x32>
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0xf,%rax
mov    %rax,-0x20(%rbp)
jmp    114c <hpt_hash+0x4c>
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
mov    %rax,-0x20(%rbp)
movabs $0x7fffffffff,%rax
and    -0x18(%rbp),%rax
xor    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hpt_hash>:
test   %esi,%esi
mov    $0x10,%eax
mov    $0x4,%ecx
cmove  %eax,%ecx
mov    $0xffff,%eax
mov    $0xf,%edx
cmove  %eax,%edx
mov    %rdi,%rsi
shr    %cl,%rsi
and    %edi,%edx
movabs $0x7fffffffff,%rax
and    %rsi,%rax
xor    %rdx,%rax
ret

LLVM IR (-O0):
define i64 @hpt_hash(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i64, i64* %3
%11 = lshr i64 %10, 4
store i64 %11, i64* %5
%12 = load i64, i64* %3
%13 = and i64 %12, 15
store i64 %13, i64* %6
br label %19
14: ; preds = %2
%15 = load i64, i64* %3
%16 = lshr i64 %15, 16
store i64 %16, i64* %5
%17 = load i64, i64* %3
%18 = and i64 %17, 65535
store i64 %18, i64* %6
br label %19
19: ; preds = %14, %9
%20 = load i64, i64* %5
%21 = and i64 %20, 549755813887
%22 = load i64, i64* %6
%23 = xor i64 %21, %22
ret i64 %23
}

LLVM IR (-O2):
define i64 @hpt_hash(i64 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i64 16, i64 4
%5 = lshr i64 %0, %4
%6 = select i1 %3, i64 65535, i64 15
%7 = and i64 %6, %0
%8 = and i64 %5, 549755813887
%9 = xor i64 %8, %7
ret i64 %9
}
signed long long int slifibonacci(signed long long int n) {
  if (n < 3)
    return 1;
  else
    return (slifibonacci(n - 1) + slifibonacci(n - 2));
}


x86 assembly (clang, -O0):
<slifibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x3,-0x10(%rbp)
jge    1134 <slifibonacci+0x24>
movq   $0x1,-0x8(%rbp)
jmp    1160 <slifibonacci+0x50>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <slifibonacci@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <slifibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slifibonacci>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmp    $0x3,%rdi
jl     114a <slifibonacci+0x3a>
mov    %rdi,%rbx
add    $0x2,%rbx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
lea    -0x3(%rbx),%rdi
call   1030 <slifibonacci@plt>
add    %rax,%r14
add    $0xfffffffffffffffe,%rbx
cmp    $0x4,%rbx
ja     1130 <slifibonacci+0x20>
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @slifibonacci(i64 %0) {
%2 = icmp slt i64 %0, 3
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i64 %4, -1
%7 = tail call i64 @slifibonacci(i64 %6)
%8 = add nsw i64 %4, -2
%9 = add nsw i64 %7, %5
%10 = icmp ult i64 %4, 5
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i64 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i64 [ 1, %1 ], [ %12, %11 ]
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ rc_findvar(char *);
int rc_getint_n(int /*<<< orphan*/);
int rc_getint(char *name) { return rc_getint_n(rc_findvar(name)); }


x86 assembly (clang, -O0):
<rc_getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rc_findvar@plt>
mov    %eax,%edi
call   1030 <rc_getint_n@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc_getint>:
push   %rax
call   1040 <rc_findvar@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <rc_getint_n@plt>

LLVM IR (-O0):
define i32 @rc_getint(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @rc_findvar(i8* %3)
%5 = call i32 @rc_getint_n(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @rc_getint(i8* %0) {
%2 = tail call i32 @rc_findvar(i8* %0)
%3 = tail call i32 @rc_getint_n(i32 %2)
ret i32 %3
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int logger_size(char *logfile) {
  struct stat filestate;
  if (stat(logfile, &filestate)) {
    return -1;
  }
  if (filestate.st_size > 1024 * 1024) {
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<logger_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <logger_size+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <logger_size+0x4f>
cmpl   $0x100000,-0x18(%rbp)
jle    1158 <logger_size+0x48>
movl   $0x0,-0x4(%rbp)
jmp    115f <logger_size+0x4f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
setne  %al
cmpl   $0x100001,(%rsp)
setl   %cl
or     %al,%cl
movzbl %cl,%eax
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @logger_size(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %15
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = icmp sgt i32 %11, 1048576
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 0, i32* %2
br label %15
14: ; preds = %9
store i32 -1, i32* %2
br label %15
15: ; preds = %14, %13, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @logger_size(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp ne i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = icmp slt i32 %7, 1048577
%9 = select i1 %5, i1 true, i1 %8
%10 = sext i1 %9 to i32
ret i32 %10
}
int test_logicalAnd(int x, int y) { return x && y; }


x86 assembly (clang, -O0):
<test_logicalAnd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1123 <test_logicalAnd+0x23>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_logicalAnd>:
test   %edi,%edi
setne  %al
test   %esi,%esi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @test_logicalAnd(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void hello() { printf("%s", "hello\n"); }


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

x86 assembly (clang, -O2):
<hello>:
lea    0xee9(%rip),%rdi
lea    0xee5(%rip),%rsi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"hello\0A\00"
define void @hello() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
int /*<<< orphan*/ die(char *);
void *emallocz(size_t size) {
  void *p;
  if (!(p = calloc(1, size)))
    die("xbmouse: cannot malloc\n");
  return p;
}


x86 assembly (clang, -O0):
<emallocz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1154 <emallocz+0x34>
lea    0xeb1(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emallocz>:
push   %rbx
mov    %rdi,%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1142 <emallocz+0x22>
lea    0xec3(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"xbmouse: cannot malloc\0A\00"
define i8* @emallocz(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @calloc(i32 1, 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 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [24 x i8] c"xbmouse: cannot malloc\0A\00"
define i8* @emallocz(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
unsigned long fold_signature(unsigned long sig) {
  unsigned long folded;
  folded = sig ^ (sig >> 16);
  folded ^= (folded >> 8);
  folded &= 0xff;
  return folded;
}


x86 assembly (clang, -O0):
<fold_signature>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x10,%rcx
xor    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
xor    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fold_signature>:
mov    %rdi,%rax
shr    $0x10,%rax
xor    %edi,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
xor    %eax,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i64 @fold_signature(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = load i64, i64* %2
%6 = lshr i64 %5, 16
%7 = xor i64 %4, %6
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = lshr i64 %8, 8
%10 = load i64, i64* %3
%11 = xor i64 %10, %9
store i64 %11, i64* %3
%12 = load i64, i64* %3
%13 = and i64 %12, 255
store i64 %13, i64* %3
%14 = load i64, i64* %3
ret i64 %14
}

LLVM IR (-O2):
define i64 @fold_signature(i64 %0) {
%2 = lshr i64 %0, 16
%3 = xor i64 %2, %0
%4 = lshr i64 %3, 8
%5 = xor i64 %4, %3
%6 = and i64 %5, 255
ret i64 %6
}
void ff_get_cpu_flags_mips() {}


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

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

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

LLVM IR (-O2):
define void @ff_get_cpu_flags_mips() {
ret void
}
void handle_SAK(sig) int sig;
{}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void tlb_flags_validate(uint64_t flags) {
  assert((flags & ~(((1 << 0)))) == 0);
}


x86 assembly (clang, -O0):
<tlb_flags_validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffffe,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlb_flags_validate>:
xor    %eax,%eax
cmp    $0x2,%edi
setb   %al
mov    %eax,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @tlb_flags_validate(i32 %0) {
%2 = icmp ult i32 %0, 2
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fe(char *);
void *malloc(unsigned int);
void *chk_malloc(unsigned int sz) {
  void *pt;
  pt = malloc(sz);
  if (pt == NULL) {
    fe("Couldn't alloc ptr of bytes size supplied!\n");
    exit(-1);
  }
  return pt;
}


x86 assembly (clang, -O0):
<chk_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <chk_malloc+0x38>
lea    0xea7(%rip),%rdi
call   1040 <fe@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_malloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <chk_malloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <fe@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"Couldn't alloc ptr of bytes size supplied!\0A\00"
define i8* @chk_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @fe(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [44 x i8] c"Couldn't alloc ptr of bytes size supplied!\0A\00"
define noalias i8* @chk_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @fe(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char b[10];
  int len = atoi(argv[1]);
  (void)fgets(b, len, stdin);
  (void)printf("%s\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x20(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
call   1040 <fgets@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%edx
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <fgets@plt>
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %7
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %7
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %12, i32 %13, i32 %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
void increase_j(char *str, int *j) {
  while (str[*j] && str[*j] != ',')
    (*j)++;
  (*j)++;
}


x86 assembly (clang, -O0):
<increase_j>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1141 <increase_j+0x41>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1151 <increase_j+0x51>
jmp    1161 <increase_j+0x61>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    110c <increase_j+0xc>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<increase_j>:
movslq (%rsi),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1125 <increase_j+0x25>
cmp    $0x2c,%cl
je     1125 <increase_j+0x25>
add    $0x1,%rax
mov    %eax,(%rsi)
jmp    1110 <increase_j+0x10>
add    $0x1,%eax
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @increase_j(i8* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
br label %4
4: ; preds = %9, %2
%5 = phi i32 [ %10, %9 ], [ %3, %2 ]
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
switch i8 %8, label %9 [
i8 0, label %11
i8 44, label %11
]
9: ; preds = %4
%10 = add nsw i32 %5, 1
store i32 %10, i32* %1
br label %4
11: ; preds = %4, %4
%12 = add nsw i32 %5, 1
store i32 %12, i32* %1
ret void
}
void I2SRxDataGet(unsigned long ulBase, unsigned long *pulData) {
  ;
  while ((*((volatile unsigned long *)(ulBase + 0x00000818))) == 0) {
  }
  *pulData = (*((volatile unsigned long *)(ulBase + 0x00000800)));
}


x86 assembly (clang, -O0):
<I2SRxDataGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x818(%rax),%rax
cmp    $0x0,%rax
jne    1126 <I2SRxDataGet+0x26>
jmp    110c <I2SRxDataGet+0xc>
mov    -0x8(%rbp),%rax
mov    0x800(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SRxDataGet>:
cmpq   $0x0,0x818(%rdi)
je     1100 <I2SRxDataGet>
mov    0x800(%rdi),%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @I2SRxDataGet(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
store i64* %1, i64** %4
br label %5
5: ; preds = %11, %2
%6 = load i64, i64* %3
%7 = add i64 %6, 2072
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %5
br label %5
12: ; preds = %5
%13 = load i64, i64* %3
%14 = add i64 %13, 2048
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
%17 = load i64*, i64** %4
store i64 %16, i64* %17
ret void
}

LLVM IR (-O2):
define void @I2SRxDataGet(i64 %0, i64* nocapture writeonly %1) {
%3 = add i64 %0, 2072
%4 = inttoptr i64 %3 to i64*
br label %5
5: ; preds = %5, %2
%6 = load volatile i64, i64* %4
%7 = icmp eq i64 %6, 0
br i1 %7, label %5, label %8
8: ; preds = %5
%9 = add i64 %0, 2048
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
store i64 %11, i64* %1
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
void *zalloc(size_t size) { return calloc(1, size); }


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

x86 assembly (clang, -O2):
<zalloc>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define i8* @zalloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
ret i8* %2
}
/* Variables and functions */
int _rdtsc();
int test_rdtsc() { return _rdtsc(); }


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

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

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

LLVM IR (-O2):
define i32 @test_rdtsc() {
%1 = tail call i32 (...) @_rdtsc()
ret i32 %1
}
/* Type definitions */
struct R4 {
  float f;
  unsigned int u4;
};

/* Variables and functions */
unsigned int read_u4(unsigned char *, int);
float read_r4(unsigned char *p, int endian) {
  union R4 {
    float f;
    unsigned int u4;
  } u;
  u.u4 = read_u4(p, endian);
  return (u.f);
}


x86 assembly (clang, -O0):
<read_r4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <read_u4@plt>
mov    %eax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_r4>:
push   %rax
call   1030 <read_u4@plt>
movd   %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%union.R4 = type { float }
define float @read_r4(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %union.R4
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @read_u4(i8* %6, i32 %7)
%9 = bitcast %union.R4* %5 to i32*
store i32 %8, i32* %9
%10 = bitcast %union.R4* %5 to float*
%11 = load float, float* %10
ret float %11
}

LLVM IR (-O2):
define float @read_r4(i8* %0, i32 %1) {
%3 = tail call i32 @read_u4(i8* %0, i32 %1)
%4 = bitcast i32 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ id(int);
int mulhigh(int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  if (mulhigh(id(0x12345678), id(0x90abcdef)) != 0xa49a83e)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x12345678,%edi
call   1050 <id@plt>
mov    %eax,-0x8(%rbp)
mov    $0x90abcdef,%edi
call   1050 <id@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <mulhigh@plt>
cmp    $0xa49a83e,%eax
je     1172 <main+0x42>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x12345678,%edi
call   1050 <id@plt>
mov    %eax,%ebx
mov    $0x90abcdef,%edi
call   1050 <id@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <mulhigh@plt>
cmp    $0xa49a83e,%eax
jne    115b <main+0x2b>
xor    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @id(i32 305419896)
%3 = call i32 @id(i32 -1867788817)
%4 = call i32 @mulhigh(i32 %2, i32 %3)
%5 = icmp ne i32 %4, 172599358
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @id(i32 305419896)
%2 = tail call i32 @id(i32 -1867788817)
%3 = tail call i32 @mulhigh(i32 %1, i32 %2)
%4 = icmp eq i32 %3, 172599358
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t
hsp_subevent_rfcomm_disconnection_complete_get_status(const uint8_t *event) {
  return event[3];
}


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

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

LLVM IR (-O0):
define i32 @hsp_subevent_rfcomm_disconnection_complete_get_status(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hsp_subevent_rfcomm_disconnection_complete_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void onError(const char *message, void *context) {
  fprintf(stderr, "Error: %s\n", message);
  exit(-1);
}


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

x86 assembly (clang, -O2):
<onError>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @onError(i8* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ glTexCoord2fv(int /*<<< orphan*/ *);
void TexCoord2fv(GLfloat v[2]) { glTexCoord2fv(v); }


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

x86 assembly (clang, -O2):
<TexCoord2fv>:
jmp    1030 <glTexCoord2fv@plt>

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

LLVM IR (-O2):
define void @TexCoord2fv(i32* %0) {
%2 = tail call i32 @glTexCoord2fv(i32* %0)
ret void
}