xunge/DecIR huggingface dataset:
/* Variables and functions */
void stub1(void *);
scalar_t__ ws_poll(int *, int /*<<< orphan*/);
int ws_loop(void (*func)(void *), void *arg) {
  int val;
  while (ws_poll(&val, 0))
    (*func)(arg);
  return val;
}


x86 assembly (clang, -O0):
<ws_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
call   1030 <ws_poll@plt>
cmp    $0x0,%rax
je     1144 <ws_loop+0x34>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
jmp    1120 <ws_loop+0x10>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ws_loop>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xc(%rsp),%rdi
xor    %esi,%esi
call   1030 <ws_poll@plt>
test   %rax,%rax
je     1154 <ws_loop+0x44>
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   *%rbx
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <ws_poll@plt>
test   %rax,%rax
jne    1140 <ws_loop+0x30>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @ws_loop(void (i8*)* nocapture %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @ws_poll(i32* %3, i32 0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2, %7
%8 = call i64 @ws_poll(i32* %3, i32 0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %7
10: ; preds = %7, %2
%11 = load i32, i32* %3
ret i32 %11
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ init_terminal_os(int);
int /*<<< orphan*/ reset_terminal_os();
int jimi_getch_term(int echo) {
  int ch;
  if (!echo) {
    init_terminal_os(echo);
    ch = getchar();
    reset_terminal_os();
  } else {
    ch = getchar();
  }
  return ch;
}


x86 assembly (clang, -O0):
<jimi_getch_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1163 <jimi_getch_term+0x33>
mov    -0x4(%rbp),%edi
call   1030 <init_terminal_os@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <reset_terminal_os@plt>
jmp    116d <jimi_getch_term+0x3d>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jimi_getch_term>:
test   %edi,%edi
je     113b <jimi_getch_term+0xb>
xor    %eax,%eax
jmp    1040 <getchar@plt>
push   %rbx
xor    %edi,%edi
call   1030 <init_terminal_os@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <reset_terminal_os@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @jimi_getch_term(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call i32 @init_terminal_os(i32 0)
%5 = tail call i32 (...) @getchar()
%6 = tail call i32 (...) @reset_terminal_os()
br label %9
7: ; preds = %1
%8 = tail call i32 (...) @getchar()
br label %9
9: ; preds = %7, %3
%10 = phi i32 [ %8, %7 ], [ %5, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_set_sleep_low() {
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (1 << 9) | (1 << 5) | (1)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (1 << 9) | (1 << 5) | (1)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (1 << 9) | (1 << 5) | (1)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_set_sleep_low>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_set_sleep_low>:
push   %rax
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_set_sleep_low() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%4 = call i32 @delay(i32 100)
%5 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 49697)
%6 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_set_sleep_low() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%4 = tail call i32 @delay(i32 100)
%5 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 49697)
%6 = tail call i32 @delay(i32 100)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ __checkint_int64_add_signed_unsigned(int /*<<< orphan*/,
                                                        int /*<<< orphan*/,
                                                        int /*<<< orphan*/ *);
__attribute__((always_)) int64_t
__checkint_int64_add_unsigned_signed(uint64_t x, int64_t y, int32_t *err) {
  return __checkint_int64_add_signed_unsigned(y, x, err);
}


x86 assembly (clang, -O0):
<__checkint_int64_add_unsigned_signed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <__checkint_int64_add_signed_unsigned@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__checkint_int64_add_unsigned_signed>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <__checkint_int64_add_signed_unsigned@plt>

LLVM IR (-O0):
define i32 @__checkint_int64_add_unsigned_signed(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* %5
%8 = load i32, i32* %4
%9 = load i32*, i32** %6
%10 = call i32 @__checkint_int64_add_signed_unsigned(i32 %7, i32 %8, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @__checkint_int64_add_unsigned_signed(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @__checkint_int64_add_signed_unsigned(i32 %1, i32 %0, i32* %2)
ret i32 %4
}
void USB_ResumeDevice(struct ehci_device *fd) { return; }


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

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

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

LLVM IR (-O2):
%struct.ehci_device = type opaque
define void @USB_ResumeDevice(%struct.ehci_device* nocapture %0) {
ret void
}
int ac_parseflags(const char *text, int *accel) {
  int parsed = 1, done = 0;
  if (!text || !accel)
    return 0;
  return parsed;
}


x86 assembly (clang, -O0):
<ac_parseflags>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1130 <ac_parseflags+0x30>
cmpq   $0x0,-0x18(%rbp)
jne    113c <ac_parseflags+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1142 <ac_parseflags+0x42>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ac_parseflags>:
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ac_parseflags(i8* readnone %0, i32* readnone %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i32* %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ dll_rewinddir(int /*<<< orphan*/ *);
void __wrap_rewinddir(DIR *dirp) { dll_rewinddir(dirp); }


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

x86 assembly (clang, -O2):
<__wrap_rewinddir>:
jmp    1030 <dll_rewinddir@plt>

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

LLVM IR (-O2):
define void @__wrap_rewinddir(i32* %0) {
%2 = tail call i32 @dll_rewinddir(i32* %0)
ret void
}
/* Variables and functions */
double sqrt(double);
double user_func_2(double x, double y) { return sqrt(x * x + y * y); }


x86 assembly (clang, -O0):
<user_func_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_func_2>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112b <user_func_2+0x1b>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @user_func_2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %4
%8 = load double, double* %4
%9 = fmul double %7, %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
%11 = call double @sqrt(double %10)
ret double %11
}

LLVM IR (-O2):
define double @user_func_2(double %0, double %1) {
%3 = fmul double %1, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
%5 = tail call double @sqrt(double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, unsigned int);
void bzero(void *ptr, unsigned int len) { memset(ptr, 0, len); }


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

x86 assembly (clang, -O2):
<bzero>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @bzero(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 @memset(i8* %5, i32 0, i32 %6)
ret void
}

LLVM IR (-O2):
define void @bzero(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
ret void
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int c_enscrl() { return fputs("", stdout); }


x86 assembly (clang, -O0):
<c_enscrl>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_enscrl>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stdout = global i32 0
define i32 @c_enscrl() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stdout = global i32 0
define i32 @c_enscrl() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
void ble_mesh_shell_init(void) {}


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

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

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

LLVM IR (-O2):
define void @ble_mesh_shell_init() {
ret void
}
int test_imm_BAuint8_reg(unsigned char val) {
  return ((val) & (0xBA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BAuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -70
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
float M_PI;
float Radian(float alpha) { return ((alpha * M_PI) / 180); }


x86 assembly (clang, -O0):
<Radian>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
mulss  (%rax),%xmm0
movss  0xedf(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Radian>:
mov    0x2ee1(%rip),%rax
mulss  (%rax),%xmm0
divss  0xeed(%rip),%xmm0
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @Radian(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* @M_PI
%5 = fmul float %3, %4
%6 = fdiv float %5, 1.800000e+02
ret float %6
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @Radian(float %0) {
%2 = load float, float* @M_PI
%3 = fmul float %2, %0
%4 = fdiv float %3, 1.800000e+02
ret float %4
}
void g_datalist_id_get_data() {}


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

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

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

LLVM IR (-O2):
define void @g_datalist_id_get_data() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void f8(int a, int b) {
  if ((b & 3) / ((a & 0xff) + 1) == 5)
    link_error();
}


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
cmp    $0x5,%eax
jne    1143 <f8+0x33>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f8(i32 %0, i32 %1) {
ret void
}
int psCheckWouldBlock(int err) {
  switch (err) {
    return 1;
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<psCheckWouldBlock>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    110c <psCheckWouldBlock+0xc>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @psCheckWouldBlock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %4 [
]
4: ; preds = %1
br label %5
5: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @psCheckWouldBlock(i32 %0) {
ret i32 0
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ swap(char *, char *);
int get_random(char A[], int left, int right) {
  int result = left + rand() % (right - left + 1);
  swap(&A[result], &A[left]);
  return A[left];
}


x86 assembly (clang, -O0):
<get_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
call   1030 <swap@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %ebp,%edx
movslq %edx,%rdi
add    %r14,%rdi
movslq %ebp,%rbx
lea    (%r14,%rbx,1),%rsi
call   1030 <swap@plt>
movsbl (%r14,%rbx,1),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_random(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = call i32 (...) @rand()
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = sub nsw i32 %10, %11
%13 = add nsw i32 %12, 1
%14 = srem i32 %9, %13
%15 = add nsw i32 %8, %14
store i32 %15, i32* %7
%16 = load i8*, i8** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = call i32 @swap(i8* %19, i8* %23)
%25 = load i8*, i8** %4
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @get_random(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @rand()
%5 = sub i32 1, %1
%6 = add i32 %5, %2
%7 = srem i32 %4, %6
%8 = add nsw i32 %7, %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = sext i32 %1 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = tail call i32 @swap(i8* %10, i8* %12)
%14 = load i8, i8* %12
%15 = sext i8 %14 to i32
ret i32 %15
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int host_word_parity(int);
uint32_t make_word(uint32_t word) {
  word |= host_word_parity(word);
  word |= 1 << 20;
  return word;
}


x86 assembly (clang, -O0):
<make_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <host_word_parity@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x100000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_word>:
push   %rbx
mov    %edi,%ebx
call   1030 <host_word_parity@plt>
or     %ebx,%eax
or     $0x100000,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @make_word(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @host_word_parity(i32 %3)
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = or i32 %7, 1048576
store i32 %8, i32* %2
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @make_word(i32 %0) {
%2 = tail call i32 @host_word_parity(i32 %0)
%3 = or i32 %2, %0
%4 = or i32 %3, 1048576
ret i32 %4
}
/* Type definitions */
struct thread_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ context_print(struct thread_context *);
int /*<<< orphan*/ kernel_panic(char *);
void undef_interrupt_handler(struct thread_context *context) {
  context_print(context);
  kernel_panic("unknown instruction attempted");
}


x86 assembly (clang, -O0):
<undef_interrupt_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <context_print@plt>
lea    0xec4(%rip),%rdi
call   1030 <kernel_panic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<undef_interrupt_handler>:
push   %rax
call   1040 <context_print@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <kernel_panic@plt>

LLVM IR (-O0):
%struct.thread_context = type { i32 }
@.str = [30 x i8] c"unknown instruction attempted\00"
define void @undef_interrupt_handler(%struct.thread_context* %0) {
%2 = alloca %struct.thread_context*
store %struct.thread_context* %0, %struct.thread_context** %2
%3 = load %struct.thread_context*, %struct.thread_context** %2
%4 = call i32 @context_print(%struct.thread_context* %3)
%5 = call i32 @kernel_panic(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.thread_context = type { i32 }
@.str = [30 x i8] c"unknown instruction attempted\00"
define void @undef_interrupt_handler(%struct.thread_context* %0) {
%2 = tail call i32 @context_print(%struct.thread_context* %0)
%3 = tail call i32 @kernel_panic(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv0) {
  fprintf(stderr,
          "Usage: %s -uhde --key_str <key_str> --128 --192 --256\n"
          "--ifile <input_file> --ofile <output_file>\n",
          argv0);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [98 x i8] c"Usage: %s -uhde --key_str <key_str> --128 --192 --256\0A--ifile <input_file> --ofile <output_file>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [98 x i8] c"Usage: %s -uhde --key_str <key_str> --128 --192 --256\0A--ifile <input_file> --ofile <output_file>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *generate_raw(unsigned char *, int *);
int /*<<< orphan*/ printf(char *, char *);
void choice_print_table_name(unsigned char *table_str) {
  int tmp_len;
  char *name = generate_raw(table_str, &tmp_len);
  printf("DEBUG:: TABLE_NAME_IS='%s'\n", name);
  free(name);
  name = NULL;
}


x86 assembly (clang, -O0):
<choice_print_table_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <generate_raw@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choice_print_table_name>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
call   1040 <generate_raw@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"DEBUG:: TABLE_NAME_IS='%s'\0A\00"
define void @choice_print_table_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @generate_raw(i8* %5, i32* %3)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @free(i8* %9)
store i8* null, i8** %4
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"DEBUG:: TABLE_NAME_IS='%s'\0A\00"
define void @choice_print_table_name(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i8* @generate_raw(i8* %0, i32* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @free(i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
void *xopen(char const *, int /*<<< orphan*/, int /*<<< orphan*/);
void *input_fd_open(const char *path) { return xopen(path, O_RDONLY, 0); }


x86 assembly (clang, -O0):
<input_fd_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <xopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_fd_open>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <xopen@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i8* @input_fd_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDONLY
%5 = call i8* @xopen(i8* %3, i32 %4, i32 0)
ret i8* %5
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i8* @input_fd_open(i8* %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i8* @xopen(i8* %0, i32 %2, i32 0)
ret i8* %3
}
/* Variables and functions */
scalar_t__ isinf(double);
double inftozero(double x) { return isinf(x) ? 0 : x; }


x86 assembly (clang, -O0):
<inftozero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <isinf@plt>
cmp    $0x0,%rax
je     113e <inftozero+0x2e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1148 <inftozero+0x38>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inftozero>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <isinf@plt>
movsd  (%rsp),%xmm0
test   %rax,%rax
je     1128 <inftozero+0x18>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @inftozero(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @isinf(double %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = load double, double* %2
br label %9
9: ; preds = %7, %6
%10 = phi double [ 0.000000e+00, %6 ], [ %8, %7 ]
ret double %10
}

LLVM IR (-O2):
define double @inftozero(double %0) {
%2 = tail call i64 @isinf(double %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, double %0, double 0.000000e+00
ret double %4
}
long min_l(long x, long y) { return x > y ? y : x; }


x86 assembly (clang, -O0):
<min_l>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <min_l+0x27>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min_l+0x2f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_l>:
mov    %rdi,%rax
cmp    %rsi,%rdi
cmovg  %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @min_l(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %1, i64 %0
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ autonomousGUI();
int /*<<< orphan*/ initializeRobot();
void initializeAutonomous() {
  initializeRobot();
  autonomousGUI();
}


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

x86 assembly (clang, -O2):
<initializeAutonomous>:
push   %rax
xor    %eax,%eax
call   1040 <initializeRobot@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <autonomousGUI@plt>

LLVM IR (-O0):
define void @initializeAutonomous() {
%1 = call i32 (...) @initializeRobot()
%2 = call i32 (...) @autonomousGUI()
ret void
}

LLVM IR (-O2):
define void @initializeAutonomous() {
%1 = tail call i32 (...) @initializeRobot()
%2 = tail call i32 (...) @autonomousGUI()
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};
typedef int /*<<< orphan*/ delta;

/* Variables and functions */
int adjtime(struct timeval *, struct timeval *);
int /*<<< orphan*/ memset(struct timeval *, int /*<<< orphan*/, int);
int main(void) {
  struct timeval delta, tv;
  (void)memset(&delta, 0, sizeof(delta));
  return adjtime(&delta, &tv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <adjtime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <adjtime@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
store i32 0, i32* %1
%4 = call i32 @memset(%struct.timeval* %2, i32 0, i32 4)
%5 = call i32 @adjtime(%struct.timeval* %2, %struct.timeval* %3)
ret i32 %5
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @main() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timeval* %2 to i8*
%5 = call i32 @memset(%struct.timeval* %1, i32 0, i32 4)
%6 = call i32 @adjtime(%struct.timeval* %1, %struct.timeval* %2)
ret i32 %6
}
/* Type definitions */
typedef int u_int32_t;

/* Variables and functions */
u_int32_t bswap32(u_int32_t x) {
  return ((x << 24) & 0xff000000) | ((x << 8) & 0x00ff0000) |
         ((x >> 8) & 0x0000ff00) | ((x >> 24) & 0x000000ff);
}


x86 assembly (clang, -O0):
<bswap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff0000,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bswap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 24
%5 = and i32 %4, -16777216
%6 = load i32, i32* %2
%7 = shl i32 %6, 8
%8 = and i32 %7, 16711680
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = ashr i32 %10, 8
%12 = and i32 %11, 65280
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = ashr i32 %14, 24
%16 = and i32 %15, 255
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @bswap32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
int byte_row_uhc_2(int byte) {
  if (byte >= 0xa1 && byte < 0xff)
    return byte - 0xa1;
  else
    return -1;
}


x86 assembly (clang, -O0):
<byte_row_uhc_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa1,-0x8(%rbp)
jl     1131 <byte_row_uhc_2+0x31>
cmpl   $0xff,-0x8(%rbp)
jge    1131 <byte_row_uhc_2+0x31>
mov    -0x8(%rbp),%eax
sub    $0xa1,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <byte_row_uhc_2+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_row_uhc_2>:
lea    -0xa1(%rdi),%ecx
cmp    $0x5e,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @byte_row_uhc_2(i32 %0) {
%2 = add i32 %0, -161
%3 = icmp ult i32 %2, 94
%4 = select i1 %3, i32 %2, i32 -1
ret i32 %4
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int getopt_internal(int, char *const *, char const *, struct option const *,
                    int *, int);
int getopt_long_only(int nargc, char *const *nargv, const char *options,
                     const struct option *long_options, int *idx) {
  return (
      getopt_internal(nargc, nargv, options, long_options, idx, 0x01 | 0x04));
}


x86 assembly (clang, -O0):
<getopt_long_only>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x5,%r9d
call   1030 <getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long_only>:
mov    $0x5,%r9d
jmp    1030 <getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @getopt_internal(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 5)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @getopt_internal(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 5)
ret i32 %6
}
int adder(int x, int y) { return x + y; }


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

x86 assembly (clang, -O2):
<adder>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @adder(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @adder(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M220_f(char *s) {
  debug("M220_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M220_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M220_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M220_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M220_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M220_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M220_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int send(int /*<<< orphan*/, char const *, int, int /*<<< orphan*/);
int strlen(char const *);
int puts_tcp_stream(const char *str, FILE *s) {
  int len = strlen(str);
  if (send(fileno(s), str, len, 0) != len)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<puts_tcp_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fileno@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %ecx,%ecx
call   1040 <send@plt>
cmp    -0x1c(%rbp),%eax
je     117a <puts_tcp_stream+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1181 <puts_tcp_stream+0x51>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts_tcp_stream>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <fileno@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
xor    %ecx,%ecx
cmp    %ebp,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @puts_tcp_stream(i8* %0, i32* nocapture %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @fileno(i32* %1)
%5 = tail call i32 @send(i32 %4, i8* %0, i32 %3, i32 0)
%6 = icmp eq i32 %5, %3
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ error_check(char *);
int /*<<< orphan*/ flag_add(char *, int);
int /*<<< orphan*/ flag_del(char *);
int /*<<< orphan*/ gph_drwmenu();
void return_to_menu() {
  gph_drwmenu();
  error_check("DRAWING MENU (Terminal too small?)");
  flag_del("game_mode");
  flag_add("menu_mode", 1);
}


x86 assembly (clang, -O0):
<return_to_menu>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gph_drwmenu@plt>
lea    0xeae(%rip),%rdi
call   1060 <error_check@plt>
lea    0xec5(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xec3(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_to_menu>:
push   %rax
xor    %eax,%eax
call   1030 <gph_drwmenu@plt>
lea    0xeb1(%rip),%rdi
call   1060 <error_check@plt>
lea    0xec8(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xec6(%rip),%rdi
mov    $0x1,%esi
pop    %rax
jmp    1050 <flag_add@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"DRAWING MENU (Terminal too small?)\00"
@.str.1 = [10 x i8] c"game_mode\00"
@.str.2 = [10 x i8] c"menu_mode\00"
define void @return_to_menu() {
%1 = call i32 (...) @gph_drwmenu()
%2 = call i32 @error_check(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @flag_add(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"DRAWING MENU (Terminal too small?)\00"
@.str.1 = [10 x i8] c"game_mode\00"
@.str.2 = [10 x i8] c"menu_mode\00"
define void @return_to_menu() {
%1 = tail call i32 (...) @gph_drwmenu()
%2 = tail call i32 @error_check(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @flag_add(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ info();
void DispVersion(char *arg) {
  info();
  exit(1);
}


x86 assembly (clang, -O0):
<DispVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <info@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<DispVersion>:
push   %rax
xor    %eax,%eax
call   1040 <info@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @DispVersion(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @info()
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @DispVersion(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @info()
%3 = tail call i32 @exit(i32 1)
unreachable
}
void warn_err_obj(const char *obj) {
  do {
    char *msg;
    if ((msg = errmsg_err_obj(obj)) != ((void *)0)) {
      do_dispatch_message(msg);
      free(msg);
    } else {
      fallback_warn();
    }
  } while (0);
}


x86 assembly (clang, -O0):
<warn_err_obj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <errmsg_err_obj@plt>
cltq
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1180 <warn_err_obj+0x40>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <do_dispatch_message@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
jmp    1187 <warn_err_obj+0x47>
mov    $0x0,%al
call   1040 <fallback_warn@plt>
jmp    118c <warn_err_obj+0x4c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warn_err_obj>:
push   %rbx
xor    %eax,%eax
call   1050 <errmsg_err_obj@plt>
test   %eax,%eax
je     1162 <warn_err_obj+0x22>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <do_dispatch_message@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <fallback_warn@plt>

LLVM IR (-O0):
define void @warn_err_obj(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
br label %4
4: ; preds = %1
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @errmsg_err_obj to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = load i8*, i8** %3
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @do_dispatch_message to i32 (i8*, ...)*)(i8* %11)
%13 = load i8*, i8** %3
br label %16
14: ; preds = %4
%15 = call i32 (...) @fallback_warn()
br label %16
16: ; preds = %14, %10
br label %17
17: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @warn_err_obj(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @errmsg_err_obj to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
%5 = icmp eq i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @do_dispatch_message to i32 (i8*, ...)*)(i8* %4)
tail call void @free(i8* %4)
br label %10
8: ; preds = %1
%9 = tail call i32 (...) @fallback_warn()
br label %10
10: ; preds = %8, %6
ret void
}
double ft_abs(double n) { return ((n < 0 ? -n : n)); }


x86 assembly (clang, -O0):
<ft_abs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    113d <ft_abs+0x3d>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1147 <ft_abs+0x47>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_abs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ft_abs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
br label %10
8: ; preds = %1
%9 = load double, double* %2
br label %10
10: ; preds = %8, %5
%11 = phi double [ %7, %5 ], [ %9, %8 ]
ret double %11
}

LLVM IR (-O2):
define double @ft_abs(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}