xunge/DecIR huggingface dataset:
void RTThreadGetExecutionTimeMilli(void) {}


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

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

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

LLVM IR (-O2):
define void @RTThreadGetExecutionTimeMilli() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
long long sequence(int);
int nInSequence(int n) {
  printf("Number: %d\n", n);
  long long int number;
  number = sequence(n);
  printf("Fibonacci Sequence until %d number : %llu", n, number);
  return 0;
}


x86 assembly (clang, -O0):
<nInSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <sequence@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nInSequence>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <sequence@plt>
lea    0xecb(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Number: %d\0A\00"
@.str.1 = [42 x i8] c"Fibonacci Sequence until %d number : %llu\00"
define i32 @nInSequence(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = call i64 @sequence(i32 %6)
store i64 %7, i64* %3
%8 = load i32, i32* %2
%9 = load i64, i64* %3
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %8, i64 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Number: %d\0A\00"
@.str.1 = [42 x i8] c"Fibonacci Sequence until %d number : %llu\00"
define i32 @nInSequence(i32 %0) {
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i64 @sequence(i32 %0)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %0, i64 %3)
ret i32 0
}
void ble_rsp_hardware_set_soft_timer(
    const struct ble_msg_hardware_set_soft_timer_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_hardware_set_soft_timer_rsp_t = type opaque
define void @ble_rsp_hardware_set_soft_timer(%struct.ble_msg_hardware_set_soft_timer_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int a = __VERIFIER_nondet_int();
  float b = 2.3;
  if (a < 0) {
    a = a + 1;
    if (a < 0) {
      a = -a;
    }
  }
  b += a;
  if (b < 1) {
  ERROR:
    return -1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
movss  0xecf(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1160 <main+0x50>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    115b <main+0x4b>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x50>
cvtsi2ssl -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe8d(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    118d <main+0x7d>
jmp    1186 <main+0x76>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
xor    %eax,%ecx
cvtsi2ss %ecx,%xmm0
addss  0xed5(%rip),%xmm0
movss  0xed1(%rip),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
store float 0x4002666660000000, float* %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %7
br label %16
16: ; preds = %15, %0
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to float
%19 = load float, float* %3
%20 = fadd float %19, %18
store float %20, float* %3
%21 = load float, float* %3
%22 = fcmp olt float %21, 1.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %16
br label %24
24: ; preds = %23
store i32 -1, i32* %1
br label %25
25: ; preds = %24, %16
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = ashr i32 %1, 31
%3 = xor i32 %2, %1
%4 = sitofp i32 %3 to float
%5 = fadd float %4, 0x4002666660000000
%6 = fcmp olt float %5, 1.000000e+00
%7 = sext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int nmaskbits;

/* Variables and functions */
int /*<<< orphan*/ memset(unsigned long *, int /*<<< orphan*/, int);
void bitmap_zero(unsigned long *maskp, int nmaskbits) {
  memset(maskp, 0,
         (((nmaskbits) + ((8 * sizeof(long))) - 1) / ((8 * sizeof(long)))) *
             sizeof(long));
}


x86 assembly (clang, -O0):
<bitmap_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    $0x40,%rax
sub    $0x1,%rax
shr    $0x6,%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_zero>:
movslq %esi,%rdx
add    $0x3f,%rdx
shr    $0x3,%rdx
and    $0xfffffff8,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @bitmap_zero(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i64*, i64** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = add i64 %7, 64
%9 = sub i64 %8, 1
%10 = udiv i64 %9, 64
%11 = mul i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i32 @memset(i64* %5, i32 0, i32 %12)
ret void
}

LLVM IR (-O2):
define void @bitmap_zero(i64* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = add nsw i64 %3, 63
%5 = lshr i64 %4, 3
%6 = trunc i64 %5 to i32
%7 = and i32 %6, -8
%8 = tail call i32 @memset(i64* %0, i32 0, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ camera_update();
void multicamupdate(int reps) {
  int i;
  for (i = 0; i < reps; i++)
    camera_update();
}


x86 assembly (clang, -O0):
<multicamupdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1143 <multicamupdate+0x33>
mov    $0x0,%al
call   1030 <camera_update@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <multicamupdate+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multicamupdate>:
push   %rbx
test   %edi,%edi
jle    112c <multicamupdate+0x1c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <camera_update@plt>
add    $0xffffffff,%ebx
jne    1120 <multicamupdate+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @multicamupdate(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 (...) @camera_update()
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func(int /*<<< orphan*/ *);
int main() {
  func(NULL);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32* null)
ret i32 0
}
void test_isalnum(void) {
  int i, j;
  for (i = -127; i < 256;)
    j = i, printf("%s: %d -> %d\n", __FUNCTION__, j, isalnum(i++) ? 1 : 0);
}


x86 assembly (clang, -O0):
<test_isalnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffff81,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1184 <test_isalnum+0x64>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
call   1040 <isalnum@plt>
mov    -0xc(%rbp),%edx
mov    %eax,%esi
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
lea    0xe8f(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <test_isalnum+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isalnum>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffff81,%ebx
lea    0xecd(%rip),%r14
lea    0xed4(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
call   1040 <isalnum@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%ebx
cmp    $0x100,%ebp
jne    1140 <test_isalnum+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isalnum = [13 x i8] c"test_isalnum\00"
define void @test_isalnum() {
%1 = alloca i32
%2 = alloca i32
store i32 -127, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 @isalnum(i32 %9)
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.test_isalnum, i64 0, i64 0), i32 %8, i32 %14)
br label %3
16: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isalnum = [13 x i8] c"test_isalnum\00"
define void @test_isalnum() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ -127, %0 ], [ %3, %1 ]
%3 = add nsw i32 %2, 1
%4 = tail call i32 @isalnum(i32 %2)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.test_isalnum, i64 0, i64 0), i32 %2, i32 %6)
%8 = icmp eq i32 %3, 256
br i1 %8, label %9, label %1
9: ; preds = %1
ret void
}
int test_imm_EEint64_highword_reg(long long val) {
  return ((val >> 32) & (0xEE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_EEint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0xee,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_EEint64_highword_reg>:
movabs $0xee00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EEint64_highword_reg(i64 %0) {
%2 = and i64 %0, 1022202216448
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
SORU_8_PROTOTYPE() {
  while (1)
    ;
}


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

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

LLVM IR (-O0):
define i32 @SORU_8_PROTOTYPE() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define i32 @SORU_8_PROTOTYPE() {
br label %1
1: ; preds = %0, %1
br label %1
}
void readString(char **markerp) {
  (*markerp)++;
  while (**markerp != '\"')
    (*markerp)++;
  (*markerp)++;
}


x86 assembly (clang, -O0):
<readString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
je     113c <readString+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1116 <readString+0x16>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<readString>:
mov    (%rdi),%rax
add    $0x1,%rax
nopw   0x0(%rax,%rax,1)
mov    %rax,(%rdi)
cmpb   $0x22,(%rax)
lea    0x1(%rax),%rax
jne    1110 <readString+0x10>
mov    %rax,(%rdi)
ret

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

LLVM IR (-O2):
define void @readString(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %3, %1
%4 = phi i8* [ %2, %1 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %5, i8** %0
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 34
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 2
store i8* %9, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
int BNCHz() {
  int ii, stat = 99;
  char com1, data;
  BNCIO(12);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCHz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x63,-0x8(%rbp)
mov    $0xc,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCHz>:
push   %rax
mov    $0xc,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @BNCHz() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 99, i32* %2
%5 = call i32 @BNCIO(i32 12)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @BNCHz() {
%1 = tail call i32 @BNCIO(i32 12)
ret i32 99
}
int ld_eq_rm1(long double a1, long double *a2) { return (((a1) == (*a2))); }


x86 assembly (clang, -O0):
<ld_eq_rm1>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setnp  %cl
sete   %al
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_eq_rm1>:
fldt   0x8(%rsp)
fldt   (%rdi)
fucomip %st(1),%st
fstp   %st(0)
setnp  %al
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ld_eq_rm1(x86_fp80 %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %1
%4 = fcmp oeq x86_fp80 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
unsigned fixIndex(unsigned i, unsigned size) {
  return i > 0 ? i - 1 : size + i;
}


x86 assembly (clang, -O0):
<fixIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jbe    1122 <fixIndex+0x22>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <fixIndex+0x2b>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixIndex>:
mov    %edi,%eax
sub    $0x1,%eax
cmovb  %esi,%eax
ret

LLVM IR (-O0):
define i32 @fixIndex(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp ugt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = sub i32 %8, 1
br label %14
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = add i32 %11, %12
br label %14
14: ; preds = %10, %7
%15 = phi i32 [ %9, %7 ], [ %13, %10 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @fixIndex(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = add i32 %0, -1
%5 = select i1 %3, i32 %1, i32 %4
ret i32 %5
}
int foo(char *p) { return *((const char *)"") - *p; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsbl 0xef1(%rip),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movsbl (%rdi),%eax
neg    %eax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @foo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%4 = sext i8 %3 to i32
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @foo(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = sub nsw i32 0, %3
ret i32 %4
}
int test_imm_01uint32_reg(unsigned int val) {
  return ((val) & (0x01 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_01uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x1,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_01uint32_reg(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
double strtod(const char *nptr, char **endptr) {
  puts("# ");
  puts(__FUNCTION__);
  puts("()\n");
  delay(100000000);
  (void)(nptr);
  (void)(endptr);
  return 0.0;
}


x86 assembly (clang, -O0):
<strtod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
mov    $0x0,%al
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtod>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
xor    %eax,%eax
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.strtod = [7 x i8] c"strtod\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @strtod(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.strtod, i64 0, i64 0))
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
%9 = load i8*, i8** %3
%10 = load i8**, i8*** %4
ret double 0.000000e+00
}

LLVM IR (-O2):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.strtod = [7 x i8] c"strtod\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @strtod(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.strtod, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("This is a right test!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"This is a right test!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"This is a right test!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void FREE(void *ptr) {
  if (ptr)
    free(ptr);
}


x86 assembly (clang, -O0):
<FREE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <FREE+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @FREE(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 i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @FREE(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int are_not_parallel(l1, l2) { return !are_parallel(l1, l2); }


x86 assembly (clang, -O0):
<are_not_parallel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <are_parallel@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<are_not_parallel>:
push   %rax
xor    %eax,%eax
call   1030 <are_parallel@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @are_not_parallel(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 (i32, i32, ...) bitcast (i32 (...)* @are_parallel to i32 (i32, i32, ...)*)(i32 %5, i32 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @are_not_parallel(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @are_parallel to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void smp_call_ipl_cpu(void (*func)(void *), void *data) { func(data); }


x86 assembly (clang, -O0):
<smp_call_ipl_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_call_ipl_cpu>:
mov    %rdi,%rax
mov    %rsi,%rdi
jmp    *%rax

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

LLVM IR (-O2):
define void @smp_call_ipl_cpu(void (i8*)* nocapture %0, i8* %1) {
tail call void %0(i8* %1)
ret void
}
/* Variables and functions */
long rnd();
long random_1(long n) { return (rnd() % n); }


x86 assembly (clang, -O0):
<random_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rnd@plt>
cqto
idivq  -0x8(%rbp)
mov    %rdx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_1>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rnd@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
je     1131 <random_1+0x21>
cqto
idiv   %rbx
mov    %rdx,%rax
pop    %rbx
ret
xor    %edx,%edx
div    %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @random_1(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i64 (...) @rnd()
%4 = load i64, i64* %2
%5 = srem i64 %3, %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @random_1(i64 %0) {
%2 = tail call i64 (...) @rnd()
%3 = srem i64 %2, %0
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(float *, int, int, int /*<<< orphan*/ *);
float read_float(FILE *file) {
  float ret;
  fread(&ret, 1, sizeof(float), file);
  return ret;
}


x86 assembly (clang, -O0):
<read_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_float>:
push   %rax
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @read_float(i32* nocapture %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 @fread(float* %2, i32 1, i32 4, i32* %0)
%5 = load float, float* %2
ret float %5
}
int fun1244() { return 1244; }


x86 assembly (clang, -O0):
<fun1244>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4dc,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun1244() {
ret i32 1244
}

LLVM IR (-O2):
define i32 @fun1244() {
ret i32 1244
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *strzcpy(char *dest, const char *src, size_t n) {
  memcpy(dest, src, n);
  dest[n] = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strzcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strzcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strzcpy(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
%5 = getelementptr inbounds i8, i8* %0, i64 %2
store i8 0, i8* %5
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)());
void sigproc() {
  signal(SIGINT, sigproc);
  printf("you have pressed ctrl-c \n");
}


x86 assembly (clang, -O0):
<sigproc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    0x2ebc(%rip),%rsi
call   1040 <signal@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigproc>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    0x2ebf(%rip),%rsi
call   1040 <signal@plt>
lea    0xec3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [26 x i8] c"you have pressed ctrl-c \0A\00"
define void @sigproc() {
%1 = load i32, i32* @SIGINT
%2 = call i32 @signal(i32 %1, void (...)* bitcast (void ()* @sigproc to void (...)*))
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@str = [25 x i8] c"you have pressed ctrl-c \00"
define void @sigproc() {
%1 = load i32, i32* @SIGINT
%2 = tail call i32 @signal(i32 %1, void (...)* bitcast (void ()* @sigproc to void (...)*))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint8_t read_bit_reg16(volatile uint16_t *reg, uint8_t bit) {
  return ((*(volatile unsigned int *)((
      (((uint32_t)reg & 0xF0000000) + 0x02000000 +
       (((uint32_t)reg & 0xFFFFF) << 5) + (bit << 2))))));
}


x86 assembly (clang, -O0):
<read_bit_reg16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
and    $0xf0000000,%eax
add    $0x2000000,%eax
mov    -0x8(%rbp),%rcx
and    $0xfffff,%ecx
shl    $0x5,%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bit_reg16>:
mov    %edi,%eax
and    $0xf0000000,%eax
shl    $0x5,%edi
and    $0x1ffffe0,%edi
or     %eax,%edi
lea    (%rdi,%rsi,4),%eax
add    $0x2000000,%eax
mov    (%rax),%eax
ret

LLVM IR (-O0):
define i32 @read_bit_reg16(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 = ptrtoint i32* %5 to i32
%7 = and i32 %6, -268435456
%8 = add i32 %7, 33554432
%9 = load i32*, i32** %3
%10 = ptrtoint i32* %9 to i32
%11 = and i32 %10, 1048575
%12 = shl i32 %11, 5
%13 = add i32 %8, %12
%14 = load i32, i32* %4
%15 = shl i32 %14, 2
%16 = add i32 %13, %15
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @read_bit_reg16(i32* %0, i32 %1) {
%3 = ptrtoint i32* %0 to i64
%4 = trunc i64 %3 to i32
%5 = and i32 %4, -268435456
%6 = shl i32 %4, 5
%7 = and i32 %6, 33554400
%8 = or i32 %5, %7
%9 = shl i32 %1, 2
%10 = add i32 %9, 33554432
%11 = add i32 %10, %8
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
ret i32 %14
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ test_compare_h();
uint32_t test_main(void) {
  uint32_t success = 0;
  success = test_compare_h();
  if (success != 0) {
    return success;
  }
  return success;
}


x86 assembly (clang, -O0):
<test_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <test_compare_h@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1143 <test_main+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114b <test_main+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @test_main() {
%1 = tail call i64 (...) @test_compare_h()
ret i64 %1
}
int MIN(int X, int Y) { return (X > Y) ? Y : X; }


x86 assembly (clang, -O0):
<MIN>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <MIN+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <MIN+0x27>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MIN>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

LLVM IR (-O0):
define i32 @MIN(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
br label %12
10: ; preds = %2
%11 = load i32, i32* %3
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @MIN(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int partition(int *, int, int);
void qsort(int *a, int low, int high) {
  int pivotloc = 0;
  if (low < high) {
    pivotloc = partition(a, low, high);
    qsort(a, low, pivotloc - 1);
    qsort(a, pivotloc + 1, high);
  }
}


x86 assembly (clang, -O0):
<qsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117b <qsort+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <qsort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <qsort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <qsort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <qsort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <qsort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @qsort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @qsort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
unsigned xrop3_69_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T & stk3;
  stk1 = D | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_69_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_69_1_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
lea    (%rcx,%rdi,1),%eax
shl    $0x8,%esi
not    %eax
and    %esi,%eax
xor    %ecx,%eax
or     %edi,%eax
xor    $0xffffff00,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_69_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %7
%26 = load i32, i32* %10
%27 = and i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %9
%30 = or i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = xor i32 %31, -1
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = load i32, i32* %6
%35 = xor i32 %34, -1
%36 = and i32 %33, %35
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = and i32 %37, %38
%40 = or i32 %36, %39
ret i32 %40
}

LLVM IR (-O2):
define i32 @xrop3_69_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = xor i32 %5, -1
%9 = and i32 %7, %8
%10 = xor i32 %9, %4
%11 = or i32 %10, %3
%12 = xor i32 %11, -256
ret i32 %12
}
int is_stk_overflow(unsigned long addr, unsigned long sp) {
  return (addr <= sp + 4096 && sp <= addr + 4096);
}


x86 assembly (clang, -O0):
<is_stk_overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
add    $0x1000,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x11(%rbp)
ja     1141 <is_stk_overflow+0x41>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0x1000,%rcx
cmp    %rcx,%rax
setbe  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_stk_overflow>:
lea    0x1000(%rsi),%rax
cmp    %rdi,%rax
setae  %al
add    $0x1000,%rdi
cmp    %rsi,%rdi
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_stk_overflow(i64 %0, i64 %1) {
%3 = add i64 %1, 4096
%4 = icmp uge i64 %3, %0
%5 = add i64 %0, 4096
%6 = icmp uge i64 %5, %1
%7 = and i1 %6, %4
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ bitmap_size(int);
int /*<<< orphan*/ memset(void *, int, int /*<<< orphan*/);
void bitmap_set(void *addr, int nr_bits) {
  memset(addr, 0xff, bitmap_size(nr_bits));
}


x86 assembly (clang, -O0):
<bitmap_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <bitmap_size@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
mov    $0xff,%esi
call   1030 <memset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_set>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <bitmap_size@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %eax,%edx
pop    %rbx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @bitmap_set(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 = call i32 @bitmap_size(i32 %6)
%8 = call i32 @memset(i8* %5, i32 255, i32 %7)
ret void
}

LLVM IR (-O2):
define void @bitmap_set(i8* %0, i32 %1) {
%3 = tail call i32 @bitmap_size(i32 %1)
%4 = tail call i32 @memset(i8* %0, i32 255, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverseWords(char *);
int main() {
  char s[30] = "Let's take LeetCode contest";
  reverseWords(s);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <reverseWords@plt>
lea    -0x20(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xee2(%rip),%xmm0
movups %xmm0,0xe(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <reverseWords@plt>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [30 x i8] c"Let's take LeetCode contest\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = bitcast [30 x i8]* %1 to i8*
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = call i32 @reverseWords(i8* %3)
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [30 x i8] c"Let's take LeetCode contest\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = call i32 @reverseWords(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef long uint8_t;

/* Variables and functions */
void int32_to_char(long int32, uint8_t *c) {
  c[0] = int32 & 0xff;
  c[1] = (int32 & 0xff00) >> 8;
  c[2] = (int32 & 0xff0000) >> 16;
  c[3] = (int32 & 0xff000000) >> 24;
}


x86 assembly (clang, -O0):
<int32_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
and    $0xff,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
and    $0xff00,%rcx
sar    $0x8,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rcx
and    $0xff0000,%rcx
sar    $0x10,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
movabs $0xff000000,%rcx
and    -0x8(%rbp),%rcx
sar    $0x18,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<int32_to_char>:
mov    %rdi,%rax
movzbl %al,%ecx
mov    %rcx,(%rsi)
movzbl %ah,%ecx
mov    %rcx,0x8(%rsi)
mov    %eax,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %rcx,0x10(%rsi)
shr    $0x18,%eax
mov    %rax,0x18(%rsi)
ret

LLVM IR (-O0):
define void @int32_to_char(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
store i64* %1, i64** %4
%5 = load i64, i64* %3
%6 = and i64 %5, 255
%7 = load i64*, i64** %4
%8 = getelementptr inbounds i64, i64* %7, i64 0
store i64 %6, i64* %8
%9 = load i64, i64* %3
%10 = and i64 %9, 65280
%11 = ashr i64 %10, 8
%12 = load i64*, i64** %4
%13 = getelementptr inbounds i64, i64* %12, i64 1
store i64 %11, i64* %13
%14 = load i64, i64* %3
%15 = and i64 %14, 16711680
%16 = ashr i64 %15, 16
%17 = load i64*, i64** %4
%18 = getelementptr inbounds i64, i64* %17, i64 2
store i64 %16, i64* %18
%19 = load i64, i64* %3
%20 = and i64 %19, 4278190080
%21 = ashr i64 %20, 24
%22 = load i64*, i64** %4
%23 = getelementptr inbounds i64, i64* %22, i64 3
store i64 %21, i64* %23
ret void
}

LLVM IR (-O2):
define void @int32_to_char(i64 %0, i64* nocapture writeonly %1) {
%3 = and i64 %0, 255
store i64 %3, i64* %1
%4 = lshr i64 %0, 8
%5 = and i64 %4, 255
%6 = getelementptr inbounds i64, i64* %1, i64 1
store i64 %5, i64* %6
%7 = lshr i64 %0, 16
%8 = and i64 %7, 255
%9 = getelementptr inbounds i64, i64* %1, i64 2
store i64 %8, i64* %9
%10 = lshr i64 %0, 24
%11 = and i64 %10, 255
%12 = getelementptr inbounds i64, i64* %1, i64 3
store i64 %11, i64* %12
ret void
}