xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sqlGetOptQuoteString(char **);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
void sqlFixedStringComma(char **pS, char *buf, int bufSize) {
  strncpy(buf, sqlGetOptQuoteString(pS), bufSize);
}


x86 assembly (clang, -O0):
<sqlFixedStringComma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sqlGetOptQuoteString@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    -0x14(%rbp),%edx
call   1030 <strncpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlFixedStringComma>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <sqlGetOptQuoteString@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
define void @sqlFixedStringComma(i8** %0, i8* %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i8**, i8*** %4
%9 = call i32 @sqlGetOptQuoteString(i8** %8)
%10 = load i32, i32* %6
%11 = call i32 @strncpy(i8* %7, i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
define void @sqlFixedStringComma(i8** %0, i8* %1, i32 %2) {
%4 = tail call i32 @sqlGetOptQuoteString(i8** %0)
%5 = tail call i32 @strncpy(i8* %1, i32 %4, i32 %2)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int array_string_compare(const void *s1, const void *s2) {
  return strcmp(*(char **)s1, *(char **)s2);
}


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

x86 assembly (clang, -O2):
<array_string_compare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @array_string_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ FUTEX_WAKE;
int __futex(void volatile *, int /*<<< orphan*/, int, int /*<<< orphan*/ *,
            int /*<<< orphan*/);
int __futex_wake(volatile void *ftx, int count) {
  return __futex(ftx, FUTEX_WAKE, count, NULL, 0);
}


x86 assembly (clang, -O0):
<__futex_wake>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
call   1030 <__futex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__futex_wake>:
mov    %esi,%edx
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <__futex@plt>

LLVM IR (-O0):
@FUTEX_WAKE = global i32 0
define i32 @__futex_wake(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* @FUTEX_WAKE
%7 = load i32, i32* %4
%8 = call i32 @__futex(i8* %5, i32 %6, i32 %7, i32* null, i32 0)
ret i32 %8
}

LLVM IR (-O2):
@FUTEX_WAKE = global i32 0
define i32 @__futex_wake(i8* %0, i32 %1) {
%3 = load i32, i32* @FUTEX_WAKE
%4 = tail call i32 @__futex(i8* %0, i32 %3, i32 %1, i32* null, i32 0)
ret i32 %4
}
int ShouldBeRight(int first, int second) { return first > second; }


x86 assembly (clang, -O0):
<ShouldBeRight>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShouldBeRight>:
xor    %eax,%eax
cmp    %esi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @ShouldBeRight(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @ShouldBeRight(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int wycc_type_flags(int);
int wycc_type_is_ref(int id) {
  int flgs = wycc_type_flags(id);
  if (flgs & 512) {
    return 1;
  };
  return 0;
}


x86 assembly (clang, -O0):
<wycc_type_is_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <wycc_type_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     1143 <wycc_type_is_ref+0x33>
movl   $0x1,-0x4(%rbp)
jmp    114a <wycc_type_is_ref+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wycc_type_is_ref>:
push   %rax
call   1030 <wycc_type_flags@plt>
shr    $0x9,%eax
and    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @wycc_type_is_ref(i32 %0) {
%2 = tail call i32 @wycc_type_flags(i32 %0)
%3 = lshr i32 %2, 9
%4 = and i32 %3, 1
ret i32 %4
}
double val_h(double r) { return (1. - 1. / r) / 2.; }


x86 assembly (clang, -O0):
<val_h>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm1
divsd  -0x8(%rbp),%xmm1
movsd  0xeea(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<val_h>:
movsd  0xef8(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
mulsd  0xeec(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @val_h(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double 1.000000e+00, %3
%5 = fsub double 1.000000e+00, %4
%6 = fdiv double %5, 2.000000e+00
ret double %6
}

LLVM IR (-O2):
define double @val_h(double %0) {
%2 = fdiv double 1.000000e+00, %0
%3 = fsub double 1.000000e+00, %2
%4 = fmul double %3, 5.000000e-01
ret double %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int major_code;
};
typedef TYPE_1__ XNoExposeEvent;

/* Variables and functions */
void set_XNoExposeEvent_major_code(void *_p, int _v) {
  ((XNoExposeEvent *)_p)->major_code = (int)_v;
}


x86 assembly (clang, -O0):
<set_XNoExposeEvent_major_code>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XNoExposeEvent_major_code>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XNoExposeEvent_major_code(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XNoExposeEvent_major_code(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
char int_to_hex(int);
void write_hex_byte(char *dest, uint8_t byte) {
  dest[0] = int_to_hex(byte >> 4);
  dest[1] = int_to_hex(byte & 0xf);
}


x86 assembly (clang, -O0):
<write_hex_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
sar    $0x4,%edi
call   1030 <int_to_hex@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%edi
and    $0xf,%edi
call   1030 <int_to_hex@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_hex_byte>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
sar    $0x4,%edi
call   1030 <int_to_hex@plt>
mov    %al,(%r14)
and    $0xf,%ebx
mov    %ebx,%edi
call   1030 <int_to_hex@plt>
mov    %al,0x1(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @write_hex_byte(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 4
%7 = call signext i8 @int_to_hex(i32 %6)
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %4
%11 = and i32 %10, 15
%12 = call signext i8 @int_to_hex(i32 %11)
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %14
ret void
}

LLVM IR (-O2):
define void @write_hex_byte(i8* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 4
%4 = tail call signext i8 @int_to_hex(i32 %3)
store i8 %4, i8* %0
%5 = and i32 %1, 15
%6 = tail call signext i8 @int_to_hex(i32 %5)
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %7
ret void
}
void cprop_result13(int *data) {
  int j = data[1];
  int k = data[0];
  if (j == 5 && k == 10)
    j = 115;
  data[2] = j;
}


x86 assembly (clang, -O0):
<cprop_result13>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x5,-0xc(%rbp)
jne    1136 <cprop_result13+0x36>
cmpl   $0xa,-0x10(%rbp)
jne    1136 <cprop_result13+0x36>
movl   $0x73,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cprop_result13>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
mov    %ecx,%edx
xor    $0x5,%edx
xor    $0xa,%eax
or     %edx,%eax
mov    $0x73,%eax
cmovne %ecx,%eax
mov    %eax,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @cprop_result13(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = load i32, i32* %0
%5 = icmp eq i32 %3, 5
%6 = icmp eq i32 %4, 10
%7 = select i1 %5, i1 %6, i1 false
%8 = select i1 %7, i32 115, i32 %3
%9 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %8, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ get_settings_file_path(char *);
int settings_file_exists() {
  char settings_path[128] = "";
  get_settings_file_path(settings_path);
  return access(settings_path, F_OK) == 0;
}


x86 assembly (clang, -O0):
<settings_file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    -0x80(%rbp),%rdi
call   1040 <get_settings_file_path@plt>
lea    -0x80(%rbp),%rdi
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
call   1050 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<settings_file_exists>:
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <get_settings_file_path@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @settings_file_exists() {
%1 = alloca [128 x i8]
%2 = bitcast [128 x i8]* %1 to i8*
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = call i32 @get_settings_file_path(i8* %3)
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* @F_OK
%7 = call i64 @access(i8* %5, i32 %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @settings_file_exists() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @get_settings_file_path(i8* %2)
%4 = load i32, i32* @F_OK
%5 = call i64 @access(i8* %2, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
void mutex_free(void *mtx) {}


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

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

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

LLVM IR (-O2):
define void @mutex_free(i8* nocapture %0) {
ret void
}
WAVE_init() {}


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

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

LLVM IR (-O0):
define i32 @WAVE_init() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @WAVE_init() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ lprintf(int, char *, char *);
int /*<<< orphan*/ strncpy(char *, unsigned char *, int);
int decode_waypoint(unsigned char *element, int element_len) {
  char waypoint[7];
  strncpy(waypoint, element, element_len);
  waypoint[element_len] = 0;
  lprintf(14, "Waypoint Name: %s\r\n", waypoint);
  return 0;
}


x86 assembly (clang, -O0):
<decode_waypoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x13(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x13(%rbp,%rax,1)
lea    -0x13(%rbp),%rdx
mov    $0xe,%edi
lea    0xea8(%rip),%rsi
call   1040 <lprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_waypoint>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0x1(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,0x1(%rsp,%rax,1)
lea    0xeb9(%rip),%rsi
mov    $0xe,%edi
mov    %r14,%rdx
call   1040 <lprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Waypoint Name: %s\0D\0A\00"
define i32 @decode_waypoint(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [7 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @strncpy(i8* %6, i8* %7, i32 %8)
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 %11
store i8 0, i8* %12
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%14 = call i32 @lprintf(i32 14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Waypoint Name: %s\0D\0A\00"
define i32 @decode_waypoint(i8* %0, i32 %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%5 = call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %6
store i8 0, i8* %7
%8 = call i32 @lprintf(i32 14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int execute_semtimedop() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_semtimedop() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_semtimedop() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *cmd) {
  printf("Usage: %s [-d] [-s] <binfile>\n", cmd);
  printf("  -d   show debug information\n");
  printf("  -s   read INBOX values from STDIN\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xef8(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: %s [-d] [-s] <binfile>\0A\00"
@.str.1 = [31 x i8] c" -d show debug information\0A\00"
@.str.2 = [37 x i8] c" -s read INBOX values from STDIN\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: %s [-d] [-s] <binfile>\0A\00"
@str = [30 x i8] c" -d show debug information\00"
@str.3 = [36 x i8] c" -s read INBOX values from STDIN\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
ret void
}
int span_dummy_rx_fillin(void *user_data, int len) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @span_dummy_rx_fillin(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
int MPI_Finalize(void) { return (0); }


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

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

LLVM IR (-O0):
define i32 @MPI_Finalize() {
ret i32 0
}

LLVM IR (-O2):
define i32 @MPI_Finalize() {
ret i32 0
}
void foo211(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo211(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NDFC_WRITE_REG_ST(int);
void NFC_DmaIntClearStatus(void) { NDFC_WRITE_REG_ST((1 << 2)); }


x86 assembly (clang, -O0):
<NFC_DmaIntClearStatus>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <NDFC_WRITE_REG_ST@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<NFC_DmaIntClearStatus>:
mov    $0x4,%edi
jmp    1030 <NDFC_WRITE_REG_ST@plt>

LLVM IR (-O0):
define void @NFC_DmaIntClearStatus() {
%1 = call i32 @NDFC_WRITE_REG_ST(i32 4)
ret void
}

LLVM IR (-O2):
define void @NFC_DmaIntClearStatus() {
%1 = tail call i32 @NDFC_WRITE_REG_ST(i32 4)
ret void
}
/* Variables and functions */
char *environment_application();
char *environment_application_name(void) { return environment_application(); }


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

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

LLVM IR (-O0):
define i8* @environment_application_name() {
%1 = call i8* (...) @environment_application()
ret i8* %1
}

LLVM IR (-O2):
define i8* @environment_application_name() {
%1 = tail call i8* (...) @environment_application()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void MyLibraryFunctionToTest() { printf("Test Function\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Test Function\00"
define void @MyLibraryFunctionToTest() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
bool nrf52_errata_236(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf52_errata_236() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf52_errata_236() {
ret i32 0
}
/* Type definitions */
struct party {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clif_party_message(struct party *, int, char *, int);
struct party *party_search(int);
int party_recv_message(int party_id, int account_id, char *mes, int len) {
  struct party *p;
  if ((p = party_search(party_id)) == NULL)
    return 0;
  clif_party_message(p, account_id, mes, len);
  return 0;
}


x86 assembly (clang, -O0):
<party_recv_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <party_search@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1157 <party_recv_message+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1171 <party_recv_message+0x51>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <clif_party_message@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<party_recv_message>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %esi,%ebp
call   1040 <party_search@plt>
test   %rax,%rax
je     1146 <party_recv_message+0x26>
mov    %rax,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1030 <clif_party_message@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.party = type { i32 }
define i32 @party_recv_message(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.party*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i32, i32* %6
%12 = call %struct.party* @party_search(i32 %11)
store %struct.party* %12, %struct.party** %10
%13 = icmp eq %struct.party* %12, null
br i1 %13, label %14, label %15
14: ; preds = %4
store i32 0, i32* %5
br label %21
15: ; preds = %4
%16 = load %struct.party*, %struct.party** %10
%17 = load i32, i32* %7
%18 = load i8*, i8** %8
%19 = load i32, i32* %9
%20 = call i32 @clif_party_message(%struct.party* %16, i32 %17, i8* %18, i32 %19)
store i32 0, i32* %5
br label %21
21: ; preds = %15, %14
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
%struct.party = type { i32 }
define i32 @party_recv_message(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call %struct.party* @party_search(i32 %0)
%6 = icmp eq %struct.party* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @clif_party_message(%struct.party* %5, i32 %1, i8* %2, i32 %3)
br label %9
9: ; preds = %4, %7
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_int(long long);
int /*<<< orphan*/ print_nl();
int /*<<< orphan*/ print_str(char *);
void print_int_nl(char *s, long long v) {
  print_str(s);
  print_int(v);
  print_nl();
}


x86 assembly (clang, -O0):
<print_int_nl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <print_str@plt>
mov    -0x10(%rbp),%rdi
call   1050 <print_int@plt>
mov    $0x0,%al
call   1030 <print_nl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_nl>:
push   %rbx
mov    %rsi,%rbx
call   1040 <print_str@plt>
mov    %rbx,%rdi
call   1050 <print_int@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <print_nl@plt>

LLVM IR (-O0):
define void @print_int_nl(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = call i32 @print_str(i8* %5)
%7 = load i64, i64* %4
%8 = call i32 @print_int(i64 %7)
%9 = call i32 (...) @print_nl()
ret void
}

LLVM IR (-O2):
define void @print_int_nl(i8* %0, i64 %1) {
%3 = tail call i32 @print_str(i8* %0)
%4 = tail call i32 @print_int(i64 %1)
%5 = tail call i32 (...) @print_nl()
ret void
}
int condition_squareBracketClose(char c) { return c == ']'; }


x86 assembly (clang, -O0):
<condition_squareBracketClose>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<condition_squareBracketClose>:
xor    %eax,%eax
cmp    $0x5d,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @condition_squareBracketClose(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 93
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @condition_squareBracketClose(i8 signext %0) {
%2 = icmp eq i8 %0, 93
%3 = zext i1 %2 to i32
ret i32 %3
}
unsigned long long rdtsc(void) {
  unsigned int low, high;
  asm volatile("rdtsc" : "=a"(low), "=d"(high));
  return (unsigned long long)high << 32 | low;
}


x86 assembly (clang, -O0):
<rdtsc>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %eax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x20,%rax
mov    -0x4(%rbp),%ecx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdtsc>:
rdtsc
shl    $0x20,%rdx
mov    %eax,%eax
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @rdtsc() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = shl i64 %7, 32
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = or i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @rdtsc() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 %4, 32
%6 = zext i32 %2 to i64
%7 = or i64 %5, %6
ret i64 %7
}
unsigned xrop3_40_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T ^ S;
  stk1 = D & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


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

x86 assembly (clang, -O2):
<xrop3_40_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
not    %eax
and    %esi,%eax
xor    %edi,%esi
and    %esi,%edi
not    %ecx
and    %esi,%ecx
or     %edi,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_40_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i8 %1, %0
%8 = zext i8 %7 to i32
%9 = and i8 %7, %0
%10 = zext i8 %9 to i32
%11 = xor i32 %6, -1
%12 = and i32 %11, %8
%13 = xor i32 %4, -1
%14 = and i32 %13, %5
%15 = or i32 %14, %10
%16 = or i32 %15, %12
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int do_modem() { printf("don't have a modem\n"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"don't have a modem\0A\00"
define i32 @do_modem() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [19 x i8] c"don't have a modem\00"
define i32 @do_modem() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__29__IO__set();
void Msp430GpioC__6__HplGeneralIO__set(void) {
  HplMsp430GeneralIOP__29__IO__set();
}


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

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

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

LLVM IR (-O2):
define void @Msp430GpioC__6__HplGeneralIO__set() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__29__IO__set()
ret void
}
long int iTrunc(double f) { return (long int)f; }


x86 assembly (clang, -O0):
<iTrunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iTrunc>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @iTrunc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @iTrunc(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int quaddobl_diagonal_cascade_solutions(int a, int b) {
  int fail;
  double *c;
  fail = _ada_use_c2phc(298, &a, &b, c);
  return fail;
}


x86 assembly (clang, -O0):
<quaddobl_diagonal_cascade_solutions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x12a,%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_diagonal_cascade_solutions>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    $0x12a,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @quaddobl_diagonal_cascade_solutions(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load double*, double** %6
%8 = call i32 @_ada_use_c2phc(i32 298, i32* %3, i32* %4, double* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @quaddobl_diagonal_cascade_solutions(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @_ada_use_c2phc(i32 298, i32* %3, i32* %4, double* undef)
ret i32 %5
}
unsigned char inportb(unsigned short _port) {
  unsigned char rv;
  asm volatile("inb %1, %0" : "=a"(rv) : "dN"(_port));
  return rv;
}


x86 assembly (clang, -O0):
<inportb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inportb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inportb(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm sideeffect "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inportb(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
void menu_quitmenu_open(void) { return; }


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

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

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

LLVM IR (-O2):
define void @menu_quitmenu_open() {
ret void
}
char *strcat(char *d, const char *s) {
  char *r = d;
  for (; *d; d++) {
  }
  for (; *s; s++, d++)
    *d = *s;
  return r;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1137 <strcat+0x37>
jmp    1126 <strcat+0x26>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcat+0x14>
jmp    113c <strcat+0x3c>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1172 <strcat+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    113c <strcat+0x3c>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
mov    (%rsi),%dl
test   %dl,%dl
je     1141 <strcat+0x41>
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %dl,-0x1(%rcx,%rdi,1)
movzbl 0x1(%rsi,%rdi,1),%edx
add    $0x1,%rdi
test   %dl,%dl
jne    1130 <strcat+0x30>
ret

LLVM IR (-O0):
define i8* @strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %12, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
br label %12
12: ; preds = %11
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
br label %7
15: ; preds = %7
br label %16
16: ; preds = %24, %15
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = load i8*, i8** %3
store i8 %22, i8* %23
br label %24
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
br label %16
29: ; preds = %16
%30 = load i8*, i8** %5
ret i8* %30
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %16, %11 ], [ %4, %8 ]
%14 = phi i8* [ %15, %11 ], [ %1, %8 ]
store i8 %12, i8* %13
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = getelementptr inbounds i8, i8* %13, i64 1
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
ret i8* %0
}
/* Variables and functions */
char *read_file(const char *file_name, int *length) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @read_file(i8* nocapture readnone %0, i32* nocapture readnone %1) {
ret i8* null
}
unsigned int getRegisterCount(const unsigned int opcode) {
  unsigned int nRc;
  switch (opcode & 0x00408000) {
  case 0x00000000:
    nRc = 4;
    break;
  case 0x00008000:
    nRc = 1;
    break;
  case 0x00400000:
    nRc = 2;
    break;
  case 0x00408000:
    nRc = 3;
    break;
  default:
    nRc = 0;
  }
  return (nRc);
}


x86 assembly (clang, -O0):
<getRegisterCount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x408000,%eax
mov    %eax,-0xc(%rbp)
je     1156 <getRegisterCount+0x56>
jmp    111d <getRegisterCount+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x8000,%eax
je     1162 <getRegisterCount+0x62>
jmp    1130 <getRegisterCount+0x30>
mov    -0xc(%rbp),%eax
sub    $0x400000,%eax
je     116e <getRegisterCount+0x6e>
jmp    1143 <getRegisterCount+0x43>
mov    -0xc(%rbp),%eax
sub    $0x408000,%eax
je     117a <getRegisterCount+0x7a>
jmp    1186 <getRegisterCount+0x86>
movl   $0x4,-0x8(%rbp)
jmp    118d <getRegisterCount+0x8d>
movl   $0x1,-0x8(%rbp)
jmp    118d <getRegisterCount+0x8d>
movl   $0x2,-0x8(%rbp)
jmp    118d <getRegisterCount+0x8d>
movl   $0x3,-0x8(%rbp)
jmp    118d <getRegisterCount+0x8d>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRegisterCount>:
and    $0x408000,%edi
cmp    $0x3fffff,%edi
jg     111d <getRegisterCount+0x1d>
mov    $0x4,%eax
test   %edi,%edi
je     1130 <getRegisterCount+0x30>
mov    $0x1,%eax
ret
cmp    $0x400000,%edi
jne    112b <getRegisterCount+0x2b>
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @getRegisterCount(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 4227072
switch i32 %5, label %10 [
i32 0, label %6
i32 32768, label %7
i32 4194304, label %8
i32 4227072, label %9
]
6: ; preds = %1
store i32 4, i32* %3
br label %11
7: ; preds = %1
store i32 1, i32* %3
br label %11
8: ; preds = %1
store i32 2, i32* %3
br label %11
9: ; preds = %1
store i32 3, i32* %3
br label %11
10: ; preds = %1
store i32 0, i32* %3
br label %11
11: ; preds = %10, %9, %8, %7, %6
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @getRegisterCount(i32 %0) {
%2 = and i32 %0, 4227072
switch i32 %2, label %6 [
i32 0, label %7
i32 32768, label %3
i32 4194304, label %4
i32 4227072, label %5
]
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
unreachable
7: ; preds = %1, %5, %4, %3
%8 = phi i32 [ 3, %5 ], [ 2, %4 ], [ 1, %3 ], [ 4, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int sblib_func_getname(int index, char *proc_name) {
  switch (index) {
  case 0:
    strcpy(proc_name, "LIBFUNCTEST");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sblib_func_getname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
test   %eax,%eax
jne    114b <sblib_func_getname+0x3b>
jmp    112f <sblib_func_getname+0x1f>
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    1152 <sblib_func_getname+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sblib_func_getname>:
xor    %eax,%eax
test   %edi,%edi
je     1117 <sblib_func_getname+0x7>
ret
push   %rax
lea    0xee1(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"LIBFUNCTEST\00"
define i32 @sblib_func_getname(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
switch i32 %6, label %10 [
i32 0, label %7
]
7: ; preds = %2
%8 = load i8*, i8** %5
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %11
10: ; preds = %2
store i32 0, i32* %3
br label %11
11: ; preds = %10, %7
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [12 x i8] c"LIBFUNCTEST\00"
define i32 @sblib_func_getname(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ scan_hex_Good(char *);
void call_scan_hex2_Good_FP() {
  char *cp = "0aA";
  scan_hex_Good(cp);
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"0aA\00"
define void @call_scan_hex2_Good_FP() {
%1 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @scan_hex_Good(i8* %2)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"0aA\00"
define void @call_scan_hex2_Good_FP() {
%1 = tail call i32 @scan_hex_Good(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct binder_io {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ *bio_get(struct binder_io *, size_t);
scalar_t__ bio_get_uint32(struct binder_io *);
uint16_t *bio_get_string16(struct binder_io *bio, size_t *sz) {
  size_t len;
  len = (size_t)bio_get_uint32(bio);
  if (sz)
    *sz = len;
  return bio_get(bio, (len + 1) * sizeof(uint16_t));
}


x86 assembly (clang, -O0):
<bio_get_string16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <bio_get_uint32@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1153 <bio_get_string16+0x33>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
shl    $0x2,%rsi
call   1030 <bio_get@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bio_get_string16>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <bio_get_uint32@plt>
test   %r14,%r14
je     1137 <bio_get_string16+0x17>
mov    %rax,(%r14)
lea    0x4(,%rax,4),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <bio_get@plt>

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

LLVM IR (-O2):
%struct.binder_io = type { i32 }
define i32* @bio_get_string16(%struct.binder_io* %0, i64* writeonly %1) {
%3 = tail call i64 @bio_get_uint32(%struct.binder_io* %0)
%4 = icmp eq i64* %1, null
br i1 %4, label %6, label %5
5: ; preds = %2
store i64 %3, i64* %1
br label %6
6: ; preds = %5, %2
%7 = shl i64 %3, 2
%8 = add i64 %7, 4
%9 = tail call i32* @bio_get(%struct.binder_io* %0, i64 %8)
ret i32* %9
}