xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cleanup(void) { printf("Cleaning up\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Cleaning up\00"
define void @cleanup() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int close(int);
int dclose(int fd) { return (close(fd)); }


x86 assembly (clang, -O0):
<dclose>:
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):
<dclose>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @dclose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ p_sat(char *);
void register_row_num(int num) {
  int i, extra = 8 - num;
  if (extra < 0)
    return;
  for (i = 0; i < extra; i++)
    p_sat("");
}


x86 assembly (clang, -O0):
<register_row_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x8,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1135 <register_row_num+0x25>
jmp    1162 <register_row_num+0x52>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1162 <register_row_num+0x52>
lea    0xeb1(%rip),%rdi
call   1030 <p_sat@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <register_row_num+0x2c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<register_row_num>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x7,%edi
jg     114d <register_row_num+0x3d>
mov    $0x8,%eax
sub    %edi,%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
lea    0xecf(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <p_sat@plt>
add    $0xffffffff,%ebp
jne    1140 <register_row_num+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @register_row_num(i32 %0) {
%2 = icmp slt i32 %0, 8
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = sub i32 8, %0
%5 = call i32 @llvm.smax.i32(i32 %4, i32 1)
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = tail call i32 @p_sat(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %5
br i1 %10, label %11, label %6
11: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ quicksort_index_recursive(int *, int *, int /*<<< orphan*/,
                                             int, int /*<<< orphan*/);
void quicksort_index_descending(int *array, int *idx, int length) {
  quicksort_index_recursive(array, idx, 0, length, 0);
}


x86 assembly (clang, -O0):
<quicksort_index_descending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
xor    %r8d,%r8d
mov    %r8d,%edx
call   1030 <quicksort_index_recursive@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort_index_descending>:
mov    %edx,%ecx
xor    %edx,%edx
xor    %r8d,%r8d
jmp    1030 <quicksort_index_recursive@plt>

LLVM IR (-O0):
define void @quicksort_index_descending(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = call i32 @quicksort_index_recursive(i32* %7, i32* %8, i32 0, i32 %9, i32 0)
ret void
}

LLVM IR (-O2):
define void @quicksort_index_descending(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @quicksort_index_recursive(i32* %0, i32* %1, i32 0, i32 %2, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rrca();
void opcode_0f() { rrca(); }


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

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

LLVM IR (-O0):
define void @opcode_0f() {
%1 = call i32 (...) @rrca()
ret void
}

LLVM IR (-O2):
define void @opcode_0f() {
%1 = tail call i32 (...) @rrca()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct ts_tdt {
  int dummy;
};

/* Variables and functions */
struct ts_tdt *ts_tdt_init_empty(struct ts_tdt *, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
struct ts_tdt *ts_tdt_init(struct ts_tdt *tdt, time_t ts) {
  return ts_tdt_init_empty(tdt, ts, 0);
}


x86 assembly (clang, -O0):
<ts_tdt_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1030 <ts_tdt_init_empty@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_tdt_init>:
xor    %edx,%edx
jmp    1030 <ts_tdt_init_empty@plt>

LLVM IR (-O0):
%struct.ts_tdt = type { i32 }
define %struct.ts_tdt* @ts_tdt_init(%struct.ts_tdt* %0, i32 %1) {
%3 = alloca %struct.ts_tdt*
%4 = alloca i32
store %struct.ts_tdt* %0, %struct.ts_tdt** %3
store i32 %1, i32* %4
%5 = load %struct.ts_tdt*, %struct.ts_tdt** %3
%6 = load i32, i32* %4
%7 = call %struct.ts_tdt* @ts_tdt_init_empty(%struct.ts_tdt* %5, i32 %6, i32 0)
ret %struct.ts_tdt* %7
}

LLVM IR (-O2):
%struct.ts_tdt = type { i32 }
define %struct.ts_tdt* @ts_tdt_init(%struct.ts_tdt* %0, i32 %1) {
%3 = tail call %struct.ts_tdt* @ts_tdt_init_empty(%struct.ts_tdt* %0, i32 %1, i32 0)
ret %struct.ts_tdt* %3
}
int litchar(unsigned char a) {
  register unsigned char b = a + 1;
  if (b & 0x33)
    return (0);
  else if (b & 0x44)
    return (1);
  else if (b & 0x1f)
    return (2);
  else
    return (3);
}


x86 assembly (clang, -O0):
<litchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x6(%rbp)
movzbl -0x6(%rbp),%eax
and    $0x33,%eax
cmp    $0x0,%eax
je     1130 <litchar+0x30>
movl   $0x0,-0x4(%rbp)
jmp    116f <litchar+0x6f>
movzbl -0x6(%rbp),%eax
and    $0x44,%eax
cmp    $0x0,%eax
je     114c <litchar+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    116f <litchar+0x6f>
movzbl -0x6(%rbp),%eax
and    $0x1f,%eax
cmp    $0x0,%eax
je     1168 <litchar+0x68>
movl   $0x2,-0x4(%rbp)
jmp    116f <litchar+0x6f>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<litchar>:
add    $0x1,%dil
xor    %eax,%eax
test   $0x33,%dil
je     110d <litchar+0xd>
ret
mov    $0x1,%eax
test   $0x44,%dil
jne    110c <litchar+0xc>
xor    %eax,%eax
test   $0x1f,%dil
sete   %al
or     $0x2,%eax
ret

LLVM IR (-O0):
define i32 @litchar(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = add nsw i32 %6, 1
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
%11 = and i32 %10, 51
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 0, i32* %2
br label %27
14: ; preds = %1
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = and i32 %16, 68
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
store i32 1, i32* %2
br label %27
20: ; preds = %14
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = and i32 %22, 31
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 2, i32* %2
br label %27
26: ; preds = %20
store i32 3, i32* %2
br label %27
27: ; preds = %26, %25, %19, %13
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @litchar(i8 zeroext %0) {
%2 = add i8 %0, 1
%3 = zext i8 %2 to i32
%4 = and i32 %3, 51
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = and i32 %3, 68
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = and i32 %3, 31
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 3, i32 2
br label %13
13: ; preds = %9, %6, %1
%14 = phi i32 [ 0, %1 ], [ 1, %6 ], [ %12, %9 ]
ret i32 %14
}
int equal_int(void *ip, void *jp) {
  if (*((int *)ip) == *((int *)jp)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<equal_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    112a <equal_int+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1131 <equal_int+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @equal_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
float func(float x) { return x * x - 3 * x + 4; }


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  0xee9(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xec3(%rip),%xmm1
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
movss  0xef8(%rip),%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
addss  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @func(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fmul float 3.000000e+00, %5
%7 = fneg float %6
%8 = call float @llvm.fmuladd.f32(float %3, float %4, float %7)
%9 = fadd float %8, 4.000000e+00
ret float %9
}

LLVM IR (-O2):
define float @func(float %0) {
%2 = fmul float %0, -3.000000e+00
%3 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %2)
%4 = fadd float %3, 4.000000e+00
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x44() {
  Assert_real((isspace(68) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              345, ("isspace should be 0 for D"));
}


x86 assembly (clang, -O0):
<t_isspace_0x44>:
push   %rbp
mov    %rsp,%rbp
mov    $0x44,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x159,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x44>:
push   %rax
mov    $0x44,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x159,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for D\00"
define void @t_isspace_0x44() {
%1 = call i64 @isspace(i32 68)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 345, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for D\00"
define void @t_isspace_0x44() {
%1 = tail call i64 @isspace(i32 68)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 345, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void square(int n) { printf("Square of %d = %d\n", n, n * n); }


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

x86 assembly (clang, -O2):
<square>:
mov    %edi,%edx
imul   %edi,%edx
lea    0xee4(%rip),%rax
mov    %edi,%esi
mov    %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Square of %d = %d\0A\00"
define void @square(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 %4, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Square of %d = %d\0A\00"
define void @square(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
struct btp_strbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ btp_strbuf_prepend_str(struct btp_strbuf *, char *);
char *btp_vasprintf(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
struct btp_strbuf *btp_strbuf_prepend_strfv(struct btp_strbuf *strbuf,
                                            const char *format, va_list p) {
  char *string_ptr = btp_vasprintf(format, p);
  btp_strbuf_prepend_str(strbuf, string_ptr);
  free(string_ptr);
  return strbuf;
}


x86 assembly (clang, -O0):
<btp_strbuf_prepend_strfv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <btp_vasprintf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <btp_strbuf_prepend_str@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btp_strbuf_prepend_strfv>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %edx,%esi
call   1040 <btp_vasprintf@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <btp_strbuf_prepend_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.btp_strbuf = type { i32 }
define %struct.btp_strbuf* @btp_strbuf_prepend_strfv(%struct.btp_strbuf* %0, i8* %1, i32 %2) {
%4 = alloca %struct.btp_strbuf*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store %struct.btp_strbuf* %0, %struct.btp_strbuf** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @btp_vasprintf(i8* %8, i32 %9)
store i8* %10, i8** %7
%11 = load %struct.btp_strbuf*, %struct.btp_strbuf** %4
%12 = load i8*, i8** %7
%13 = call i32 @btp_strbuf_prepend_str(%struct.btp_strbuf* %11, i8* %12)
%14 = load i8*, i8** %7
%15 = call i32 @free(i8* %14)
%16 = load %struct.btp_strbuf*, %struct.btp_strbuf** %4
ret %struct.btp_strbuf* %16
}

LLVM IR (-O2):
%struct.btp_strbuf = type { i32 }
define %struct.btp_strbuf* @btp_strbuf_prepend_strfv(%struct.btp_strbuf* returned %0, i8* %1, i32 %2) {
%4 = tail call i8* @btp_vasprintf(i8* %1, i32 %2)
%5 = tail call i32 @btp_strbuf_prepend_str(%struct.btp_strbuf* %0, i8* %4)
%6 = tail call i32 @free(i8* %4)
ret %struct.btp_strbuf* %0
}
int test_imm_41int16_mem(short *val) {
  return ((*val) & (0x41 << 0)) ? -20 : -40;
}


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

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

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

/* Variables and functions */
void swap_uint32(uint32_t *x) {
  char n = ((char *)&x)[0];
  ((char *)x)[0] = ((char *)x)[3];
  ((char *)x)[3] = n;
  n = ((char *)x)[1];
  ((char *)x)[1] = ((char *)x)[2];
  ((char *)x)[2] = n;
}


x86 assembly (clang, -O0):
<swap_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_uint32>:
mov    0x3(%rdi),%al
mov    %al,(%rdi)
mov    %dil,0x3(%rdi)
rolw   $0x8,0x1(%rdi)
ret

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

LLVM IR (-O2):
define void @swap_uint32(i32* %0) {
%2 = ptrtoint i32* %0 to i64
%3 = trunc i64 %2 to i8
%4 = bitcast i32* %0 to i8*
%5 = getelementptr inbounds i8, i8* %4, i64 3
%6 = load i8, i8* %5
store i8 %6, i8* %4
store i8 %3, i8* %5
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %4, i64 2
%10 = load i8, i8* %9
store i8 %10, i8* %7
store i8 %8, i8* %9
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ txbuffer;

/* Variables and functions */
int /*<<< orphan*/ spi_transfer(char *, char *);
char spi_read(char port) {
  char txbuffer[] = {0x41, port, 0xff};
  char rxbuffer[(sizeof(txbuffer) / sizeof((txbuffer)[0]))];
  spi_transfer(txbuffer, rxbuffer);
  return rxbuffer[2];
}


x86 assembly (clang, -O0):
<spi_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x41,-0x4(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x3(%rbp)
movb   $0xff,-0x2(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x7(%rbp),%rsi
call   1030 <spi_transfer@plt>
movsbl -0x5(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_read>:
push   %rax
movb   $0x41,0x2(%rsp)
mov    %dil,0x3(%rsp)
movb   $0xff,0x4(%rsp)
lea    0x2(%rsp),%rdi
lea    0x5(%rsp),%rsi
call   1030 <spi_transfer@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @spi_read(i8 signext %0) {
%2 = alloca i8
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
store i8 %0, i8* %2
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 65, i8* %5
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %2
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
store i8 -1, i8* %8
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%11 = call i32 @spi_transfer(i8* %9, i8* %10)
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
%13 = load i8, i8* %12
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @spi_read(i8 signext %0) {
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
store i8 65, i8* %4
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
store i8 %0, i8* %5
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 -1, i8* %6
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%8 = call i32 @spi_transfer(i8* %4, i8* %7)
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
%10 = load i8, i8* %9
ret i8 %10
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_addwstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_addwstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_addwstr+0x2a>
jmp    1170 <cmd_addwstr+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_addwstr>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_addwstr+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_addwstr(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 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_addwstr(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_initializeBT();
int main() {
  printf("///////////////////////\n");
  printf("// B-TREES TEST\n");
  printf("///////////////////////\n\n");
  test_initializeBT();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"///////////////////////\0A\00"
@.str.1 = [17 x i8] c"// B-TREES TEST\0A\00"
@.str.2 = [26 x i8] c"///////////////////////\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (...) @test_initializeBT()
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"///////////////////////\00"
@str.3 = [16 x i8] c"// B-TREES TEST\00"
@str.4 = [25 x i8] c"///////////////////////\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 (...) @test_initializeBT()
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *display;
};
typedef TYPE_1__ XFocusChangeEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XFocusChangeEvent_display(void *_p, void *_v) {
  ((XFocusChangeEvent *)_p)->display = (Display *)_v;
}


x86 assembly (clang, -O0):
<set_XFocusChangeEvent_display>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XFocusChangeEvent_display>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32* }
define void @set_XFocusChangeEvent_display(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32* %6, i32** %9
ret void
}

LLVM IR (-O2):
define void @set_XFocusChangeEvent_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Type definitions */
typedef scalar_t__ int_least32_t;

/* Variables and functions */
bool SHAREMIND_SET_KEY_LESS_THAN_int_least32_t(int_least32_t const k1,
                                               int_least32_t const k2) {
  return k1 < k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_LESS_THAN_int_least32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_LESS_THAN_int_least32_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_int_least32_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_int_least32_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void picolcd_debug_out_report(struct picolcd_data *data,
                              struct hid_device *hdev,
                              struct hid_report *report) {}


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

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

LLVM IR (-O0):
%struct.picolcd_data = type opaque
%struct.hid_device = type opaque
%struct.hid_report = type opaque
define void @picolcd_debug_out_report(%struct.picolcd_data* %0, %struct.hid_device* %1, %struct.hid_report* %2) {
%4 = alloca %struct.picolcd_data*
%5 = alloca %struct.hid_device*
%6 = alloca %struct.hid_report*
store %struct.picolcd_data* %0, %struct.picolcd_data** %4
store %struct.hid_device* %1, %struct.hid_device** %5
store %struct.hid_report* %2, %struct.hid_report** %6
ret void
}

LLVM IR (-O2):
%struct.picolcd_data = type opaque
%struct.hid_device = type opaque
%struct.hid_report = type opaque
define void @picolcd_debug_out_report(%struct.picolcd_data* nocapture %0, %struct.hid_device* nocapture %1, %struct.hid_report* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void perform_cool_stuff(int number) {
  if (number > 0)
    printf("%s\n", "cool stuff!");
}


x86 assembly (clang, -O0):
<perform_cool_stuff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1138 <perform_cool_stuff+0x28>
lea    0xed4(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perform_cool_stuff>:
test   %edi,%edi
jle    1127 <perform_cool_stuff+0x17>
lea    0xee5(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"cool stuff!\00"
define void @perform_cool_stuff(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"cool stuff!\00"
define void @perform_cool_stuff(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret void
}
void syslog(int priority, const char *format, ...) {
  ((void)(priority));
  ((void)(format));
}


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

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

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

LLVM IR (-O2):
define void @syslog(i32 %0, i8* nocapture %1, ...) {
ret void
}
void sagdankirp(int *sayi, int krp_sayi) {
  while (krp_sayi > 0) {
    *sayi /= 10;
    krp_sayi--;
  }
}


x86 assembly (clang, -O0):
<sagdankirp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    113d <sagdankirp+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <sagdankirp+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sagdankirp>:
test   %esi,%esi
jle    1170 <sagdankirp+0x70>
mov    (%rdi),%eax
lea    -0x1(%rsi),%r8d
mov    %esi,%r9d
and    $0x3,%r9d
je     1140 <sagdankirp+0x40>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    $0x1,%ecx
cmp    %ecx,%r9d
jne    1120 <sagdankirp+0x20>
sub    %ecx,%esi
cmp    $0x3,%r8d
jb     116e <sagdankirp+0x6e>
add    $0xffffffff,%esi
nopl   0x0(%rax)
cltq
imul   $0x68db8bad,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
add    $0xfffffffc,%esi
cmp    $0xfffffffe,%esi
jb     1150 <sagdankirp+0x50>
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @sagdankirp(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %31
4: ; preds = %2
%5 = load i32, i32* %0
%6 = add i32 %1, -1
%7 = and i32 %1, 3
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %4, %9
%10 = phi i32 [ %13, %9 ], [ %5, %4 ]
%11 = phi i32 [ %14, %9 ], [ %1, %4 ]
%12 = phi i32 [ %15, %9 ], [ 0, %4 ]
%13 = sdiv i32 %10, 10
%14 = add nsw i32 %11, -1
%15 = add i32 %12, 1
%16 = icmp eq i32 %15, %7
br i1 %16, label %17, label %9
17: ; preds = %9, %4
%18 = phi i32 [ %5, %4 ], [ %13, %9 ]
%19 = phi i32 [ %1, %4 ], [ %14, %9 ]
%20 = phi i32 [ undef, %4 ], [ %13, %9 ]
%21 = icmp ult i32 %6, 3
br i1 %21, label %29, label %22
22: ; preds = %17, %22
%23 = phi i32 [ %25, %22 ], [ %18, %17 ]
%24 = phi i32 [ %26, %22 ], [ %19, %17 ]
%25 = sdiv i32 %23, 10000
%26 = add nsw i32 %24, -4
%27 = add i32 %24, -5
%28 = icmp ult i32 %27, -2
br i1 %28, label %22, label %29
29: ; preds = %22, %17
%30 = phi i32 [ %20, %17 ], [ %25, %22 ]
store i32 %30, i32* %0
br label %31
31: ; preds = %29, %2
ret void
}
/* Variables and functions */
size_t strlen(char *);
char *remove_newline(char *s) {
  size_t len = strlen(s);
  if (len > 0 && s[len - 1] == '\n')
    s[len - 1] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<remove_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    115d <remove_newline+0x4d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    115d <remove_newline+0x4d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_newline>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
je     112a <remove_newline+0x1a>
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    112a <remove_newline+0x1a>
movb   $0x0,-0x1(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @remove_newline(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp ugt i64 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i64, i64* %3
%11 = sub i64 %10, 1
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %21
16: ; preds = %8
%17 = load i8*, i8** %2
%18 = load i64, i64* %3
%19 = sub i64 %18, 1
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 0, i8* %20
br label %21
21: ; preds = %16, %8, %1
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @remove_newline(i8* returned %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = add i64 %2, -1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %4
store i8 0, i8* %6
br label %10
10: ; preds = %9, %4, %1
ret i8* %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int is_on(uint32_t opts, char opt) { return opts & (1 << (opt - 'a')); }


x86 assembly (clang, -O0):
<is_on>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
movsbl -0x5(%rbp),%ecx
sub    $0x61,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_on>:
lea    -0x61(%rsi),%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @is_on(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %7, 97
%9 = shl i32 1, %8
%10 = and i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_on(i32 %0, i8 signext %1) {
%3 = sext i8 %1 to i32
%4 = add nsw i32 %3, -97
%5 = shl nuw nsw i32 1, %4
%6 = and i32 %5, %0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *tinfl_decompress_mem_to_heap(void *, int, size_t *, int);
void *createInflatedStream(void *data, int streamLength) {
  size_t inflate;
  void *inflatedData =
      tinfl_decompress_mem_to_heap(data, streamLength, &inflate, 1);
  free(data);
  if (inflate <= 2)
    inflatedData = NULL;
  return inflatedData;
}


x86 assembly (clang, -O0):
<createInflatedStream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x18(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <tinfl_decompress_mem_to_heap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x2,-0x18(%rbp)
ja     1164 <createInflatedStream+0x44>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createInflatedStream>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%rdx
mov    $0x1,%ecx
call   1040 <tinfl_decompress_mem_to_heap@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
cmpq   $0x3,(%rsp)
cmovae %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @createInflatedStream(i8* %0, i32 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = call i8* @tinfl_decompress_mem_to_heap(i8* %0, i32 %1, i64* %3, i32 1)
%6 = call i32 @free(i8* %0)
%7 = load i64, i64* %3
%8 = icmp ult i64 %7, 3
%9 = select i1 %8, i8* null, i8* %5
ret i8* %9
}
void keyboard_button_event(int *b, int *quick_b, int way, int repeat) {
  if (*b * way <= -2)
    *quick_b = way;
  else
    *b = (2 + repeat) * (way == 1);
}


x86 assembly (clang, -O0):
<keyboard_button_event>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
imul   -0x14(%rbp),%eax
cmp    $0xfffffffe,%eax
jg     1133 <keyboard_button_event+0x33>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    114e <keyboard_button_event+0x4e>
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
imul   %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboard_button_event>:
mov    (%rdi),%eax
imul   %edx,%eax
cmp    $0xfffffffe,%eax
jg     110d <keyboard_button_event+0xd>
mov    %edx,(%rsi)
ret
add    $0x2,%ecx
xor    %eax,%eax
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @keyboard_button_event(i32* nocapture %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = load i32, i32* %0
%6 = mul nsw i32 %5, %2
%7 = icmp slt i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %4
store i32 %2, i32* %1
br label %13
9: ; preds = %4
%10 = add nsw i32 %3, 2
%11 = icmp eq i32 %2, 1
%12 = select i1 %11, i32 %10, i32 0
store i32 %12, i32* %0
br label %13
13: ; preds = %9, %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SYS_exit;
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int);
int main() {
  syscall(SYS_exit, (int)-1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
call   1030 <syscall@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
call   1030 <syscall@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SYS_exit = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SYS_exit
%3 = call i32 @syscall(i32 %2, i32 -1)
ret i32 0
}

LLVM IR (-O2):
@SYS_exit = global i32 0
define i32 @main() {
%1 = load i32, i32* @SYS_exit
%2 = tail call i32 @syscall(i32 %1, i32 -1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void test02(unsigned int a, unsigned int b) {
  unsigned int x = 0x80000000;
  if (a > x)
    if (b < x)
      if (a - b == 1U)
        link_error();
}


x86 assembly (clang, -O0):
<test02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x80000000,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jbe    115d <test02+0x4d>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1158 <test02+0x48>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x1,%eax
jne    1153 <test02+0x43>
mov    $0x0,%al
call   1030 <link_error@plt>
jmp    1158 <test02+0x48>
jmp    115d <test02+0x4d>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test02(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 -2147483648, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* %5
%8 = icmp ugt i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = icmp ult i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sub i32 %14, %15
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 (...) @link_error()
br label %20
20: ; preds = %18, %13
br label %21
21: ; preds = %20, %9
br label %22
22: ; preds = %21, %2
ret void
}

LLVM IR (-O2):
define void @test02(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ IPV6_ADDRFORM;
int diminuto_ipc_set_socket(int, int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int diminuto_ipc6_stream_set_ipv6toipv4(int fd) {
  return diminuto_ipc_set_socket(fd, IPPROTO_TCP, IPV6_ADDRFORM, AF_INET);
}


x86 assembly (clang, -O0):
<diminuto_ipc6_stream_set_ipv6toipv4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
mov    0x2eb1(%rip),%rax
mov    (%rax),%ecx
call   1030 <diminuto_ipc_set_socket@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diminuto_ipc6_stream_set_ipv6toipv4>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    0x2ebf(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <diminuto_ipc_set_socket@plt>

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@IPV6_ADDRFORM = global i32 0
@AF_INET = global i32 0
define i32 @diminuto_ipc6_stream_set_ipv6toipv4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @IPV6_ADDRFORM
%6 = load i32, i32* @AF_INET
%7 = call i32 @diminuto_ipc_set_socket(i32 %3, i32 %4, i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@IPV6_ADDRFORM = global i32 0
@AF_INET = global i32 0
define i32 @diminuto_ipc6_stream_set_ipv6toipv4(i32 %0) {
%2 = load i32, i32* @IPPROTO_TCP
%3 = load i32, i32* @IPV6_ADDRFORM
%4 = load i32, i32* @AF_INET
%5 = tail call i32 @diminuto_ipc_set_socket(i32 %0, i32 %2, i32 %3, i32 %4)
ret i32 %5
}
void __attribute__((hot)) external_hot_function() {}


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

x86 assembly (clang, -O2):
<external_hot_function>:
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)

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

LLVM IR (-O2):
define void @external_hot_function() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func();
void func2() { func(); }


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

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

LLVM IR (-O0):
define void @func2() {
%1 = call i32 (...) @func()
ret void
}

LLVM IR (-O2):
define void @func2() {
%1 = tail call i32 (...) @func()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello from C!\n");
  f();
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello from C!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @f()
ret i32 0
}