xunge/DecIR huggingface dataset:
int myround(x)
float x;
{ return ((int)rint((double)x)); }


x86 assembly (clang, -O0):
<myround>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <rint@plt>
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myround>:
push   %rax
cvtsd2ss %xmm0,%xmm0
call   1030 <rintf@plt>
cvttss2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @myround(double %0) {
%2 = alloca float
%3 = fptrunc double %0 to float
store float %3, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = call double @llvm.rint.f64(double %5)
%7 = fptosi double %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @myround(double %0) {
%2 = fptrunc double %0 to float
%3 = tail call float @llvm.rint.f32(float %2)
%4 = fptosi float %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Trace_addFunc(char *);
void arg_setTrace(char *func) { Trace_addFunc(func); }


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

x86 assembly (clang, -O2):
<arg_setTrace>:
jmp    1030 <Trace_addFunc@plt>

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

LLVM IR (-O2):
define void @arg_setTrace(i8* %0) {
%2 = tail call i32 @Trace_addFunc(i8* %0)
ret void
}
void ble_rsp_gap_set_mode(const struct ble_msg_gap_set_mode_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_gap_set_mode_rsp_t = type opaque
define void @ble_rsp_gap_set_mode(%struct.ble_msg_gap_set_mode_rsp_t* nocapture %0) {
ret void
}
int get_opcode(unsigned char *addr, unsigned int *opcode) {
  int len;
  if (*addr == 0x0F) {
    *opcode = *(unsigned short *)addr;
    len = 2;
  } else {
    *opcode = *addr;
    len = 1;
  }
  return len;
}


x86 assembly (clang, -O0):
<get_opcode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xf,%eax
jne    1135 <get_opcode+0x35>
mov    -0x8(%rbp),%rax
movzwl (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x2,-0x14(%rbp)
jmp    1149 <get_opcode+0x49>
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_opcode>:
movzbl (%rdi),%ecx
cmp    $0xf,%ecx
jne    1113 <get_opcode+0x13>
movzwl (%rdi),%ecx
mov    $0x2,%eax
mov    %ecx,(%rsi)
ret
mov    $0x1,%eax
mov    %ecx,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @get_opcode(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 15
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = bitcast i8* %0 to i16*
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
br label %11
9: ; preds = %2
%10 = zext i8 %3 to i32
br label %11
11: ; preds = %9, %5
%12 = phi i32 [ %10, %9 ], [ %8, %5 ]
%13 = phi i32 [ 1, %9 ], [ 2, %5 ]
store i32 %12, i32* %1
ret i32 %13
}
void radixSort(int a[], int n) {
  int i;
  void innerCountingSort(int a[], int n, int d);
  for (i = 0; i < 4; i++) {
    innerCountingSort(a, n, i);
  }
}


x86 assembly (clang, -O0):
<radixSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    114d <radixSort+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <innerCountingSort@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <radixSort+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radixSort>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edx,%edx
call   1030 <innerCountingSort@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
call   1030 <innerCountingSort@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
call   1030 <innerCountingSort@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <innerCountingSort@plt>

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

LLVM IR (-O2):
define void @radixSort(i32* %0, i32 %1) {
tail call void @innerCountingSort(i32* %0, i32 %1, i32 0)
tail call void @innerCountingSort(i32* %0, i32 %1, i32 1)
tail call void @innerCountingSort(i32* %0, i32 %1, i32 2)
tail call void @innerCountingSort(i32* %0, i32 %1, i32 3)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int log2_int32(uint32_t value) {
  int i;
  for (i = 0; i < 32; i++) {
    value >>= 1;
    if (value == 0)
      break;
  }
  return i;
}


x86 assembly (clang, -O0):
<log2_int32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    1143 <log2_int32+0x43>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1130 <log2_int32+0x30>
jmp    1143 <log2_int32+0x43>
jmp    1135 <log2_int32+0x35>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <log2_int32+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2_int32>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     1125 <log2_int32+0x25>
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%ecx
lea    0x1(%rcx),%eax
cmp    $0x1e,%ecx
ja     1125 <log2_int32+0x25>
mov    %edi,%ecx
sar    %ecx
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <log2_int32+0x10>
ret

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

LLVM IR (-O2):
define i32 @log2_int32(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = ashr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %4, 30
%9 = icmp ult i32 %5, 4
%10 = select i1 %8, i1 true, i1 %9
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %12
}
void foo149(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo149(i32 %0) {
ret void
}
double convert_to_mv(int given) {
  double d;
  d = given * 1.0;
  d *= 5020.0 / 1024;
  return (d);
}


x86 assembly (clang, -O0):
<convert_to_mv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xef4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_mv>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @convert_to_mv(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 1.000000e+00
store double %6, double* %3
%7 = load double, double* %3
%8 = fmul double %7, 0x40139C0000000000
store double %8, double* %3
%9 = load double, double* %3
ret double %9
}

LLVM IR (-O2):
define double @convert_to_mv(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 0x40139C0000000000
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ conf_init();
int /*<<< orphan*/ garray_init();
int /*<<< orphan*/ glob_init();
int /*<<< orphan*/ mess_init();
int /*<<< orphan*/ obj_init();
int /*<<< orphan*/ sys_lock();
int /*<<< orphan*/ sys_unlock();
void pd_init(void) {
  static int initted = 0;
  if (initted)
    return;
  initted = 1;
  mess_init();
  sys_lock();
  obj_init();
  conf_init();
  glob_init();
  garray_init();
  sys_unlock();
}


x86 assembly (clang, -O0):
<pd_init>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2ee1(%rip)
je     1186 <pd_init+0x16>
jmp    11c1 <pd_init+0x51>
movl   $0x1,0x2ecc(%rip)
mov    $0x0,%al
call   1050 <mess_init@plt>
mov    $0x0,%al
call   1030 <sys_lock@plt>
mov    $0x0,%al
call   1070 <obj_init@plt>
mov    $0x0,%al
call   1080 <conf_init@plt>
mov    $0x0,%al
call   1040 <glob_init@plt>
mov    $0x0,%al
call   1060 <garray_init@plt>
mov    $0x0,%al
call   1090 <sys_unlock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd_init>:
push   %rax
cmpb   $0x0,0x2ee4(%rip)
je     117c <pd_init+0xc>
pop    %rax
ret
movb   $0x1,0x2ed9(%rip)
xor    %eax,%eax
call   1050 <mess_init@plt>
xor    %eax,%eax
call   1030 <sys_lock@plt>
xor    %eax,%eax
call   1070 <obj_init@plt>
xor    %eax,%eax
call   1080 <conf_init@plt>
xor    %eax,%eax
call   1040 <glob_init@plt>
xor    %eax,%eax
call   1060 <garray_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <sys_unlock@plt>

LLVM IR (-O0):
@pd_init.initted = internal global i32 0
define void @pd_init() {
%1 = load i32, i32* @pd_init.initted
%2 = icmp ne i32 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %0
br label %12
4: ; preds = %0
store i32 1, i32* @pd_init.initted
%5 = call i32 (...) @mess_init()
%6 = call i32 (...) @sys_lock()
%7 = call i32 (...) @obj_init()
%8 = call i32 (...) @conf_init()
%9 = call i32 (...) @glob_init()
%10 = call i32 (...) @garray_init()
%11 = call i32 (...) @sys_unlock()
br label %12
12: ; preds = %4, %3
ret void
}

LLVM IR (-O2):
@pd_init.initted = internal unnamed_addr global i1 false
define void @pd_init() {
%1 = load i1, i1* @pd_init.initted
br i1 %1, label %10, label %2
2: ; preds = %0
store i1 true, i1* @pd_init.initted
%3 = tail call i32 (...) @mess_init()
%4 = tail call i32 (...) @sys_lock()
%5 = tail call i32 (...) @obj_init()
%6 = tail call i32 (...) @conf_init()
%7 = tail call i32 (...) @glob_init()
%8 = tail call i32 (...) @garray_init()
%9 = tail call i32 (...) @sys_unlock()
br label %10
10: ; preds = %0, %2
ret void
}
char *skipsp(char *s) {
  while (*s == ' ' || *s == '\t')
    s++;
  return (s);
}


x86 assembly (clang, -O0):
<skipsp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     112d <skipsp+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <skipsp+0x3d>
jmp    114e <skipsp+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skipsp+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipsp>:
mov    %rdi,%rax
jmp    1114 <skipsp+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <skipsp+0x10>
cmp    $0x9,%cl
je     1110 <skipsp+0x10>
ret

LLVM IR (-O0):
define i8* @skipsp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 32
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 9
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ true, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @skipsp(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_getcchar(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_getcchar(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

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


x86 assembly (clang, -O0):
<lookup_number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x3,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup_number>:
mov    %esi,%ecx
mov    %esi,%eax
shr    $0x3,%rax
movzbl (%rdi,%rax,1),%edx
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @lookup_number(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = udiv i32 %6, 8
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i32, i32* %4
%13 = urem i32 %12, 8
%14 = shl i32 1, %13
%15 = and i32 %11, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @lookup_number(i8* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 3
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %1, 7
%9 = shl nuw nsw i32 1, %8
%10 = and i32 %9, %7
ret i32 %10
}
/* Type definitions */
typedef int uint64_t;
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
uint64_t sam3atimeval2ms(const struct timeval *tv) {
  return ((uint64_t)tv->tv_sec) * 1000 + ((uint64_t)tv->tv_usec) / 1000;
}


x86 assembly (clang, -O0):
<sam3atimeval2ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
imul   $0x3e8,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sam3atimeval2ms>:
imul   $0x3e8,0x8(%rdi),%ecx
movslq (%rdi),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @sam3atimeval2ms(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000
%8 = load %struct.timeval*, %struct.timeval** %2
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @sam3atimeval2ms(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %5
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void done(int dummy) {
  (void)printf("EOF\r\n");
  exit(0);
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"EOF\0D\00"
define void @done(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ init_sql_var_list();
int OCESQLStartSQL(void) {
  ;
  init_sql_var_list();
  ;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @OCESQLStartSQL() {
%1 = call i32 (...) @init_sql_var_list()
ret i32 0
}

LLVM IR (-O2):
define i32 @OCESQLStartSQL() {
%1 = tail call i32 (...) @init_sql_var_list()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int foo(int, int);
void baz(int x, int y) {
  y = foo(x, y);
  if (y != 0)
    bar();
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <foo@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114d <baz+0x2d>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz>:
push   %rax
call   1040 <foo@plt>
test   %eax,%eax
je     1132 <baz+0x12>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @baz(i32 %0, i32 %1) {
%3 = tail call i32 @foo(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @bar()
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int Listen(int sockfd, int backlog) {
  int n = listen(sockfd, backlog);
  if (n == -1) {
    perror("listen() failed");
    exit(0);
  }
  return n;
}


x86 assembly (clang, -O0):
<Listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <listen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1169 <Listen+0x39>
lea    0xea3(%rip),%rdi
call   1040 <perror@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Listen>:
push   %rax
call   1030 <listen@plt>
cmp    $0xffffffff,%eax
je     113d <Listen+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"listen() failed\00"
define i32 @Listen(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @listen(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@.str = [16 x i8] c"listen() failed\00"
define i32 @Listen(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
void vulnerable_function(char *srcbuff, int lsrcbuff, int sock_c) {
  char buff[48];
  memcpy(buff, srcbuff, lsrcbuff);
}


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

x86 assembly (clang, -O2):
<vulnerable_function>:
sub    $0x38,%rsp
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <memcpy@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define void @vulnerable_function(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [48 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [48 x i8], [48 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @memcpy(i8* %8, i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
define void @vulnerable_function(i8* %0, i32 %1, i32 %2) {
%4 = alloca [48 x i8]
%5 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 0
%6 = call i32 @memcpy(i8* %5, i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  for (i = 0; i < argc; i++)
    printf("%s\n", argv[i]);
  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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <main+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1145 <main+0x35>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %7
21: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret i32 0
}
int stats_register(void *a, void *b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @stats_register(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
struct icmp_mgr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ icmp_acc(struct icmp_mgr *);
int /*<<< orphan*/ icmp_clean(struct icmp_mgr *);
int /*<<< orphan*/ icmp_gen(struct icmp_mgr *);
int /*<<< orphan*/ icmp_poll(struct icmp_mgr *);
int /*<<< orphan*/ icmp_send(struct icmp_mgr *);
void *dpu_task(void *args) {
  struct icmp_mgr *mgr = (struct icmp_mgr *)args;
  icmp_gen(mgr);
  icmp_send(mgr);
  icmp_poll(mgr);
  icmp_acc(mgr);
  icmp_clean(mgr);
  return 0;
}


x86 assembly (clang, -O0):
<dpu_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <icmp_gen@plt>
mov    -0x10(%rbp),%rdi
call   1050 <icmp_send@plt>
mov    -0x10(%rbp),%rdi
call   1070 <icmp_poll@plt>
mov    -0x10(%rbp),%rdi
call   1030 <icmp_acc@plt>
mov    -0x10(%rbp),%rdi
call   1060 <icmp_clean@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpu_task>:
push   %rbx
mov    %rdi,%rbx
call   1040 <icmp_gen@plt>
mov    %rbx,%rdi
call   1050 <icmp_send@plt>
mov    %rbx,%rdi
call   1070 <icmp_poll@plt>
mov    %rbx,%rdi
call   1030 <icmp_acc@plt>
mov    %rbx,%rdi
call   1060 <icmp_clean@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.icmp_mgr = type { i32 }
define i8* @dpu_task(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.icmp_mgr*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.icmp_mgr*
store %struct.icmp_mgr* %5, %struct.icmp_mgr** %3
%6 = load %struct.icmp_mgr*, %struct.icmp_mgr** %3
%7 = call i32 @icmp_gen(%struct.icmp_mgr* %6)
%8 = load %struct.icmp_mgr*, %struct.icmp_mgr** %3
%9 = call i32 @icmp_send(%struct.icmp_mgr* %8)
%10 = load %struct.icmp_mgr*, %struct.icmp_mgr** %3
%11 = call i32 @icmp_poll(%struct.icmp_mgr* %10)
%12 = load %struct.icmp_mgr*, %struct.icmp_mgr** %3
%13 = call i32 @icmp_acc(%struct.icmp_mgr* %12)
%14 = load %struct.icmp_mgr*, %struct.icmp_mgr** %3
%15 = call i32 @icmp_clean(%struct.icmp_mgr* %14)
ret i8* null
}

LLVM IR (-O2):
%struct.icmp_mgr = type { i32 }
define noalias i8* @dpu_task(i8* %0) {
%2 = bitcast i8* %0 to %struct.icmp_mgr*
%3 = tail call i32 @icmp_gen(%struct.icmp_mgr* %2)
%4 = tail call i32 @icmp_send(%struct.icmp_mgr* %2)
%5 = tail call i32 @icmp_poll(%struct.icmp_mgr* %2)
%6 = tail call i32 @icmp_acc(%struct.icmp_mgr* %2)
%7 = tail call i32 @icmp_clean(%struct.icmp_mgr* %2)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ setAttr(char *, char *, char *, scalar_t__);
scalar_t__ strlen(char *);
void setattr_testattr() {
  char testAttrVal[] = "testing";
  setAttr("testFile", "ctest_testing", testAttrVal, strlen("testing") + 1);
}


x86 assembly (clang, -O0):
<setattr_testattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee0(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
add    $0x1,%rcx
lea    0xea7(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1030 <setAttr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setattr_testattr>:
push   %rax
movabs $0x676e6974736574,%rax
mov    %rax,(%rsp)
lea    0xeda(%rip),%rdi
lea    0xedc(%rip),%rsi
mov    %rsp,%rdx
mov    $0x8,%ecx
call   1030 <setAttr@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.setattr_testattr.testAttrVal = [8 x i8] c"testing\00"
@.str = [9 x i8] c"testFile\00"
@.str.1 = [14 x i8] c"ctest_testing\00"
@.str.2 = [8 x i8] c"testing\00"
define void @setattr_testattr() {
%1 = alloca [8 x i8]
%2 = bitcast [8 x i8]* %1 to i8*
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%4 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%5 = add nsw i64 %4, 1
%6 = call i32 @setAttr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3, i64 %5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"testFile\00"
@.str.1 = [14 x i8] c"ctest_testing\00"
define void @setattr_testattr() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 29113321805538676, i64* %1
%3 = call i32 @setAttr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %2, i64 8)
ret void
}
float maths_center_window_4(float x) {
  return 1.0f / (1 + ((((x) * (x))) * (((x) * (x)))));
}


x86 assembly (clang, -O0):
<maths_center_window_4>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  %xmm0,%xmm1
movss  0xed7(%rip),%xmm0
addss  %xmm0,%xmm1
movss  0xecb(%rip),%xmm0
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<maths_center_window_4>:
mulss  %xmm0,%xmm0
mulss  %xmm0,%xmm0
movss  0xef0(%rip),%xmm1
addss  %xmm1,%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @maths_center_window_4(float %0) {
%2 = fmul float %0, %0
%3 = tail call float @llvm.fmuladd.f32(float %2, float %2, float 1.000000e+00)
%4 = fdiv float 1.000000e+00, %3
ret float %4
}
int set_socket_priority(int fd, int priority) {
  (void)fd;
  (void)priority;
  return -1;
}


x86 assembly (clang, -O0):
<set_socket_priority>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @set_socket_priority(i32 %0, i32 %1) {
ret i32 -1
}
int sat_bool(int a) {
  if (a < 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<sat_bool>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <sat_bool+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1124 <sat_bool+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sat_bool>:
mov    %edi,%eax
not    %eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @sat_bool(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 %7
6: ; preds = %1
store i32 0, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @sat_bool(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
ret i32 %3
}
int test_imm_63uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x63 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_63uint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0x63,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_63uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 99
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_63uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 6488064
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ astringClear(char **);
int /*<<< orphan*/ free(char **);
void astringDestroy(char **data) {
  astringClear(data);
  free(data);
}


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

x86 assembly (clang, -O2):
<astringDestroy>:
push   %rbx
mov    %rdi,%rbx
call   1040 <astringClear@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @astringDestroy(i8** %0) {
%2 = tail call i32 @astringClear(i8** %0)
%3 = tail call i32 @free(i8** %0)
ret void
}
__attribute__((section(".after_vectors"))) void ISR_NoHandler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<ISR_NoHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <ISR_NoHandler+0x9>
jmp    1109 <ISR_NoHandler+0x9>

x86 assembly (clang, -O2):
<ISR_NoHandler>:
jmp    1100 <ISR_NoHandler>

LLVM IR (-O0):
define void @ISR_NoHandler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @ISR_NoHandler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};
struct rusage {
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
double linux_cputime_(void) {
  struct rusage rusage_out;
  (void)getrusage(RUSAGE_SELF, &rusage_out);
  return ((double)rusage_out.ru_utime.tv_usec * 1E-6 +
          (double)(rusage_out.ru_utime.tv_sec));
}


x86 assembly (clang, -O0):
<linux_cputime_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <getrusage@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linux_cputime_>:
sub    $0x18,%rsp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <getrusage@plt>
cvtsi2sdq 0x10(%rsp),%xmm0
cvtsi2sdq 0x8(%rsp),%xmm1
mulsd  0xec3(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
define double @linux_cputime_() {
%1 = alloca %struct.rusage
%2 = load i32, i32* @RUSAGE_SELF
%3 = call i32 @getrusage(i32 %2, %struct.rusage* %1)
%4 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %11)
ret double %12
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
define double @linux_cputime_() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i32 @getrusage(i32 %3, %struct.rusage* %1)
%5 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %10)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ irqHandler();
void secure_fiq() { irqHandler(); }


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

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

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

LLVM IR (-O2):
define void @secure_fiq() {
%1 = tail call i32 (...) @irqHandler()
ret void
}
int test_imm_2Cint16_mem(short *val) {
  return ((*val) & (0x2C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Cint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 44
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_2Cint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 44
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dynamic_test();
unsigned int get_cycles();
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  unsigned int c = 0;
  c = get_cycles();
  dynamic_test();
  c = get_cycles() - c;
  printf("%u\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_cycles@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <dynamic_test@plt>
mov    $0x0,%al
call   1030 <get_cycles@plt>
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <get_cycles@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <dynamic_test@plt>
xor    %eax,%eax
call   1030 <get_cycles@plt>
sub    %ebx,%eax
lea    0xeaf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @get_cycles()
store i32 %3, i32* %2
%4 = call i32 (...) @dynamic_test()
%5 = call i32 (...) @get_cycles()
%6 = load i32, i32* %2
%7 = sub i32 %5, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @get_cycles()
%2 = tail call i32 (...) @dynamic_test()
%3 = tail call i32 (...) @get_cycles()
%4 = sub i32 %3, %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *getcwd(char *, int);
int getpid();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, char *);
void prefix() {
  char *cwdstr = (char *)malloc(sizeof(char) * 1000);
  printf("(pid=%d)%s$ ", getpid(), getcwd(cwdstr, 1000));
  free(cwdstr);
}


x86 assembly (clang, -O0):
<prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3e8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3e8,%esi
call   1060 <getcwd@plt>
mov    -0xc(%rbp),%esi
mov    %rax,%rdx
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix>:
push   %rbp
push   %rbx
push   %rax
mov    $0x3e8,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1060 <getcwd@plt>
lea    0xe83(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
call   1050 <printf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"(pid=%d)%s$ \00"
define void @prefix() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 1000)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = call i32 (...) @getpid()
%5 = load i8*, i8** %1
%6 = call i8* @getcwd(i8* %5, i32 1000)
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %6)
%8 = load i8*, i8** %1
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"(pid=%d)%s$ \00"
define void @prefix() {
%1 = tail call i64 @malloc(i32 1000)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 (...) @getpid()
%4 = tail call i8* @getcwd(i8* %2, i32 1000)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %4)
%6 = tail call i32 @free(i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;
typedef int /*<<< orphan*/ mpfr_srcptr;
typedef int /*<<< orphan*/ mpfr_rnd_t;
typedef int /*<<< orphan*/ mpfr_ptr;

/* Variables and functions */
int /*<<< orphan*/ mpfr_asin;
int mpfr_atrig(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
               int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_tstbit(int /*<<< orphan*/, int /*<<< orphan*/);
int mpfr_asin_npi(mpfr_ptr rop, mpfr_srcptr op, mpz_t npi, mpfr_rnd_t rnd) {
  return mpfr_atrig(rop, op, mpfr_asin, mpz_tstbit(npi, 0), npi, rnd);
}


x86 assembly (clang, -O0):
<mpfr_asin_npi>:
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    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1030 <mpz_tstbit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
call   1040 <mpfr_atrig@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpfr_asin_npi>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%ebx
mov    0x2ea7(%rip),%rax
mov    (%rax),%r12d
mov    %edx,%edi
xor    %esi,%esi
call   1030 <mpz_tstbit@plt>
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %eax,%ecx
mov    %ebp,%r8d
mov    %r14d,%r9d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <mpfr_atrig@plt>

LLVM IR (-O0):
@mpfr_asin = global i32 0
define i32 @mpfr_asin_npi(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* @mpfr_asin
%12 = load i32, i32* %7
%13 = call i32 @mpz_tstbit(i32 %12, i32 0)
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @mpfr_atrig(i32 %9, i32 %10, i32 %11, i32 %13, i32 %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
@mpfr_asin = global i32 0
define i32 @mpfr_asin_npi(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @mpfr_asin
%6 = tail call i32 @mpz_tstbit(i32 %2, i32 0)
%7 = tail call i32 @mpfr_atrig(i32 %0, i32 %1, i32 %5, i32 %6, i32 %2, i32 %3)
ret i32 %7
}