xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ test_hash_func(char const *, int /*<<< orphan*/);
int main(void) {
  const char *str = "Hello, world!";
  test_hash_func(str, strlen(str));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <test_hash_func@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <test_hash_func@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @test_hash_func(i8* %3, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test_hash_func(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int a(int);
int c(int n) { return a(n + 1); }


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <a@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
add    $0x1,%edi
jmp    1030 <a@plt>

LLVM IR (-O0):
define i32 @c(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = call i32 @a(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @c(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = tail call i32 @a(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ *create_win(int, int, int, int);
WINDOW *create_wpreview() { return create_win(10, 12, 3, 38 + 32); }


x86 assembly (clang, -O0):
<create_wpreview>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
mov    $0xc,%esi
mov    $0x3,%edx
mov    $0x46,%ecx
call   1030 <create_win@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_wpreview>:
mov    $0xa,%edi
mov    $0xc,%esi
mov    $0x3,%edx
mov    $0x46,%ecx
jmp    1030 <create_win@plt>

LLVM IR (-O0):
define i32* @create_wpreview() {
%1 = call i32* @create_win(i32 10, i32 12, i32 3, i32 70)
ret i32* %1
}

LLVM IR (-O2):
define i32* @create_wpreview() {
%1 = tail call i32* @create_win(i32 10, i32 12, i32 3, i32 70)
ret i32* %1
}
/* Variables and functions */
int /*<<< orphan*/ Location_LOC_unregisterListener();
void Tracking_LOC_unregisterListener() { Location_LOC_unregisterListener(); }


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

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

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

LLVM IR (-O2):
define void @Tracking_LOC_unregisterListener() {
%1 = tail call i32 (...) @Location_LOC_unregisterListener()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ *re_compile(char *);
int main() {
  assert(re_compile("\\\x01[^\\\xff][^") == NULL);
  assert(re_compile("\\\x01[^\\\xff][\\") == NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <re_compile@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeb7(%rip),%rdi
call   1030 <re_compile@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <re_compile@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0xec8(%rip),%rdi
call   1030 <re_compile@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\\\01[^\\\FF][^\00"
@.str.1 = [10 x i8] c"\\\01[^\\\FF][\\\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32* @re_compile(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32* @re_compile(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"\\\01[^\\\FF][^\00"
@.str.1 = [10 x i8] c"\\\01[^\\\FF][\\\00"
define i32 @main() {
%1 = tail call i32* @re_compile(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32* %1, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32* @re_compile(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ GPIODirModeSet(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ GPIOPadConfigSet(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                    int);
void GPIOPinTypeUSBDigital(uint32_t ui32Port, uint8_t ui8Pins) {
  ;
  GPIODirModeSet(ui32Port, ui8Pins, 0x00000002);
  GPIOPadConfigSet(ui32Port, ui8Pins, 0x00000001, 0x00000008);
}


x86 assembly (clang, -O0):
<GPIOPinTypeUSBDigital>:
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    $0x2,%edx
call   1040 <GPIODirModeSet@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
mov    $0x8,%ecx
call   1030 <GPIOPadConfigSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPinTypeUSBDigital>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x2,%edx
call   1040 <GPIODirModeSet@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x8,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <GPIOPadConfigSet@plt>

LLVM IR (-O0):
define void @GPIOPinTypeUSBDigital(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 @GPIODirModeSet(i32 %5, i32 %6, i32 2)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @GPIOPadConfigSet(i32 %8, i32 %9, i32 1, i32 8)
ret void
}

LLVM IR (-O2):
define void @GPIOPinTypeUSBDigital(i32 %0, i32 %1) {
%3 = tail call i32 @GPIODirModeSet(i32 %0, i32 %1, i32 2)
%4 = tail call i32 @GPIOPadConfigSet(i32 %0, i32 %1, i32 1, i32 8)
ret void
}
int node_pulse1s(int counter, int counter_at_last, int *output) {
  *output = ((counter == 0) && (counter_at_last != 0));
  return 1;
}


x86 assembly (clang, -O0):
<node_pulse1s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x11(%rbp)
jne    1127 <node_pulse1s+0x27>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_pulse1s>:
test   %edi,%edi
sete   %al
test   %esi,%esi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
mov    %eax,(%rdx)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @node_pulse1s(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 0
%5 = icmp ne i32 %1, 0
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
store i32 %7, i32* %2
ret i32 1
}
/* Variables and functions */
void *realloc(void *, size_t);
int try_realloc(void **ptr, size_t new_size) {
  void *reallocated_ptr = realloc(*ptr, new_size);
  if (!reallocated_ptr) {
    return 0;
  }
  *ptr = reallocated_ptr;
  return 1;
}


x86 assembly (clang, -O0):
<try_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    114b <try_realloc+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    115d <try_realloc+0x4d>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_realloc>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <realloc@plt>
test   %rax,%rax
je     112b <try_realloc+0x1b>
mov    %rax,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @try_realloc(i8** nocapture %0, i64 %1) {
%3 = load i8*, i8** %0
%4 = tail call i8* @realloc(i8* %3, i64 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %2
store i8* %4, i8** %0
br label %7
7: ; preds = %2, %6
%8 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushcomplex4array(char *x, int n) {
  pushNarray((char *)x, (unsigned int)(n * 4));
}


x86 assembly (clang, -O0):
<pushcomplex4array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x2,%esi
call   1030 <pushNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushcomplex4array>:
shl    $0x2,%esi
jmp    1030 <pushNarray@plt>

LLVM IR (-O0):
define void @pushcomplex4array(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 = mul nsw i32 %6, 4
%8 = call i32 @pushNarray(i8* %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @pushcomplex4array(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 2
%4 = tail call i32 @pushNarray(i8* %0, i32 %3)
ret void
}
int main() {
  const int ret = 0;
  int *p = (int *)&ret;
  *p = 4;
  return *p;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
/* Variables and functions */
double exp(double const);
double HHK_beta1(const double v) { return 0.125 * exp(-v / 80); }


x86 assembly (clang, -O0):
<HHK_beta1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xeab(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HHK_beta1>:
push   %rax
divsd  0xee7(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @HHK_beta1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = fdiv double %4, 8.000000e+01
%6 = call double @exp(double %5)
%7 = fmul double 1.250000e-01, %6
ret double %7
}

LLVM IR (-O2):
define double @HHK_beta1(double %0) {
%2 = fdiv double %0, -8.000000e+01
%3 = tail call double @exp(double %2)
%4 = fmul double %3, 1.250000e-01
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ copro_mc6809nc_write(unsigned int, unsigned int);
void write_stack16(unsigned addr, unsigned data) {
  do {
    copro_mc6809nc_write((addr + 1) & 0xffff, data & 0xff);
  } while (0);
  do {
    copro_mc6809nc_write(addr, data >> 8);
  } while (0);
}


x86 assembly (clang, -O0):
<write_stack16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
and    $0xffff,%edi
mov    -0x8(%rbp),%esi
and    $0xff,%esi
call   1030 <copro_mc6809nc_write@plt>
jmp    113d <write_stack16+0x2d>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
shr    $0x8,%esi
call   1030 <copro_mc6809nc_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_stack16>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
lea    0x1(%r14),%eax
movzwl %ax,%edi
movzbl %bl,%esi
call   1030 <copro_mc6809nc_write@plt>
shr    $0x8,%ebx
mov    %r14d,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <copro_mc6809nc_write@plt>

LLVM IR (-O0):
define void @write_stack16(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %2
%6 = load i32, i32* %3
%7 = add i32 %6, 1
%8 = and i32 %7, 65535
%9 = load i32, i32* %4
%10 = and i32 %9, 255
%11 = call i32 @copro_mc6809nc_write(i32 %8, i32 %10)
br label %12
12: ; preds = %5
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = lshr i32 %15, 8
%17 = call i32 @copro_mc6809nc_write(i32 %14, i32 %16)
br label %18
18: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @write_stack16(i32 %0, i32 %1) {
%3 = add i32 %0, 1
%4 = and i32 %3, 65535
%5 = and i32 %1, 255
%6 = tail call i32 @copro_mc6809nc_write(i32 %4, i32 %5)
%7 = lshr i32 %1, 8
%8 = tail call i32 @copro_mc6809nc_write(i32 %0, i32 %7)
ret void
}
/* Type definitions */
struct sr_serial_dev_inst {
  int dummy;
};

/* Variables and functions */
int mic_send(struct sr_serial_dev_inst *, char *);
int mic_cmd_set_realtime_mode(struct sr_serial_dev_inst *serial) {
  return mic_send(serial, "S 1 M 2 32 3\r");
}


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

x86 assembly (clang, -O2):
<mic_cmd_set_realtime_mode>:
lea    0xee9(%rip),%rsi
jmp    1030 <mic_send@plt>

LLVM IR (-O0):
%struct.sr_serial_dev_inst = type { i32 }
@.str = [14 x i8] c"S 1 M 2 32 3\0D\00"
define i32 @mic_cmd_set_realtime_mode(%struct.sr_serial_dev_inst* %0) {
%2 = alloca %struct.sr_serial_dev_inst*
store %struct.sr_serial_dev_inst* %0, %struct.sr_serial_dev_inst** %2
%3 = load %struct.sr_serial_dev_inst*, %struct.sr_serial_dev_inst** %2
%4 = call i32 @mic_send(%struct.sr_serial_dev_inst* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
%struct.sr_serial_dev_inst = type { i32 }
@.str = [14 x i8] c"S 1 M 2 32 3\0D\00"
define i32 @mic_cmd_set_realtime_mode(%struct.sr_serial_dev_inst* %0) {
%2 = tail call i32 @mic_send(%struct.sr_serial_dev_inst* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ pl011_uart_putc(char);
void pl011_uart_puts(char *c) {
  int index = 0;
  while (c[index] != '\0') {
    pl011_uart_putc(c[index]);
    index++;
  }
}


x86 assembly (clang, -O0):
<pl011_uart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1157 <pl011_uart_puts+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <pl011_uart_putc@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <pl011_uart_puts+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl011_uart_puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <pl011_uart_puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <pl011_uart_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <pl011_uart_puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @pl011_uart_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @pl011_uart_putc(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/);
void audible_snapper_func(void *timep) {
  putc('\a', stderr);
  *(time_t *)timep = time(0);
}


x86 assembly (clang, -O0):
<audible_snapper_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%edi
call   1030 <putc@plt>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<audible_snapper_func>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%edi
call   1030 <putc@plt>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
define void @audible_snapper_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @putc(i8 signext 7, i32 %3)
%5 = call i32 @time(i32 0)
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @audible_snapper_func(i8* nocapture writeonly %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @putc(i8 signext 7, i32 %2)
%4 = tail call i32 @time(i32 0)
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret void
}
unsigned short int unsignedshortint_ignoring_unsignedchar(unsigned short int x,
                                                          unsigned char y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedshortint_ignoring_unsignedchar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsignedshortint_ignoring_unsignedchar>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define zeroext i16 @unsignedshortint_ignoring_unsignedchar(i16 returned zeroext %0, i8 zeroext %1) {
ret i16 %0
}
void lt() {
  asm volatile("popq %%rax\n\t"
               "popq %%rbx\n\t"
               "cmpq %%rax, %%rbx\n\t"
               "jl _lt\n\t"
               "pushq $0x0\n\t"
               "jmp _ltn\n\t"
               "_lt:pushq $0x1\n\t"
               "_ltn:\n\t" ::
                   :);
}


x86 assembly (clang, -O0):
<lt>:
push   %rbp
mov    %rsp,%rbp
pop    %rax
pop    %rbx
cmp    %rax,%rbx
jl     1116 <_lt>
push   $0x0
jmp    1118 <_ltn>

x86 assembly (clang, -O2):
<lt>:
pop    %rax
pop    %rbx
cmp    %rax,%rbx
jl     110b <_lt>
push   $0x0
jmp    110d <_ltn>

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

LLVM IR (-O2):
define void @lt() {
tail call void asm sideeffect "popq %rax\0A\09popq %rbx\0A\09cmpq %rax, %rbx\0A\09jl _lt\0A\09pushq $$0x0\0A\09jmp _ltn\0A\09_lt:pushq $$0x1\0A\09_ltn:\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printprimes();
int main(int argc, const char *argv[]) { printprimes(); }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @printprimes()
ret i32 0
}
void __smash_the_stack(char *params) {
  unsigned long canary[1];
  canary[0] = 0x11111111;
  char buffer[20];
  strcpy(buffer, params);
  printf("%#x\n\n", canary);
  if (*canary != 0x11111111) {
    printf("the base stack has been modified\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<__smash_the_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x11111111,-0x10(%rbp)
11
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x11111111,-0x10(%rbp)
11
je     1186 <__smash_the_stack+0x56>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__smash_the_stack>:
push   %rax
movq   $0x11111111,(%rsp)
11
lea    0xec0(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x11111111,(%rsp)
11
jne    1156 <__smash_the_stack+0x26>
pop    %rax
ret
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%#x\0A\0A\00"
@.str.1 = [34 x i8] c"the base stack has been modified\0A\00"
define void @__smash_the_stack(i8* %0) {
%2 = alloca i8*
%3 = alloca [1 x i64]
%4 = alloca [20 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [1 x i64], [1 x i64]* %3, i64 0, i64 0
store i64 286331153, i64* %5
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i8* @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [1 x i64], [1 x i64]* %3, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %9)
%11 = getelementptr inbounds [1 x i64], [1 x i64]* %3, i64 0, i64 0
%12 = load i64, i64* %11
%13 = icmp ne i64 %12, 286331153
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
unreachable
16: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%#x\0A\0A\00"
@str = [33 x i8] c"the base stack has been modified\00"
define void @__smash_the_stack(i8* nocapture readnone %0) {
%2 = alloca [1 x i64]
%3 = bitcast [1 x i64]* %2 to i8*
%4 = getelementptr inbounds [1 x i64], [1 x i64]* %2, i64 0, i64 0
store i64 286331153, i64* %4
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %4)
%6 = load i64, i64* %4
%7 = icmp eq i64 %6, 286331153
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
unreachable
10: ; preds = %1
ret void
}
int Q_isupper(int c) {
  if (c >= 'A' && c <= 'Z') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Q_isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1127 <Q_isupper+0x27>
cmpl   $0x5a,-0x8(%rbp)
jg     1127 <Q_isupper+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <Q_isupper+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @Q_isupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @Q_isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ swap(int *, int *);
int max(int a, int b, int c) {
  if (a <= b)
    swap(&a, &b);
  if (a <= c)
    swap(&a, &c);
  return a;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     113a <max+0x2a>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <swap@plt>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1153 <max+0x43>
lea    -0x4(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <swap@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %edi,%eax
mov    %edi,0x4(%rsp)
mov    %esi,0xc(%rsp)
mov    %edx,0x8(%rsp)
cmp    %esi,%edi
jg     113c <max+0x2c>
lea    0x4(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <swap@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
jg     1153 <max+0x43>
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <swap@plt>
mov    0x4(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = icmp sgt i32 %0, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = call i32 @swap(i32* %4, i32* %5)
%10 = load i32, i32* %4
br label %11
11: ; preds = %8, %3
%12 = phi i32 [ %10, %8 ], [ %0, %3 ]
%13 = icmp sgt i32 %12, %2
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = call i32 @swap(i32* %4, i32* %6)
%16 = load i32, i32* %4
br label %17
17: ; preds = %14, %11
%18 = phi i32 [ %16, %14 ], [ %12, %11 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void scrollup_once(void) {
  printf("\e["
         "S");
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[S\00"
define void @scrollup_once() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[S\00"
define void @scrollup_once() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ is_hex_padded(char *);
int strlen(char *);
int normalized_hex_string_length(char hex_string[]) {
  int length = strlen(hex_string);
  if (is_hex_padded(hex_string)) {
    length -= 2;
  }
  if (length % 4 != 0) {
    length = (length / 4 + 1) * 4;
  }
  return length;
}


x86 assembly (clang, -O0):
<normalized_hex_string_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <is_hex_padded@plt>
cmp    $0x0,%rax
je     1154 <normalized_hex_string_length+0x34>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     117c <normalized_hex_string_length+0x5c>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
shl    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalized_hex_string_length>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1040 <is_hex_padded@plt>
mov    %rax,%rcx
lea    -0x2(%r14),%eax
test   %rcx,%rcx
cmove  %r14d,%eax
test   $0x3,%al
je     1159 <normalized_hex_string_length+0x39>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
add    $0x4,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @normalized_hex_string_length(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = call i64 @is_hex_padded(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 2
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
%14 = srem i32 %13, 4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sdiv i32 %17, 4
%19 = add nsw i32 %18, 1
%20 = mul nsw i32 %19, 4
store i32 %20, i32* %3
br label %21
21: ; preds = %16, %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @normalized_hex_string_length(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i64 @is_hex_padded(i8* %0)
%4 = icmp eq i64 %3, 0
%5 = add nsw i32 %2, -2
%6 = select i1 %4, i32 %2, i32 %5
%7 = and i32 %6, 3
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = sdiv i32 %6, 4
%11 = shl nsw i32 %10, 2
%12 = add i32 %11, 4
br label %13
13: ; preds = %9, %1
%14 = phi i32 [ %12, %9 ], [ %6, %1 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, int /*<<< orphan*/);
int pthread_mutex_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int);
void checked_lock(pthread_mutex_t *m) {
  int err = pthread_mutex_lock(m);
  if (err != 0) {
    errx(1, "Failed to lock a mutex: %s", strerror(err));
  }
}


x86 assembly (clang, -O0):
<checked_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <pthread_mutex_lock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116d <checked_lock+0x3d>
mov    -0xc(%rbp),%edi
call   1040 <strerror@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe98(%rip),%rsi
call   1030 <errx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_lock>:
push   %rax
call   1050 <pthread_mutex_lock@plt>
test   %eax,%eax
je     1155 <checked_lock+0x25>
mov    %eax,%edi
call   1040 <strerror@plt>
lea    0xeb8(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
pop    %rax
jmp    1030 <errx@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Failed to lock a mutex: %s\00"
define void @checked_lock(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @pthread_mutex_lock(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* %3
%10 = call i32 @strerror(i32 %9)
%11 = call i32 @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Failed to lock a mutex: %s\00"
define void @checked_lock(i32* %0) {
%2 = tail call i32 @pthread_mutex_lock(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @strerror(i32 %2)
%6 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %4, %1
ret void
}
unsigned int sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
                             struct scsi_sense_hdr *sshdr) {
  return 0;
}


x86 assembly (clang, -O0):
<sd_zbc_complete>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.scsi_cmnd = type opaque
%struct.scsi_sense_hdr = type opaque
define i32 @sd_zbc_complete(%struct.scsi_cmnd* %0, i32 %1, %struct.scsi_sense_hdr* %2) {
%4 = alloca %struct.scsi_cmnd*
%5 = alloca i32
%6 = alloca %struct.scsi_sense_hdr*
store %struct.scsi_cmnd* %0, %struct.scsi_cmnd** %4
store i32 %1, i32* %5
store %struct.scsi_sense_hdr* %2, %struct.scsi_sense_hdr** %6
ret i32 0
}

LLVM IR (-O2):
%struct.scsi_cmnd = type opaque
%struct.scsi_sense_hdr = type opaque
define i32 @sd_zbc_complete(%struct.scsi_cmnd* nocapture readnone %0, i32 %1, %struct.scsi_sense_hdr* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __t_strlen(char *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main() {
  printf("%ld\n", __t_strlen("test"));
  printf("%ld\n", strlen("test"));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xeca(%rip),%rdi
call   1050 <__t_strlen@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeca(%rip),%r14
mov    %r14,%rdi
call   1050 <__t_strlen@plt>
lea    0xeb6(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [5 x i8] c"test\00"
define i32 @main() {
%1 = call i32 @__t_strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [5 x i8] c"test\00"
define i32 @main() {
%1 = tail call i32 @__t_strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *thread2_function(void *arg) {
  int i;
  for (i = 0; i < 200; i++) {
    printf("Thread says hi! ---> thread2\n");
    sleep(1);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<thread2_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jge    1164 <thread2_function+0x44>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <thread2_function+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread2_function>:
push   %rbp
push   %rbx
push   %rax
mov    $0xc8,%ebp
lea    0xed1(%rip),%rbx
nop
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
add    $0xffffffff,%ebp
jne    1130 <thread2_function+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Thread says hi! ---> thread2\0A\00"
define i8* @thread2_function(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 200
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @sleep(i32 1)
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
@str = [29 x i8] c"Thread says hi! ---> thread2\00"
define noalias i8* @thread2_function(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %6, %2 ]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i32 %6, 200
br i1 %7, label %8, label %2
8: ; preds = %2
ret i8* null
}
void __page_cache_release(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<__page_cache_release>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__page_cache_release>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.__page_cache_release = [21 x i8] c"__page_cache_release\00"
define void @__page_cache_release() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.__page_cache_release, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.__page_cache_release = [21 x i8] c"__page_cache_release\00"
define void @__page_cache_release() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.__page_cache_release, i64 0, i64 0))
ret void
}
void wifi_evt_sme_wifi_is_on(const struct wifi_msg_sme_wifi_is_on_evt_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_sme_wifi_is_on_evt_t = type opaque
define void @wifi_evt_sme_wifi_is_on(%struct.wifi_msg_sme_wifi_is_on_evt_t* nocapture %0) {
ret void
}
int doFind(int *parents, int element) {
  if (parents[element] != element) {
    parents[element] = doFind(parents, parents[element]);
  }
  return parents[element];
}


x86 assembly (clang, -O0):
<doFind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xc(%rbp),%eax
je     1154 <doFind+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <doFind@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doFind>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%eax
movslq %esi,%rbx
mov    (%rdi,%rbx,4),%esi
cmp    %ebx,%esi
je     112c <doFind+0x1c>
mov    %rdi,%r14
call   1030 <doFind@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @doFind(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = load i32, i32* %4
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %24
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = load i32*, i32** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @doFind(i32* %13, i32 %18)
%20 = load i32*, i32** %3
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
br label %24
24: ; preds = %12, %2
%25 = load i32*, i32** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @doFind(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, %1
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @doFind(i32* %0, i32 %5)
store i32 %8, i32* %4
br label %9
9: ; preds = %7, %2
%10 = phi i32 [ %8, %7 ], [ %1, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ bar(char *, char *);
int foo(char *argv[]) {
  char buf[240];
  bar(argv[1], buf);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x100(%rbp),%rsi
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    $0xf8,%rsp
mov    0x8(%rdi),%rdi
mov    %rsp,%rsi
call   1030 <bar@plt>
add    $0xf8,%rsp
ret

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

LLVM IR (-O2):
define i32 @foo(i8** nocapture %0) {
%2 = alloca [240 x i8]
%3 = getelementptr inbounds [240 x i8], [240 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = call i32 @bar(i8* %5, i8* %3)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_version() { printf("\nlesyange version %s\n\n", "0.1"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"\0Alesyange version %s\0A\0A\00"
@.str.1 = [4 x i8] c"0.1\00"
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0Alesyange version %s\0A\0A\00"
@.str.1 = [4 x i8] c"0.1\00"
define void @print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int __detect_PLATFORM_ENV_CPU_DETAIL() {
  printf("TT_ENV_CPU_X86");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"TT_ENV_CPU_X86\00"
define i32 @__detect_PLATFORM_ENV_CPU_DETAIL() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"TT_ENV_CPU_X86\00"
define i32 @__detect_PLATFORM_ENV_CPU_DETAIL() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ vreportf(char *, char *, char const *, int /*<<< orphan*/);
__attribute__((__noreturn__)) void die_builtin(const char *fmt,
                                               va_list params) {
  vreportf("[X] ", "", fmt, params);
  exit(128);
}


x86 assembly (clang, -O0):
<die_builtin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xec3(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1030 <vreportf@plt>
mov    $0x80,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die_builtin>:
push   %rax
mov    %esi,%ecx
mov    %rdi,%rdx
lea    0xed3(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1030 <vreportf@plt>
mov    $0x80,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"[X] \00"
@.str.1 = [1 x i8] zeroinitializer
define void @die_builtin(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 @vreportf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %6)
%8 = call i32 @exit(i32 128)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"[X] \00"
@.str.1 = [1 x i8] zeroinitializer
define void @die_builtin(i8* %0, i32 %1) {
%3 = tail call i32 @vreportf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1)
%4 = tail call i32 @exit(i32 128)
unreachable
}