xunge/DecIR huggingface dataset:
int msgidxof(int code) {
  return (0                                ? 0
          : ((code >= 0) && (code <= 14))  ? (code - 0)
          : ((code >= 31) && (code <= 35)) ? (code - 16)
                                           : 36 - 16);
}


x86 assembly (clang, -O0):
<msgidxof>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1129 <msgidxof+0x29>
cmpl   $0xe,-0x4(%rbp)
jg     1129 <msgidxof+0x29>
mov    -0x4(%rbp),%eax
sub    $0x0,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <msgidxof+0x5e>
cmpl   $0x1f,-0x4(%rbp)
jl     114b <msgidxof+0x4b>
cmpl   $0x23,-0x4(%rbp)
jg     114b <msgidxof+0x4b>
mov    -0x4(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <msgidxof+0x58>
mov    $0x14,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <msgidxof+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgidxof>:
lea    -0x1f(%rdi),%eax
lea    -0x10(%rdi),%ecx
cmp    $0x5,%eax
mov    $0x14,%eax
cmovb  %ecx,%eax
cmp    $0xf,%edi
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @msgidxof(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 14
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 0
br label %23
11: ; preds = %5, %1
%12 = load i32, i32* %2
%13 = icmp sge i32 %12, 31
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 35
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 16
br label %21
20: ; preds = %14, %11
br label %21
21: ; preds = %20, %17
%22 = phi i32 [ %19, %17 ], [ 20, %20 ]
br label %23
23: ; preds = %21, %8
%24 = phi i32 [ %10, %8 ], [ %22, %21 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @msgidxof(i32 %0) {
%2 = icmp ult i32 %0, 15
%3 = add i32 %0, -31
%4 = icmp ult i32 %3, 5
%5 = add nsw i32 %0, -16
%6 = select i1 %4, i32 %5, i32 20
%7 = select i1 %2, i32 %0, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ _mcxx_collectroots();
int /*<<< orphan*/ _mcxx_markroots();
int /*<<< orphan*/ _mcxx_scanroots();
void _mcxx_collectcycles(void) {
  _mcxx_markroots();
  _mcxx_scanroots();
  _mcxx_collectroots();
}


x86 assembly (clang, -O0):
<_mcxx_collectcycles>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <_mcxx_markroots@plt>
mov    $0x0,%al
call   1050 <_mcxx_scanroots@plt>
mov    $0x0,%al
call   1030 <_mcxx_collectroots@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mcxx_collectcycles>:
push   %rax
xor    %eax,%eax
call   1040 <_mcxx_markroots@plt>
xor    %eax,%eax
call   1050 <_mcxx_scanroots@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <_mcxx_collectroots@plt>

LLVM IR (-O0):
define void @_mcxx_collectcycles() {
%1 = call i32 (...) @_mcxx_markroots()
%2 = call i32 (...) @_mcxx_scanroots()
%3 = call i32 (...) @_mcxx_collectroots()
ret void
}

LLVM IR (-O2):
define void @_mcxx_collectcycles() {
%1 = tail call i32 (...) @_mcxx_markroots()
%2 = tail call i32 (...) @_mcxx_scanroots()
%3 = tail call i32 (...) @_mcxx_collectroots()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void FCEUD_SetEmulationSpeed(int cmd) {
  printf("SetEmulationSpeed not implemented.\n");
}


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

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

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

LLVM IR (-O2):
@str = [35 x i8] c"SetEmulationSpeed not implemented.\00"
define void @FCEUD_SetEmulationSpeed(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}
void reset_control_put(struct reset_control *rstc) {}


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

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

LLVM IR (-O0):
%struct.reset_control = type opaque
define void @reset_control_put(%struct.reset_control* %0) {
%2 = alloca %struct.reset_control*
store %struct.reset_control* %0, %struct.reset_control** %2
ret void
}

LLVM IR (-O2):
%struct.reset_control = type opaque
define void @reset_control_put(%struct.reset_control* nocapture %0) {
ret void
}
void rtw_debugfs_init(struct rtw_dev *rtwdev) {}


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

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

LLVM IR (-O0):
%struct.rtw_dev = type opaque
define void @rtw_debugfs_init(%struct.rtw_dev* %0) {
%2 = alloca %struct.rtw_dev*
store %struct.rtw_dev* %0, %struct.rtw_dev** %2
ret void
}

LLVM IR (-O2):
%struct.rtw_dev = type opaque
define void @rtw_debugfs_init(%struct.rtw_dev* nocapture %0) {
ret void
}
unsigned long sancus_bit_unmask(unsigned long value, unsigned mask,
                                unsigned shift) {
  return (value >> shift) & mask;
}


x86 assembly (clang, -O0):
<sancus_bit_unmask>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shr    %cl,%rax
mov    -0xc(%rbp),%ecx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_bit_unmask>:
mov    %edx,%ecx
mov    %rdi,%rax
shr    %cl,%rax
and    %esi,%eax
ret

LLVM IR (-O0):
define i64 @sancus_bit_unmask(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i32, i32* %6
%9 = zext i32 %8 to i64
%10 = lshr i64 %7, %9
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = and i64 %10, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @sancus_bit_unmask(i64 %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = lshr i64 %0, %4
%6 = zext i32 %1 to i64
%7 = and i64 %5, %6
ret i64 %7
}
int compare_double(const void *a, const void *b) {
  return (int)(*(double *)a - *(double *)b);
}


x86 assembly (clang, -O0):
<compare_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_double>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @compare_double(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to double*
%7 = load double, double* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = fptosi double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @compare_double(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ double_t;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sin(double);
double toRadians(int);
int main() {
  double a = toRadians(60);
  double_t sin_a = sin(a);
  printf("san(30) =%lf", sin_a);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3c,%edi
call   1050 <toRadians@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3c,%edi
call   1050 <toRadians@plt>
call   1040 <sin@plt>
lea    0xeb9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"san(30) =%lf\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
%4 = call double @toRadians(i32 60)
store double %4, double* %2
%5 = load double, double* %2
%6 = call i32 @sin(double %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}

LLVM IR (-O2):
@.str = [13 x i8] c"san(30) =%lf\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call double @toRadians(i32 60)
%2 = tail call i32 @sin(double %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ search_by_type(int, int, char *);
int handle_list(int devfd) {
  search_by_type(devfd, 16, "switch/appliance");
  search_by_type(devfd, 17, "dimmer");
  search_by_type(devfd, 8, "thermostat");
  search_by_type(devfd, 1, "controller");
  return 0;
}


x86 assembly (clang, -O0):
<handle_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x10,%esi
lea    0xed6(%rip),%rdx
call   1030 <search_by_type@plt>
mov    -0x4(%rbp),%edi
mov    $0x11,%esi
lea    0xed3(%rip),%rdx
call   1030 <search_by_type@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
lea    0xec6(%rip),%rdx
call   1030 <search_by_type@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
lea    0xebd(%rip),%rdx
call   1030 <search_by_type@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_list>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdx
mov    $0x10,%esi
call   1030 <search_by_type@plt>
lea    0xee6(%rip),%rdx
mov    %ebx,%edi
mov    $0x11,%esi
call   1030 <search_by_type@plt>
lea    0xeda(%rip),%rdx
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <search_by_type@plt>
lea    0xed2(%rip),%rdx
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <search_by_type@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"switch/appliance\00"
@.str.1 = [7 x i8] c"dimmer\00"
@.str.2 = [11 x i8] c"thermostat\00"
@.str.3 = [11 x i8] c"controller\00"
define i32 @handle_list(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @search_by_type(i32 %3, i32 16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @search_by_type(i32 %5, i32 17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @search_by_type(i32 %7, i32 8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = call i32 @search_by_type(i32 %9, i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"switch/appliance\00"
@.str.1 = [7 x i8] c"dimmer\00"
@.str.2 = [11 x i8] c"thermostat\00"
@.str.3 = [11 x i8] c"controller\00"
define i32 @handle_list(i32 %0) {
%2 = tail call i32 @search_by_type(i32 %0, i32 16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @search_by_type(i32 %0, i32 17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @search_by_type(i32 %0, i32 8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @search_by_type(i32 %0, i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
double quinticEaseOutd(double p) {
  double f = (p - 1);
  return f * f * f * f * f + 1;
}


x86 assembly (clang, -O0):
<quinticEaseOutd>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<quinticEaseOutd>:
addsd  0xef8(%rip),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
addsd  0xee4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @quinticEaseOutd(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fsub double %4, 1.000000e+00
store double %5, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fmul double %6, %7
%9 = load double, double* %3
%10 = fmul double %8, %9
%11 = load double, double* %3
%12 = fmul double %10, %11
%13 = load double, double* %3
%14 = call double @llvm.fmuladd.f64(double %12, double %13, double 1.000000e+00)
ret double %14
}

LLVM IR (-O2):
define double @quinticEaseOutd(double %0) {
%2 = fadd double %0, -1.000000e+00
%3 = fmul double %2, %2
%4 = fmul double %2, %3
%5 = fmul double %2, %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double %2, double 1.000000e+00)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void bar(int n) {
  if (!n)
    return;
  foo(n - 1);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112a <bar+0x1a>
jmp    1135 <bar+0x25>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
test   %edi,%edi
je     111c <bar+0xc>
add    $0xffffffff,%edi
jmp    1030 <foo@plt>
ret

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

LLVM IR (-O2):
define void @bar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @foo(i32 %4)
br label %6
6: ; preds = %1, %3
ret void
}
void uip_UdpAppHubCall(void) {}


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

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

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

LLVM IR (-O2):
define void @uip_UdpAppHubCall() {
ret void
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ my_abort();
int sw2(int a) {
  switch (a) {
  case 0:
    my_abort();
  case 1:
    return 2;
  case 2:
    return getpid();
  default:
    break;
  }
  return 1;
}


x86 assembly (clang, -O0):
<sw2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1160 <sw2+0x40>
jmp    113e <sw2+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1167 <sw2+0x47>
jmp    114f <sw2+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1173 <sw2+0x53>
jmp    1182 <sw2+0x62>
mov    $0x0,%al
call   1040 <my_abort@plt>
movl   $0x2,-0x4(%rbp)
jmp    118e <sw2+0x6e>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
jmp    118e <sw2+0x6e>
jmp    1187 <sw2+0x67>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sw2>:
cmp    $0x2,%edi
je     113d <sw2+0x1d>
push   %rbx
mov    $0x2,%ebx
cmp    $0x1,%edi
je     1149 <sw2+0x29>
test   %edi,%edi
jne    1144 <sw2+0x24>
xor    %eax,%eax
call   1040 <my_abort@plt>
jmp    1149 <sw2+0x29>
xor    %eax,%eax
jmp    1030 <getpid@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sw2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 0, label %5
i32 1, label %7
i32 2, label %8
]
5: ; preds = %1
%6 = call i32 (...) @my_abort()
br label %7
7: ; preds = %1, %5
store i32 2, i32* %2
br label %12
8: ; preds = %1
%9 = call i32 (...) @getpid()
store i32 %9, i32* %2
br label %12
10: ; preds = %1
br label %11
11: ; preds = %10
store i32 1, i32* %2
br label %12
12: ; preds = %11, %8, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @sw2(i32 %0) {
switch i32 %0, label %6 [
i32 0, label %2
i32 1, label %7
i32 2, label %4
]
2: ; preds = %1
%3 = tail call i32 (...) @my_abort()
br label %7
4: ; preds = %1
%5 = tail call i32 (...) @getpid()
br label %7
6: ; preds = %1
br label %7
7: ; preds = %2, %1, %6, %4
%8 = phi i32 [ 1, %6 ], [ %5, %4 ], [ 2, %1 ], [ 2, %2 ]
ret i32 %8
}
/* Variables and functions */
scalar_t__ fac(int);
void benchmark(void) {
  int i;
  volatile int s = 0;
  volatile int n;
  n = 10;
  for (i = 0; i <= n; i++)
    s += fac(i);
}


x86 assembly (clang, -O0):
<benchmark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     115f <benchmark+0x4f>
mov    -0x4(%rbp),%edi
call   1030 <fac@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%eax
cltq
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112d <benchmark+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0xa,0x8(%rsp)
cmpl   $0x0,0x8(%rsp)
js     1154 <benchmark+0x44>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %ebx,%edi
call   1030 <fac@plt>
add    %eax,0xc(%rsp)
cmp    0x8(%rsp),%ebx
jl     1140 <benchmark+0x30>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @benchmark() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store volatile i32 10, i32* %2
%5 = load volatile i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %13, %7 ], [ 0, %0 ]
%9 = tail call i64 @fac(i32 %8)
%10 = load volatile i32, i32* %1
%11 = trunc i64 %9 to i32
%12 = add i32 %10, %11
store volatile i32 %12, i32* %1
%13 = add nuw nsw i32 %8, 1
%14 = load volatile i32, i32* %2
%15 = icmp slt i32 %8, %14
br i1 %15, label %7, label %16
16: ; preds = %7, %0
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ in_port_t;
typedef int /*<<< orphan*/ in_addr_t;

/* Variables and functions */
int GetRSSHash(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
               int /*<<< orphan*/);
int GetRSSCPUCore(in_addr_t sip, in_addr_t dip, in_port_t sp, in_port_t dp,
                  int num_queues) {
  static const uint32_t off[4] = {3, 1, -1, -3};
  uint32_t masked = GetRSSHash(sip, dip, sp, dp) & 0x0000007F;
  masked += off[masked & 0x3];
  return (masked % num_queues);
}


x86 assembly (clang, -O0):
<GetRSSCPUCore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <GetRSSHash@plt>
and    $0x7f,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
and    $0x3,%eax
movslq %eax,%rcx
lea    0xeb1(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRSSCPUCore>:
push   %rbx
mov    %r8d,%ebx
call   1030 <GetRSSHash@plt>
mov    %eax,%ecx
and    $0x7f,%ecx
and    $0x3,%eax
lea    0xed8(%rip),%rdx
add    (%rdx,%rax,4),%ecx
mov    %ecx,%eax
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@GetRSSCPUCore.off = internal constant [4 x i32] [i32 3, i32 1, i32 -1, i32 -3]
define i32 @GetRSSCPUCore(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = call i32 @GetRSSHash(i32 %12, i32 %13, i32 %14, i32 %15)
%17 = and i32 %16, 127
store i32 %17, i32* %11
%18 = load i32, i32* %11
%19 = and i32 %18, 3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x i32], [4 x i32]* @GetRSSCPUCore.off, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* %11
%24 = add nsw i32 %23, %22
store i32 %24, i32* %11
%25 = load i32, i32* %11
%26 = load i32, i32* %10
%27 = srem i32 %25, %26
ret i32 %27
}

LLVM IR (-O2):
@GetRSSCPUCore.off = internal unnamed_addr constant [4 x i32] [i32 3, i32 1, i32 -1, i32 -3]
define i32 @GetRSSCPUCore(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @GetRSSHash(i32 %0, i32 %1, i32 %2, i32 %3)
%7 = and i32 %6, 127
%8 = and i32 %6, 3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [4 x i32], [4 x i32]* @GetRSSCPUCore.off, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = add nsw i32 %7, %11
%13 = srem i32 %12, %4
ret i32 %13
}
/* Variables and functions */
int chdir(char *);
int cd(char *path) { return chdir(path); }


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

x86 assembly (clang, -O2):
<cd>:
jmp    1030 <chdir@plt>

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

LLVM IR (-O2):
define i32 @cd(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void computeKey(int key_num, char dest[8]) { sprintf(dest, "%d", key_num); }


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

x86 assembly (clang, -O2):
<computeKey>:
mov    %rsi,%rax
mov    %edi,%edx
lea    0xee4(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @computeKey(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @computeKey(i32 %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
void *lzfse_reallocf(void *x, size_t s) {
  void *y = realloc(x, s);
  if (y == 0) {
    free(x);
    return 0;
  }
  return y;
}


x86 assembly (clang, -O0):
<lzfse_reallocf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1162 <lzfse_reallocf+0x42>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    116a <lzfse_reallocf+0x4a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lzfse_reallocf>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113c <lzfse_reallocf+0x1c>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @lzfse_reallocf(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @free(i8* %0)
br label %7
7: ; preds = %2, %5
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *);
char *smartokcmd(const char *path, char *cmdresult) {
  sprintf(cmdresult,
          "disktool -H %s | grep 'Health Status' | cut -f 2 -d ':' 1>/dev/null "
          "2>/dev/null",
          path);
  return cmdresult;
}


x86 assembly (clang, -O0):
<smartokcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smartokcmd>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rdx
lea    0xee2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [80 x i8] c"disktool -H %s | grep 'Health Status' | cut -f 2 -d ':' 1>/dev/null 2>/dev/null\00"
define i8* @smartokcmd(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 = load i8*, i8** %3
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %4
ret i8* %8
}

LLVM IR (-O2):
@.str = [80 x i8] c"disktool -H %s | grep 'Health Status' | cut -f 2 -d ':' 1>/dev/null 2>/dev/null\00"
define i8* @smartokcmd(i8* %0, i8* returned writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %1
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t swap_endian(uint8_t LSB, uint8_t MSB) {
  uint16_t ret = (uint16_t)MSB;
  ret = ret << 8;
  ret = ret | (uint16_t)LSB;
  return ret;
}


x86 assembly (clang, -O0):
<swap_endian>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_endian>:
mov    %rdi,%rax
shl    $0x8,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @swap_endian(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = trunc i64 %6 to i32
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = shl i32 %8, 8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i64, i64* %3
%12 = trunc i64 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %5
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @swap_endian(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl i32 %3, 8
%5 = trunc i64 %0 to i32
%6 = or i32 %4, %5
ret i32 %6
}
int initialize_accelerometer_sensor(struct ssp_data *data) { return 0; }


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

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

LLVM IR (-O0):
%struct.ssp_data = type opaque
define i32 @initialize_accelerometer_sensor(%struct.ssp_data* %0) {
%2 = alloca %struct.ssp_data*
store %struct.ssp_data* %0, %struct.ssp_data** %2
ret i32 0
}

LLVM IR (-O2):
%struct.ssp_data = type opaque
define i32 @initialize_accelerometer_sensor(%struct.ssp_data* nocapture readnone %0) {
ret i32 0
}
int st_lngcmp(const void *a, const void *b, void *data) {
  return (*(const long *)a == *(const long *)b) ? 0 : -1;
}


x86 assembly (clang, -O0):
<st_lngcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_lngcmp>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmp    (%rsi),%rcx
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @st_lngcmp(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i64*
%12 = load i64, i64* %11
%13 = icmp eq i64 %9, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 0, i32 -1
ret i32 %15
}

LLVM IR (-O2):
define i32 @st_lngcmp(i8* nocapture %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = bitcast i8* %0 to i64*
%5 = load i64, i64* %4
%6 = bitcast i8* %1 to i64*
%7 = load i64, i64* %6
%8 = icmp ne i64 %5, %7
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *longestPalindrome(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char *r = longestPalindrome(argv[1]);
  printf("Longest Palindomic Substring is: %s\n", r);
  free(r);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1050 <longestPalindrome@plt>
mov    %rax,%rbx
lea    0xebc(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Longest Palindomic Substring is: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i8* @longestPalindrome(i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %6
%14 = call i32 @free(i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Longest Palindomic Substring is: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i8* @longestPalindrome(i8* %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @free(i8* %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _IO(unsigned char, int);
int ioctl(int, int /*<<< orphan*/);
int is_pin_attaching(int fd_spec) { return ioctl(fd_spec, _IO('u', 26)); }


x86 assembly (clang, -O0):
<is_pin_attaching>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x75,%edi
mov    $0x1a,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_pin_attaching>:
push   %rbx
mov    %edi,%ebx
mov    $0x75,%edi
mov    $0x1a,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @is_pin_attaching(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_IO(i8 zeroext 117, i32 26)
%5 = call i32 @ioctl(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_pin_attaching(i32 %0) {
%2 = tail call i32 @_IO(i8 zeroext 117, i32 26)
%3 = tail call i32 @ioctl(i32 %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int foo(int);
int start(int a) {
  int n = 10;
  return foo(n + a);
}


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

x86 assembly (clang, -O2):
<start>:
add    $0xa,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define i32 @start(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 10, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = add nsw i32 %4, %5
%7 = call i32 @foo(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @start(i32 %0) {
%2 = add nsw i32 %0, 10
%3 = tail call i32 @foo(i32 %2)
ret i32 %3
}
float ptriangle(float a1, float a2, float a3) { return (a1 + a2 + a3); }


x86 assembly (clang, -O0):
<ptriangle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptriangle>:
addss  %xmm1,%xmm0
addss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @ptriangle(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fadd float %7, %8
%10 = load float, float* %6
%11 = fadd float %9, %10
ret float %11
}

LLVM IR (-O2):
define float @ptriangle(float %0, float %1, float %2) {
%4 = fadd float %0, %1
%5 = fadd float %4, %2
ret float %5
}
double SQRT(statlink, x)
int *statlink;
double x;
{ return (_sqt(x)); }


x86 assembly (clang, -O0):
<SQRT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <_sqt@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SQRT>:
push   %rax
mov    $0x1,%al
call   1030 <_sqt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @SQRT(i32* %0, double %1) {
%3 = alloca i32*
%4 = alloca double
store i32* %0, i32** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = call i32 (double, ...) bitcast (i32 (...)* @_sqt to i32 (double, ...)*)(double %5)
%7 = sitofp i32 %6 to double
ret double %7
}

LLVM IR (-O2):
define double @SQRT(i32* nocapture readnone %0, double %1) {
%3 = tail call i32 (double, ...) bitcast (i32 (...)* @_sqt to i32 (double, ...)*)(double %1)
%4 = sitofp i32 %3 to double
ret double %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t T(int t) { return (t & 0x1) << 4; }


x86 assembly (clang, -O0):
<T>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
shl    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<T>:
mov    %edi,%eax
shl    $0x4,%eax
and    $0x10,%eax
ret

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

LLVM IR (-O2):
define i32 @T(i32 %0) {
%2 = shl i32 %0, 4
%3 = and i32 %2, 16
ret i32 %3
}
int explicit_radix(const char *str) {
  if (str[0] != '#')
    return 0;
  switch (str[1]) {
  case 'b':
    return 2;
  case 'o':
    return 8;
  case 'd':
    return 10;
  case 'x':
    return 16;
  }
  return 0;
}


x86 assembly (clang, -O0):
<explicit_radix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     1124 <explicit_radix+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1189 <explicit_radix+0x89>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x16,%eax
ja     1182 <explicit_radix+0x82>
mov    -0x18(%rbp),%rax
lea    0xeb7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    1189 <explicit_radix+0x89>
movl   $0x8,-0x4(%rbp)
jmp    1189 <explicit_radix+0x89>
movl   $0xa,-0x4(%rbp)
jmp    1189 <explicit_radix+0x89>
movl   $0x10,-0x4(%rbp)
jmp    1189 <explicit_radix+0x89>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<explicit_radix>:
xor    %eax,%eax
cmpb   $0x23,(%rdi)
jne    1130 <explicit_radix+0x30>
movsbl 0x1(%rdi),%ecx
add    $0xffffff9e,%ecx
cmp    $0x16,%ecx
ja     112e <explicit_radix+0x2e>
mov    $0x2,%eax
lea    0xee1(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xa,%eax
ret
xor    %eax,%eax
ret
mov    $0x8,%eax
ret
mov    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @explicit_radix(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 35
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %20
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %19 [
i32 98, label %15
i32 111, label %16
i32 100, label %17
i32 120, label %18
]
15: ; preds = %10
store i32 2, i32* %2
br label %20
16: ; preds = %10
store i32 8, i32* %2
br label %20
17: ; preds = %10
store i32 10, i32* %2
br label %20
18: ; preds = %10
store i32 16, i32* %2
br label %20
19: ; preds = %10
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %17, %16, %15, %9
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @explicit_radix(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 35
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %11 [
i32 98, label %12
i32 111, label %8
i32 100, label %9
i32 120, label %10
]
8: ; preds = %4
br label %12
9: ; preds = %4
br label %12
10: ; preds = %4
br label %12
11: ; preds = %4
br label %12
12: ; preds = %4, %1, %11, %10, %9, %8
%13 = phi i32 [ 0, %11 ], [ 16, %10 ], [ 10, %9 ], [ 8, %8 ], [ 0, %1 ], [ 2, %4 ]
ret i32 %13
}
int main(void) { return (42 + 28); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x46,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 70
}
int main() {
  int N, n, x, y, z;
  n = 0;
  x = 0;
  y = 1;
  z = 6;
  while (n <= N) {
    n = n + 1;
    x = x + y;
    y = y + z;
    z = z + 6;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x6,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     115c <main+0x5c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x18(%rbp)
jmp    1127 <main+0x27>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char a[100], b[101];
  b[100] = 0;
  strcpy(a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movb   $0x0,-0x7c(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xd8,%rsp
movb   $0x0,0x64(%rsp)
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0xd8,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [101 x i8]
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 100
store i8 0, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%6 = call i32 @strcpy(i8* %4, i8* %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [101 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 100
store i8 0, i8* %5
%6 = call i32 @strcpy(i8* %3, i8* %4)
ret i32 0
}
int derefAssignment(int *p) { return *p; }


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

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

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

LLVM IR (-O2):
define i32 @derefAssignment(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int strlen(const char *str) {
  int i = 0;
  while (*str++)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int f3_cmp(long double, long double);
int __getf2(long double a, long double b) { return -f3_cmp(b, a); }


x86 assembly (clang, -O0):
<__getf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <f3_cmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getf2>:
sub    $0x28,%rsp
fldt   0x40(%rsp)
fldt   0x30(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <f3_cmp@plt>
neg    %eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @__getf2(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* %4
%6 = load x86_fp80, x86_fp80* %3
%7 = call i32 @f3_cmp(x86_fp80 %5, x86_fp80 %6)
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @__getf2(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i32 @f3_cmp(x86_fp80 %1, x86_fp80 %0)
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
char *xstrdup(char const *);
char *xstrdup_or_null(const char *str) { return str ? xstrdup(str) : NULL; }


x86 assembly (clang, -O0):
<xstrdup_or_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1139 <xstrdup_or_null+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <xstrdup@plt>
mov    %rax,-0x10(%rbp)
jmp    1144 <xstrdup_or_null+0x34>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1144 <xstrdup_or_null+0x34>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup_or_null>:
test   %rdi,%rdi
je     111a <xstrdup_or_null+0xa>
jmp    1030 <xstrdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @xstrdup_or_null(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i8* @xstrdup(i8* %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i8* [ %7, %5 ], [ null, %8 ]
ret i8* %10
}

LLVM IR (-O2):
define i8* @xstrdup_or_null(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @xstrdup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
/* Variables and functions */
int rand();
int M_RandomInt(int lower, int upper) {
  return (rand() % (upper - lower + 1) + lower);
}


x86 assembly (clang, -O0):
<M_RandomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_RandomInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @M_RandomInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @M_RandomInt(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}