xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glScaled(double, double, double);
int /*<<< orphan*/ glTranslated(int /*<<< orphan*/, double, int /*<<< orphan*/);
int /*<<< orphan*/ glutSolidCube(double);
void tableleg(double thick, double len) {
  glPushMatrix();
  glTranslated(0, .5 * len, 0);
  glScaled(thick, len, thick);
  glutSolidCube(1.0);
  glPopMatrix();
}


x86 assembly (clang, -O0):
<tableleg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1060 <glPushMatrix@plt>
movsd  0xe97(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1070 <glTranslated@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
call   1050 <glScaled@plt>
movsd  0xe65(%rip),%xmm0
call   1030 <glutSolidCube@plt>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tableleg>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1060 <glPushMatrix@plt>
movsd  0xe91(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1070 <glTranslated@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movaps %xmm0,%xmm2
call   1050 <glScaled@plt>
movsd  0xe6e(%rip),%xmm0
call   1030 <glutSolidCube@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    1040 <glPopMatrix@plt>

LLVM IR (-O0):
define void @tableleg(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = call i32 (...) @glPushMatrix()
%6 = load double, double* %4
%7 = fmul double 5.000000e-01, %6
%8 = call i32 @glTranslated(i32 0, double %7, i32 0)
%9 = load double, double* %3
%10 = load double, double* %4
%11 = load double, double* %3
%12 = call i32 @glScaled(double %9, double %10, double %11)
%13 = call i32 @glutSolidCube(double 1.000000e+00)
%14 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
define void @tableleg(double %0, double %1) {
%3 = tail call i32 (...) @glPushMatrix()
%4 = fmul double %1, 5.000000e-01
%5 = tail call i32 @glTranslated(i32 0, double %4, i32 0)
%6 = tail call i32 @glScaled(double %0, double %1, double %0)
%7 = tail call i32 @glutSolidCube(double 1.000000e+00)
%8 = tail call i32 (...) @glPopMatrix()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SETHLm(int);
void SET7HLm() { SETHLm(0x80); }


x86 assembly (clang, -O0):
<SET7HLm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80,%edi
call   1030 <SETHLm@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SET7HLm>:
mov    $0x80,%edi
jmp    1030 <SETHLm@plt>

LLVM IR (-O0):
define void @SET7HLm() {
%1 = call i32 @SETHLm(i32 128)
ret void
}

LLVM IR (-O2):
define void @SET7HLm() {
%1 = tail call i32 @SETHLm(i32 128)
ret void
}
/* Variables and functions */
scalar_t__ shn_uchar_to_ulong_le(unsigned char *);
int shn_uchar_to_slong_le(unsigned char *buf) {
  return (int)shn_uchar_to_ulong_le(buf);
}


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

x86 assembly (clang, -O2):
<shn_uchar_to_slong_le>:
jmp    1030 <shn_uchar_to_ulong_le@plt>

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

LLVM IR (-O2):
define i32 @shn_uchar_to_slong_le(i8* %0) {
%2 = tail call i64 @shn_uchar_to_ulong_le(i8* %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int celcon_solve_quaddobl_start_system(int k, int *mv) {
  int fail;
  double *c;
  fail = _ada_use_c2phc4c(476, &k, mv, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_solve_quaddobl_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1dc,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_solve_quaddobl_start_system>:
push   %rax
mov    %rsi,%rdx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1dc,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @celcon_solve_quaddobl_start_system(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca double*
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load double*, double** %6
%9 = call i32 @_ada_use_c2phc4c(i32 476, i32* %3, i32* %7, double* %8, i32 0)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @celcon_solve_quaddobl_start_system(i32 %0, i32* %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @_ada_use_c2phc4c(i32 476, i32* %3, i32* %1, double* undef, i32 0)
ret i32 %4
}
void gdk_screen_height_mm() {}


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

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

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

LLVM IR (-O2):
define void @gdk_screen_height_mm() {
ret void
}
int u8charlencc(const char *str) {
  if (*str == 0)
    return 0;
  int len = 1;
  if (*str < 0) {
    unsigned char c = *str;
    while ((c <<= 1) & 128)
      ++len;
  }
  return len;
}


x86 assembly (clang, -O0):
<u8charlencc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1124 <u8charlencc+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1178 <u8charlencc+0x78>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jge    1172 <u8charlencc+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x15(%rbp)
movzbl %al,%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     116d <u8charlencc+0x6d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <u8charlencc+0x44>
jmp    1172 <u8charlencc+0x72>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<u8charlencc>:
mov    (%rdi),%cl
test   %cl,%cl
je     111a <u8charlencc+0x1a>
mov    $0x1,%eax
jns    1119 <u8charlencc+0x19>
xor    %eax,%eax
nop
add    %cl,%cl
add    $0x1,%eax
test   %cl,%cl
js     1110 <u8charlencc+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @u8charlencc(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = icmp slt i8 %2, 0
br i1 %5, label %6, label %12
6: ; preds = %4, %6
%7 = phi i32 [ %11, %6 ], [ 1, %4 ]
%8 = phi i8 [ %9, %6 ], [ %2, %4 ]
%9 = shl i8 %8, 1
%10 = icmp sgt i8 %9, -1
%11 = add nuw nsw i32 %7, 1
br i1 %10, label %12, label %6
12: ; preds = %6, %4, %1
%13 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %7, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ lock();
int /*<<< orphan*/ unlock();
int main() {
  int old, new;
  int undet;
  do {
    lock();
    old = new;
    if (undet) {
      unlock();
      new ++;
    }
  } while (new != old);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <lock@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1156 <main+0x36>
mov    $0x0,%al
call   1030 <unlock@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <main+0x3b>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @lock()
ret i32 0
}
/* Variables and functions */
int errno_by_name_dynamic(char const *);
int errno_by_name_x86_64(char const *);
int errno_by_name(const char *errno_name) {
  int err;
  err = errno_by_name_x86_64(errno_name);
  if (err >= 0)
    return err;
  return errno_by_name_dynamic(errno_name);
}


x86 assembly (clang, -O0):
<errno_by_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <errno_by_name_x86_64@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     114d <errno_by_name+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <errno_by_name+0x39>
mov    -0x10(%rbp),%rdi
call   1030 <errno_by_name_dynamic@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errno_by_name>:
push   %rbx
mov    %rdi,%rbx
call   1040 <errno_by_name_x86_64@plt>
test   %eax,%eax
js     112f <errno_by_name+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <errno_by_name_dynamic@plt>

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

LLVM IR (-O2):
define i32 @errno_by_name(i8* %0) {
%2 = tail call i32 @errno_by_name_x86_64(i8* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @errno_by_name_dynamic(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
void Action_Delay_S(char *Str) {}


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

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

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

LLVM IR (-O2):
define void @Action_Delay_S(i8* nocapture %0) {
ret void
}
char **make_symbol_completion_list(char *text, char *word) { return 0; }


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

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

LLVM IR (-O0):
define i8** @make_symbol_completion_list(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i8** null
}

LLVM IR (-O2):
define noalias i8** @make_symbol_completion_list(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8** null
}
void function_empty_type() {}


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

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

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

LLVM IR (-O2):
define void @function_empty_type() {
ret void
}
int ld_bun_mm1(long double *a1, long double *a2) {
  return (__builtin_isunordered(*a1, *a2));
}


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

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

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

LLVM IR (-O2):
define i32 @ld_bun_mm1(x86_fp80* nocapture %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = load x86_fp80, x86_fp80* %1
%5 = fcmp uno x86_fp80 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
struct pipeline {
  int dummy;
};

/* Variables and functions */
struct pipeline *pipelineOpenMem(char ***, unsigned int, void *, size_t, int);
struct pipeline *pipelineOpenMem1(char **cmd, unsigned opts, void *otherEndBuf,
                                  size_t otherEndBufSize, int stderrFd) {
  char **cmds[2];
  cmds[0] = cmd;
  cmds[1] = NULL;
  return pipelineOpenMem(cmds, opts, otherEndBuf, otherEndBufSize, stderrFd);
}


x86 assembly (clang, -O0):
<pipelineOpenMem1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <pipelineOpenMem@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pipelineOpenMem1>:
sub    $0x18,%rsp
mov    %rdi,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rdi
call   1030 <pipelineOpenMem@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.pipeline = type { i32 }
define %struct.pipeline* @pipelineOpenMem1(i8** %0, i32 %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca [2 x i8**]
store i8** %0, i8*** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i32 %4, i32* %10
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds [2 x i8**], [2 x i8**]* %11, i64 0, i64 0
store i8** %12, i8*** %13
%14 = getelementptr inbounds [2 x i8**], [2 x i8**]* %11, i64 0, i64 1
store i8** null, i8*** %14
%15 = getelementptr inbounds [2 x i8**], [2 x i8**]* %11, i64 0, i64 0
%16 = load i32, i32* %7
%17 = load i8*, i8** %8
%18 = load i64, i64* %9
%19 = load i32, i32* %10
%20 = call %struct.pipeline* @pipelineOpenMem(i8*** %15, i32 %16, i8* %17, i64 %18, i32 %19)
ret %struct.pipeline* %20
}

LLVM IR (-O2):
%struct.pipeline = type { i32 }
define %struct.pipeline* @pipelineOpenMem1(i8** %0, i32 %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca [2 x i8**]
%7 = bitcast [2 x i8**]* %6 to i8*
%8 = getelementptr inbounds [2 x i8**], [2 x i8**]* %6, i64 0, i64 0
store i8** %0, i8*** %8
%9 = getelementptr inbounds [2 x i8**], [2 x i8**]* %6, i64 0, i64 1
store i8** null, i8*** %9
%10 = call %struct.pipeline* @pipelineOpenMem(i8*** %8, i32 %1, i8* %2, i64 %3, i32 %4)
ret %struct.pipeline* %10
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool rtp_check_hdr(const uint8_t *p_rtp) { return (p_rtp[0] & 0xc0) == 0x80; }


x86 assembly (clang, -O0):
<rtp_check_hdr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp_check_hdr>:
mov    $0xc0,%ecx
and    (%rdi),%ecx
xor    %eax,%eax
cmp    $0x80,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @rtp_check_hdr(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 192
%7 = icmp eq i32 %6, 128
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @rtp_check_hdr(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 192
%4 = icmp eq i32 %3, 128
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ experiment();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  while (n--)
    experiment();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     115f <main+0x3f>
mov    $0x0,%al
call   1030 <experiment@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     114e <main+0x2e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <experiment@plt>
subl   $0x1,0x4(%rsp)
jae    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, -1
store i32 %5, i32* %1
%6 = icmp eq i32 %4, 0
br i1 %6, label %12, label %7
7: ; preds = %0, %7
%8 = call i32 (...) @experiment()
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %0
ret i32 0
}
/* Type definitions */
struct goat3d_mesh {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gen_sphere_part(struct goat3d_mesh *, float, int, int,
                                   double, double);
void gen_sphere(struct goat3d_mesh *mesh, float rad, int usub, int vsub) {
  gen_sphere_part(mesh, rad, usub, vsub, 1.0, 1.0);
}


x86 assembly (clang, -O0):
<gen_sphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
movsd  0xec2(%rip),%xmm2
movaps %xmm2,%xmm1
call   1030 <gen_sphere_part@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_sphere>:
movsd  0xee8(%rip),%xmm1
movaps %xmm1,%xmm2
jmp    1030 <gen_sphere_part@plt>

LLVM IR (-O0):
%struct.goat3d_mesh = type { i32 }
define void @gen_sphere(%struct.goat3d_mesh* %0, float %1, i32 %2, i32 %3) {
%5 = alloca %struct.goat3d_mesh*
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
store %struct.goat3d_mesh* %0, %struct.goat3d_mesh** %5
store float %1, float* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.goat3d_mesh*, %struct.goat3d_mesh** %5
%10 = load float, float* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @gen_sphere_part(%struct.goat3d_mesh* %9, float %10, i32 %11, i32 %12, double 1.000000e+00, double 1.000000e+00)
ret void
}

LLVM IR (-O2):
%struct.goat3d_mesh = type { i32 }
define void @gen_sphere(%struct.goat3d_mesh* %0, float %1, i32 %2, i32 %3) {
%5 = tail call i32 @gen_sphere_part(%struct.goat3d_mesh* %0, float %1, i32 %2, i32 %3, double 1.000000e+00, double 1.000000e+00)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int growth(int /*<<< orphan*/);
int shrink(int /*<<< orphan*/);
int mod_len(off_t len) {
  if (len < 0)
    return (shrink(-len));
  else
    return (growth(len));
}


x86 assembly (clang, -O0):
<mod_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1147 <mod_len+0x27>
xor    %edi,%edi
sub    -0x8(%rbp),%edi
call   1040 <shrink@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <mod_len+0x32>
mov    -0x8(%rbp),%edi
call   1030 <growth@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod_len>:
test   %edi,%edi
js     1129 <mod_len+0x9>
jmp    1030 <growth@plt>
neg    %edi
jmp    1040 <shrink@plt>

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

LLVM IR (-O2):
define i32 @mod_len(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = sub nsw i32 0, %0
%5 = tail call i32 @shrink(i32 %4)
br label %8
6: ; preds = %1
%7 = tail call i32 @growth(i32 %0)
br label %8
8: ; preds = %6, %3
%9 = phi i32 [ %5, %3 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ uart_locked_puts(char *);
void test_print_locked() { uart_locked_puts(" __test_print_locked__ \n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c" __test_print_locked__ \0A\00"
define void @test_print_locked() {
%1 = call i32 @uart_locked_puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c" __test_print_locked__ \0A\00"
define void @test_print_locked() {
%1 = tail call i32 @uart_locked_puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
void swap(int *p, int k, int l) {
  int tmp = p[l];
  p[l] = p[k];
  p[k] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
__attribute__((__constructor__)) void __bdd_test_feature__(void) {
  printf("Feature: %s", "Queue test");
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"Feature: %s\00"
@.str.1 = [11 x i8] c"Queue test\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__bdd_test_feature__, i8* null }]
define void @__bdd_test_feature__() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Feature: %s\00"
@.str.1 = [11 x i8] c"Queue test\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__bdd_test_feature__, i8* null }]
define void @__bdd_test_feature__() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
double fabs(double);
int close_enough(double Q0, double Q) {
  return fabs(Q - Q0) < 1e-3 || (Q0 > 1e-3 && fabs(Q - Q0) / Q0 < 5e-2);
}


x86 assembly (clang, -O0):
<close_enough>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movaps 0xef1(%rip),%xmm0
pand   %xmm0,%xmm1
mov    $0x1,%al
movsd  0xed3(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     1188 <close_enough+0x88>
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
movsd  0xeb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x12(%rbp)
jbe    1182 <close_enough+0x82>
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movaps 0xea9(%rip),%xmm0
pand   %xmm0,%xmm1
divsd  -0x8(%rbp),%xmm1
movsd  0xe90(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_enough>:
subsd  %xmm0,%xmm1
andpd  0xef4(%rip),%xmm1
mov    $0x1,%eax
movsd  0xef7(%rip),%xmm2
ucomisd %xmm1,%xmm2
ja     1140 <close_enough+0x40>
xor    %eax,%eax
ucomisd 0xee7(%rip),%xmm0
jbe    1140 <close_enough+0x40>
divsd  %xmm0,%xmm1
movsd  0xee1(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @close_enough(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double %5, %6
%8 = call double @llvm.fabs.f64(double %7)
%9 = fcmp olt double %8, 1.000000e-03
br i1 %9, label %23, label %10
10: ; preds = %2
%11 = load double, double* %3
%12 = fcmp ogt double %11, 1.000000e-03
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load double, double* %4
%15 = load double, double* %3
%16 = fsub double %14, %15
%17 = call double @llvm.fabs.f64(double %16)
%18 = load double, double* %3
%19 = fdiv double %17, %18
%20 = fcmp olt double %19, 5.000000e-02
br label %21
21: ; preds = %13, %10
%22 = phi i1 [ false, %10 ], [ %20, %13 ]
br label %23
23: ; preds = %21, %2
%24 = phi i1 [ true, %2 ], [ %22, %21 ]
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @close_enough(double %0, double %1) {
%3 = fsub double %1, %0
%4 = tail call double @llvm.fabs.f64(double %3)
%5 = fcmp olt double %4, 1.000000e-03
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = fcmp ogt double %0, 1.000000e-03
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = fdiv double %4, %0
%10 = fcmp olt double %9, 5.000000e-02
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %8, %2
%13 = phi i32 [ 1, %2 ], [ 0, %6 ], [ %11, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ sha256(unsigned char const *, size_t, unsigned char *);
unsigned int sha256_first4(unsigned char const *in, size_t in_size) {
  unsigned char h[32];
  sha256(in, in_size, h);
  return (h[0] | (h[1] << 8) | (h[2] << 16) | (h[3] << 24));
}


x86 assembly (clang, -O0):
<sha256_first4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <sha256@plt>
movzbl -0x30(%rbp),%eax
movzbl -0x2f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x2e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x2d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha256_first4>:
sub    $0x28,%rsp
mov    %rsp,%rdx
call   1030 <sha256@plt>
mov    (%rsp),%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define i32 @sha256_first4(i8* %0, i64 %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = call i32 @sha256(i8* %0, i64 %1, i8* %4)
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl nuw nsw i32 %10, 8
%12 = or i32 %11, %7
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 2
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl nuw nsw i32 %15, 16
%17 = or i32 %12, %16
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 3
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = shl nuw i32 %20, 24
%22 = or i32 %17, %21
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void cleanup(void *data) {
  void **p = data;
  free(*p);
}


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

x86 assembly (clang, -O2):
<cleanup>:
mov    (%rdi),%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @cleanup(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = tail call i32 @free(i8* %3)
ret void
}
/* Type definitions */
typedef int uint;

/* Variables and functions */
char *string_newCapped(char const *, int);
char *string_substring(const char *str, uint start, uint end) {
  return string_newCapped(str + start, end - start);
}


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

x86 assembly (clang, -O2):
<string_substring>:
movslq %esi,%rax
add    %rax,%rdi
sub    %eax,%edx
mov    %edx,%esi
jmp    1030 <string_newCapped@plt>

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

LLVM IR (-O2):
define i8* @string_substring(i8* %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = sub nsw i32 %2, %1
%7 = tail call i8* @string_newCapped(i8* %5, i32 %6)
ret i8* %7
}
f(long long l, float f) {
  _Static_assert(__builtin_types_compatible_p(__typeof(l * f), float),
                 "long long not converted to float");
  return l * f;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
cvtsi2ssq -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cvtsi2ss %rdi,%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%eax
ret

LLVM IR (-O0):
define i32 @f(i64 %0, float %1) {
%3 = alloca i64
%4 = alloca float
store i64 %0, i64* %3
store float %1, float* %4
%5 = load i64, i64* %3
%6 = sitofp i64 %5 to float
%7 = load float, float* %4
%8 = fmul float %6, %7
%9 = fptosi float %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f(i64 %0, float %1) {
%3 = sitofp i64 %0 to float
%4 = fmul float %3, %1
%5 = fptosi float %4 to i32
ret i32 %5
}
const char *get_printable_bool(int value) {
  switch (value) {
  case 0:
    return "false";
  default:
    return "true";
  }
}


x86 assembly (clang, -O0):
<get_printable_bool>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
test   %eax,%eax
jne    1127 <get_printable_bool+0x27>
jmp    1117 <get_printable_bool+0x17>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1132 <get_printable_bool+0x32>
lea    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_printable_bool>:
test   %edi,%edi
lea    0xef7(%rip),%rcx
lea    0xef6(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"false\00"
@.str.1 = [5 x i8] c"true\00"
define i8* @get_printable_bool(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 0, label %5
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %7
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %7
7: ; preds = %6, %5
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"false\00"
@.str.1 = [5 x i8] c"true\00"
define i8* @get_printable_bool(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
int checkMove(char *playground, int posx, int posy) {
  if (playground[(posy - 1) * 3 + posx - 1] == ' ')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<checkMove>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    113d <checkMove+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <checkMove+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkMove>:
lea    (%rdx,%rdx,2),%eax
add    %esi,%eax
add    $0xfffffffc,%eax
movslq %eax,%rcx
xor    %eax,%eax
cmpb   $0x20,(%rdi,%rcx,1)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @checkMove(i8* nocapture %0, i32 %1, i32 %2) {
%4 = mul i32 %2, 3
%5 = add i32 %1, -4
%6 = add i32 %5, %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 32
%11 = zext i1 %10 to i32
ret i32 %11
}
void g_arith_pow_f_s64(void *s, void *d, void *o) {}


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

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

LLVM IR (-O0):
define void @g_arith_pow_f_s64(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @g_arith_pow_f_s64(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
double log(int);
double log2(double x) { return log(x) / log(2.); }


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @log(i32 %4)
%6 = call double @log(i32 2)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @log2(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = tail call double @log(i32 2)
%5 = fdiv double %3, %4
ret double %5
}
/* Type definitions */
struct ylist_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __list_del_entry(struct ylist_head *);
int /*<<< orphan*/ ylist_add_tail(struct ylist_head *, struct ylist_head *);
void ylist_move_tail(struct ylist_head *list, struct ylist_head *head) {
  __list_del_entry(list);
  ylist_add_tail(list, head);
}


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

x86 assembly (clang, -O2):
<ylist_move_tail>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <__list_del_entry@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ylist_add_tail@plt>

LLVM IR (-O0):
%struct.ylist_head = type { i32 }
define void @ylist_move_tail(%struct.ylist_head* %0, %struct.ylist_head* %1) {
%3 = alloca %struct.ylist_head*
%4 = alloca %struct.ylist_head*
store %struct.ylist_head* %0, %struct.ylist_head** %3
store %struct.ylist_head* %1, %struct.ylist_head** %4
%5 = load %struct.ylist_head*, %struct.ylist_head** %3
%6 = call i32 @__list_del_entry(%struct.ylist_head* %5)
%7 = load %struct.ylist_head*, %struct.ylist_head** %3
%8 = load %struct.ylist_head*, %struct.ylist_head** %4
%9 = call i32 @ylist_add_tail(%struct.ylist_head* %7, %struct.ylist_head* %8)
ret void
}

LLVM IR (-O2):
%struct.ylist_head = type { i32 }
define void @ylist_move_tail(%struct.ylist_head* %0, %struct.ylist_head* %1) {
%3 = tail call i32 @__list_del_entry(%struct.ylist_head* %0)
%4 = tail call i32 @ylist_add_tail(%struct.ylist_head* %0, %struct.ylist_head* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int const);
void lin_rsk_close(const int sockfd) { close(sockfd); }


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

LLVM IR (-O0):
define void @lin_rsk_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 @lin_rsk_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
double **qdmatrix(nrl, nrh, ncl, nch)
int nrl, nrh, ncl, nch;
{ return (dmatrix(nrl, nrh, ncl, nch)); }


x86 assembly (clang, -O0):
<qdmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x0,%al
call   1030 <dmatrix@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define double** @qdmatrix(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* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @dmatrix to i32 (i32, i32, i32, i32, ...)*)(i32 %9, i32 %10, i32 %11, i32 %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to double**
ret double** %15
}

LLVM IR (-O2):
define double** @qdmatrix(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @dmatrix to i32 (i32, i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 %2, i32 %3)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to double**
ret double** %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bitmapOptions() {
  printf("\t-i\tinverted. Flips bitmap vertically\n");
  printf("\t-m\tmirrored. Flips bitmap horizontally\n");
}


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

x86 assembly (clang, -O2):
<bitmapOptions>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"\09-i\09inverted. Flips bitmap vertically\0A\00"
@.str.1 = [41 x i8] c"\09-m\09mirrored. Flips bitmap horizontally\0A\00"
define void @bitmapOptions() {
%1 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [38 x i8] c"\09-i\09inverted. Flips bitmap vertically\00"
@str.2 = [40 x i8] c"\09-m\09mirrored. Flips bitmap horizontally\00"
define void @bitmapOptions() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.2, i64 0, i64 0))
ret void
}
void insl(int port, void *addr, unsigned long count) {
  __asm__ __volatile__("rep; ins"
                       "l"
                       : "+D"(addr), "+c"(count)
                       : "d"(port));
}


x86 assembly (clang, -O0):
<insl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%edx
rep insl (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insl>:
mov    %rdx,%rcx
mov    %edi,%edx
mov    %rsi,%rdi
rep insl (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insl(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32, i32* %4
%10 = call { i8*, i64 } asm sideeffect "rep; insl", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %9, i8* %7, i64 %8)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @insl(i32 %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep; insl", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i64 %2)
ret void
}
int test_imm_1Euint8_reg(unsigned char val) {
  return ((val) & (-0x1E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Euint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffffe2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_1Euint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -30
%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_1Euint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -30
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}