xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ aes_encrypt(unsigned char *, unsigned char *,
                               unsigned long *, int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
void aes_128_encrypt(unsigned char blk[16], unsigned long expanded_key[44]) {
  unsigned char tmp_blk[16];
  memcpy(tmp_blk, blk, 16);
  aes_encrypt(tmp_blk, blk, expanded_key, 128);
}


x86 assembly (clang, -O0):
<aes_128_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x80,%ecx
call   1030 <aes_encrypt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_128_encrypt>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0x80,%ecx
call   1030 <aes_encrypt@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @aes_128_encrypt(i8* %0, i64* %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = call i32 @memcpy(i8* %4, i8* %0, i32 16)
%6 = call i32 @aes_encrypt(i8* %4, i8* %0, i64* %1, i32 128)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int _print_nb(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int printf_handle_flag_d(va_list *parameters) {
  return _print_nb(parameters, 0, 10);
}


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

x86 assembly (clang, -O2):
<printf_handle_flag_d>:
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <_print_nb@plt>

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

LLVM IR (-O2):
define i32 @printf_handle_flag_d(i32* %0) {
%2 = tail call i32 @_print_nb(i32* %0, i32 0, i32 10)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int _atan2_fix(int /*<<< orphan*/, int /*<<< orphan*/);
float atan2_fix(int16_t y, int16_t x) {
  return _atan2_fix(y, x) / (0xFFFF / 6.283185307179586476925286);
}


x86 assembly (clang, -O0):
<atan2_fix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <_atan2_fix@plt>
cvtsi2sd %eax,%xmm0
movsd  0xecb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2_fix>:
push   %rax
call   1030 <_atan2_fix@plt>
cvtsi2sd %eax,%xmm0
divsd  0xede(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @atan2_fix(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @_atan2_fix(i32 %5, i32 %6)
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 0x40C45F1C0E995AB9
%10 = fptrunc double %9 to float
ret float %10
}

LLVM IR (-O2):
define float @atan2_fix(i32 %0, i32 %1) {
%3 = tail call i32 @_atan2_fix(i32 %0, i32 %1)
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 0x40C45F1C0E995AB9
%6 = fptrunc double %5 to float
ret float %6
}
void deallocate_MultiHeader(struct MultiHeader *v) {}


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

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

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

LLVM IR (-O2):
%struct.MultiHeader = type opaque
define void @deallocate_MultiHeader(%struct.MultiHeader* nocapture %0) {
ret void
}
/* Variables and functions */
unsigned int x87_get_control_word();
int /*<<< orphan*/ x87_set_control_word(unsigned int);
unsigned int x87_set_double_precision(void) {
  unsigned int mode = x87_get_control_word();
  x87_set_control_word((mode & ~0x300) | 0x200);
  return mode;
}


x86 assembly (clang, -O0):
<x87_set_double_precision>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <x87_get_control_word@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0xfffffcff,%edi
or     $0x200,%edi
call   1030 <x87_set_control_word@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x87_set_double_precision>:
push   %rbx
xor    %eax,%eax
call   1040 <x87_get_control_word@plt>
mov    %eax,%ebx
mov    %eax,%edi
and    $0xfffffcff,%edi
or     $0x200,%edi
call   1030 <x87_set_control_word@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @x87_set_double_precision() {
%1 = alloca i32
%2 = call i32 (...) @x87_get_control_word()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = and i32 %3, -769
%5 = or i32 %4, 512
%6 = call i32 @x87_set_control_word(i32 %5)
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @x87_set_double_precision() {
%1 = tail call i32 (...) @x87_get_control_word()
%2 = and i32 %1, -769
%3 = or i32 %2, 512
%4 = tail call i32 @x87_set_control_word(i32 %3)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strptime(char *, char *, struct tm *);
int /*<<< orphan*/ timegm(struct tm *);
time_t c_parse_http_time(char *s) {
  struct tm dest;
  strptime(s, "%a, %d %b %Y %H:%M:%S GMT", &dest);
  return timegm(&dest);
}


x86 assembly (clang, -O0):
<c_parse_http_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <strptime@plt>
lea    -0x10(%rbp),%rdi
call   1030 <timegm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_parse_http_time>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <strptime@plt>
mov    %rbx,%rdi
call   1030 <timegm@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [26 x i8] c"%a, %d %b %Y %H:%M:%S GMT\00"
define i32 @c_parse_http_time(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strptime(i8* %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
%6 = call i32 @timegm(%struct.tm* %3)
ret i32 %6
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [26 x i8] c"%a, %d %b %Y %H:%M:%S GMT\00"
define i32 @c_parse_http_time(i8* %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = call i32 @strptime(i8* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%5 = call i32 @timegm(%struct.tm* %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ gpst2bdt(int /*<<< orphan*/);
int /*<<< orphan*/ time2bdt(int /*<<< orphan*/, int *);
int /*<<< orphan*/ timeget();
int /*<<< orphan*/ utc2gpst(int /*<<< orphan*/);
int adjbdtweek(int week) {
  int w;
  (void)time2bdt(gpst2bdt(utc2gpst(timeget())), &w);
  if (w < 1) {
    w = 1;
  }
  return week + (w - week + 512) / 1024 * 1024;
}


x86 assembly (clang, -O0):
<adjbdtweek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <timeget@plt>
mov    %eax,%edi
call   1030 <utc2gpst@plt>
mov    %eax,%edi
call   1040 <gpst2bdt@plt>
mov    %eax,%edi
lea    -0x8(%rbp),%rsi
call   1060 <time2bdt@plt>
cmpl   $0x1,-0x8(%rbp)
jge    117c <adjbdtweek+0x3c>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x200,%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
shl    $0xa,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjbdtweek>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <timeget@plt>
mov    %eax,%edi
call   1030 <utc2gpst@plt>
mov    %eax,%edi
call   1040 <gpst2bdt@plt>
lea    0xc(%rsp),%rsi
mov    %eax,%edi
call   1060 <time2bdt@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
mov    $0x1,%eax
cmovg  %ecx,%eax
sub    %ebx,%eax
lea    0x200(%rax),%ecx
add    $0x5ff,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
and    $0xfffffc00,%eax
add    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @adjbdtweek(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @timeget()
%5 = call i32 @utc2gpst(i32 %4)
%6 = call i32 @gpst2bdt(i32 %5)
%7 = call i32 @time2bdt(i32 %6, i32* %3)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 1, i32* %3
br label %11
11: ; preds = %10, %1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 512
%17 = sdiv i32 %16, 1024
%18 = mul nsw i32 %17, 1024
%19 = add nsw i32 %12, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @adjbdtweek(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (...) @timeget()
%5 = tail call i32 @utc2gpst(i32 %4)
%6 = tail call i32 @gpst2bdt(i32 %5)
%7 = call i32 @time2bdt(i32 %6, i32* %2)
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 1
%10 = select i1 %9, i32 %8, i32 1
%11 = sub i32 512, %0
%12 = add i32 %11, %10
%13 = sdiv i32 %12, 1024
%14 = shl nsw i32 %13, 10
%15 = add nsw i32 %14, %0
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int SSL_shutdown(int /*<<< orphan*/ *const);
int close_ssl_connection(SSL *const ssl_h) {
  int rc = SSL_shutdown(ssl_h);
  if (!rc)
    rc = SSL_shutdown(ssl_h);
  return 0;
}


x86 assembly (clang, -O0):
<close_ssl_connection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <SSL_shutdown@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    113e <close_ssl_connection+0x2e>
mov    -0x8(%rbp),%rdi
call   1030 <SSL_shutdown@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_ssl_connection>:
push   %rbx
mov    %rdi,%rbx
call   1030 <SSL_shutdown@plt>
test   %eax,%eax
jne    1125 <close_ssl_connection+0x15>
mov    %rbx,%rdi
call   1030 <SSL_shutdown@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @close_ssl_connection(i32* %0) {
%2 = tail call i32 @SSL_shutdown(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @SSL_shutdown(i32* %0)
br label %6
6: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
bool nrf52_errata_233(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_233() {
ret i32 0
}
void foo() { unsigned char int_latin1[] = "f\200\372b\200\343\200\340"; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x9(%rbp)
mov    0xef3(%rip),%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.foo.int_latin1 = [9 x i8] c"f\80\FAb\80\E3\80\E0\00"
define void @foo() {
%1 = alloca [9 x i8]
%2 = bitcast [9 x i8]* %1 to i8*
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
max(int a, int b) { return a > b ? a : b; }


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

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

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int strlen(char *str) {
  int i;
  for (i = 0; str[i] != '\0'; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <strlen+0x37>
jmp    1129 <strlen+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void TtlUnmarshal_uint8_t(uint8_t **cursor, uint8_t *x) {
  *x = **cursor;
  *cursor += 1;
}


x86 assembly (clang, -O0):
<TtlUnmarshal_uint8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TtlUnmarshal_uint8_t>:
mov    (%rdi),%rax
mov    (%rax),%ecx
mov    %ecx,(%rsi)
add    $0x4,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @TtlUnmarshal_uint8_t(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** %5
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
store i32 %7, i32* %8
%9 = load i32**, i32*** %3
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32* %11, i32** %9
ret void
}

LLVM IR (-O2):
define void @TtlUnmarshal_uint8_t(i32** nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32*, i32** %0
%4 = load i32, i32* %3
store i32 %4, i32* %1
%5 = getelementptr inbounds i32, i32* %3, i64 1
store i32* %5, i32** %0
ret void
}
unsigned int of_hweight32(unsigned int w) {
  unsigned int res = w - ((w >> 1) & 0x55555555);
  res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
  res = (res + (res >> 4)) & 0x0F0F0F0F;
  res = res + (res >> 8);
  return (res + (res >> 16)) & 0x000000FF;
}


x86 assembly (clang, -O0):
<of_hweight32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
and    $0x55555555,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x33333333,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<of_hweight32>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
add    %ecx,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @of_hweight32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
%7 = and i32 %6, 1431655765
%8 = sub i32 %4, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 858993459
%11 = load i32, i32* %3
%12 = lshr i32 %11, 2
%13 = and i32 %12, 858993459
%14 = add i32 %10, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = lshr i32 %16, 4
%18 = add i32 %15, %17
%19 = and i32 %18, 252645135
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %3
%22 = lshr i32 %21, 8
%23 = add i32 %20, %22
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = load i32, i32* %3
%26 = lshr i32 %25, 16
%27 = add i32 %24, %26
%28 = and i32 %27, 255
ret i32 %28
}

LLVM IR (-O2):
define i32 @of_hweight32(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
%12 = lshr i32 %11, 8
%13 = add nuw nsw i32 %12, %11
%14 = lshr i32 %13, 16
%15 = add nuw nsw i32 %14, %13
%16 = and i32 %15, 63
ret i32 %16
}
double RoundToUnity(const double value) {
  return (value < 0.0 ? 0.0 : (value > 1.0) ? 1.0 : value);
}


x86 assembly (clang, -O0):
<RoundToUnity>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1124 <RoundToUnity+0x24>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <RoundToUnity+0x61>
movsd  -0x8(%rbp),%xmm0
movsd  0xecf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <RoundToUnity+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <RoundToUnity+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<RoundToUnity>:
movsd  0xef8(%rip),%xmm1
minsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm2,%xmm0
andnpd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @RoundToUnity(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 %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp ogt double %7, 1.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load double, double* %2
br label %12
12: ; preds = %10, %9
%13 = phi double [ 1.000000e+00, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi double [ 0.000000e+00, %5 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @RoundToUnity(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 1.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double 0.000000e+00, double %4
ret double %5
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int UINT64_C(int);
void fiat_secp256k1_msat(uint64_t out1[5]) {
  out1[0] = UINT64_C(0xfffffffefffffc2f);
  out1[1] = UINT64_C(0xffffffffffffffff);
  out1[2] = UINT64_C(0xffffffffffffffff);
  out1[3] = UINT64_C(0xffffffffffffffff);
  out1[4] = 0x0;
}


x86 assembly (clang, -O0):
<fiat_secp256k1_msat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xfffffc2f,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_secp256k1_msat>:
push   %rbx
mov    %rdi,%rbx
mov    $0xfffffc2f,%edi
call   1030 <UINT64_C@plt>
mov    %eax,(%rbx)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,0x4(%rbx)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,0x8(%rbx)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,0xc(%rbx)
movl   $0x0,0x10(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @fiat_secp256k1_msat(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @UINT64_C(i32 -977)
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
store i32 %3, i32* %5
%6 = call i32 @UINT64_C(i32 -1)
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
store i32 %6, i32* %8
%9 = call i32 @UINT64_C(i32 -1)
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 2
store i32 %9, i32* %11
%12 = call i32 @UINT64_C(i32 -1)
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 3
store i32 %12, i32* %14
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i64 4
store i32 0, i32* %16
ret void
}

LLVM IR (-O2):
define void @fiat_secp256k1_msat(i32* nocapture writeonly %0) {
%2 = tail call i32 @UINT64_C(i32 -977)
store i32 %2, i32* %0
%3 = tail call i32 @UINT64_C(i32 -1)
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
%5 = tail call i32 @UINT64_C(i32 -1)
%6 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %5, i32* %6
%7 = tail call i32 @UINT64_C(i32 -1)
%8 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %7, i32* %8
%9 = getelementptr inbounds i32, i32* %0, i64 4
store i32 0, i32* %9
ret void
}
/* Type definitions */
struct rill_store_it {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rill_store_it *);
void rill_store_it_free(struct rill_store_it *it) { free(it); }


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

x86 assembly (clang, -O2):
<rill_store_it_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.rill_store_it = type { i32 }
define void @rill_store_it_free(%struct.rill_store_it* %0) {
%2 = alloca %struct.rill_store_it*
store %struct.rill_store_it* %0, %struct.rill_store_it** %2
%3 = load %struct.rill_store_it*, %struct.rill_store_it** %2
%4 = call i32 @free(%struct.rill_store_it* %3)
ret void
}

LLVM IR (-O2):
%struct.rill_store_it = type { i32 }
define void @rill_store_it_free(%struct.rill_store_it* nocapture %0) {
%2 = tail call i32 @free(%struct.rill_store_it* %0)
ret void
}
/* Variables and functions */
double ctrls_value(int);
double ctrls_sample_pan(int key) {
  double panHigh = ctrls_value(8);
  double panLow = ctrls_value(7);
  double m = (panHigh - panLow) / 87.0;
  return panLow + m * ((double)key - 21);
}


x86 assembly (clang, -O0):
<ctrls_sample_pan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x8,%edi
call   1030 <ctrls_value@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x7,%edi
call   1030 <ctrls_value@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xebd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe95(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctrls_sample_pan>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    $0x8,%edi
call   1030 <ctrls_value@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x7,%edi
call   1030 <ctrls_value@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0xebd(%rip),%xmm1
movapd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
addsd  0xeb2(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @ctrls_sample_pan(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 %0, i32* %2
%6 = call double @ctrls_value(i32 8)
store double %6, double* %3
%7 = call double @ctrls_value(i32 7)
store double %7, double* %4
%8 = load double, double* %3
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = fdiv double %10, 8.700000e+01
store double %11, double* %5
%12 = load double, double* %4
%13 = load double, double* %5
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
%16 = fsub double %15, 2.100000e+01
%17 = call double @llvm.fmuladd.f64(double %13, double %16, double %12)
ret double %17
}

LLVM IR (-O2):
define double @ctrls_sample_pan(i32 %0) {
%2 = tail call double @ctrls_value(i32 8)
%3 = tail call double @ctrls_value(i32 7)
%4 = fsub double %2, %3
%5 = fdiv double %4, 8.700000e+01
%6 = sitofp i32 %0 to double
%7 = fadd double %6, -2.100000e+01
%8 = tail call double @llvm.fmuladd.f64(double %5, double %7, double %3)
ret double %8
}
unsigned short ReadShort(unsigned char *ptr) {
  return (unsigned short)(ptr[1] << 8 | ptr[0]);
}


x86 assembly (clang, -O0):
<ReadShort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadShort>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i16 @ReadShort(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %7, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @ReadShort(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = zext i8 %3 to i16
%5 = shl nuw i16 %4, 8
%6 = load i8, i8* %0
%7 = zext i8 %6 to i16
%8 = or i16 %5, %7
ret i16 %8
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_panic__();
void _assert_int_not_equal(const unsigned long long a,
                           const unsigned long long b, const char *const file,
                           const int line) {
  __coverity_panic__();
}


x86 assembly (clang, -O0):
<_assert_int_not_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <__coverity_panic__@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @_assert_int_not_equal(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = call i32 (...) @__coverity_panic__()
ret void
}

LLVM IR (-O2):
define void @_assert_int_not_equal(i64 %0, i64 %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i32 (...) @__coverity_panic__()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ inb(unsigned long);
void insb(unsigned long port, void *dst, unsigned long count) {
  unsigned char *p = dst;
  while (count--)
    *p++ = inb(port);
}


x86 assembly (clang, -O0):
<insb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1166 <insb+0x56>
mov    -0x8(%rbp),%rdi
call   1030 <inb@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    112c <insb+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insb>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1145 <insb+0x35>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <inb@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <insb+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @insb(i64 %0, i8* nocapture writeonly %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3, %5
%6 = phi i8* [ %11, %5 ], [ %1, %3 ]
%7 = phi i64 [ %8, %5 ], [ %2, %3 ]
%8 = add i64 %7, -1
%9 = tail call i32 @inb(i64 %0)
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %10, i8* %6
%12 = icmp eq i64 %8, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %3
ret void
}
/* Variables and functions */
void *calloc(size_t, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ logmsg(int, char *, size_t);
void *scalloc(size_t size) {
  void *result = calloc(size, 1);
  if (result == NULL) {
    logmsg(0x03, "malloc(%zu) failed\n", size);
    exit(1);
  }
  return result;
}


x86 assembly (clang, -O0):
<scalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1178 <scalloc+0x48>
mov    -0x8(%rbp),%rdx
mov    $0x3,%edi
lea    0xe97(%rip),%rsi
call   1040 <logmsg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalloc>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1145 <scalloc+0x15>
pop    %rbx
ret
lea    0xeb4(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
call   1040 <logmsg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [20 x i8] c"malloc(%zu) failed\0A\00"
define i8* @scalloc(i64 %0) {
%2 = tail call i8* @calloc(i64 %0, i32 1)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @logmsg(i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Variables and functions */
size_t strlen(const char *s) {
  const char *t;
  for (t = s; *t; ++t)
    ;
  return t - s;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <strlen+0x33>
jmp    1122 <strlen+0x22>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Type definitions */
struct stat {
  size_t st_size;
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISREG(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
size_t fsize(const char *s) {
  struct stat st;
  if (stat(s, &st) == 0 && S_ISREG(st.st_mode)) {
    return st.st_size;
  } else {
    return (size_t)-1;
  }
}


x86 assembly (clang, -O0):
<fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    1162 <fsize+0x42>
mov    -0x18(%rbp),%edi
call   1040 <S_ISREG@plt>
cmp    $0x0,%rax
je     1162 <fsize+0x42>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116a <fsize+0x4a>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsize>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    $0xffffffffffffffff,%rbx
test   %rax,%rax
jne    114b <fsize+0x2b>
mov    0x8(%rsp),%edi
call   1040 <S_ISREG@plt>
test   %rax,%rax
je     114b <fsize+0x2b>
mov    (%rsp),%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.stat = type { i64, i32 }
define i64 @fsize(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 1
%8 = load i32, i32* %7
%9 = call i64 @S_ISREG(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%13 = load i64, i64* %12
br label %14
14: ; preds = %1, %6, %11
%15 = phi i64 [ %13, %11 ], [ -1, %6 ], [ -1, %1 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0x0b() {
  Assert_real((isalnum(11) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              60, ("isalnum should be 0 for 0x0b"));
}


x86 assembly (clang, -O0):
<t_isalnum_0x0b>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x3c,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalnum_0x0b>:
push   %rax
mov    $0xb,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3c,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0x0b\00"
define void @t_isalnum_0x0b() {
%1 = call i64 @isalnum(i32 11)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 60, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0x0b\00"
define void @t_isalnum_0x0b() {
%1 = tail call i64 @isalnum(i32 11)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 60, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int isProgramExpression(int c) {
  if ((c >= 0x20) && (c <= 0x7e)) {
    if ((c != 0x22) && (c != 0x23) && (c != 0x27) && (c != 0x28) &&
        (c != 0x29) && (c != 0x3B)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isProgramExpression>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jl     1168 <isProgramExpression+0x68>
cmpl   $0x7e,-0x8(%rbp)
jg     1168 <isProgramExpression+0x68>
cmpl   $0x22,-0x8(%rbp)
je     1163 <isProgramExpression+0x63>
cmpl   $0x23,-0x8(%rbp)
je     1163 <isProgramExpression+0x63>
cmpl   $0x27,-0x8(%rbp)
je     1163 <isProgramExpression+0x63>
cmpl   $0x28,-0x8(%rbp)
je     1163 <isProgramExpression+0x63>
cmpl   $0x29,-0x8(%rbp)
je     1163 <isProgramExpression+0x63>
cmpl   $0x3b,-0x8(%rbp)
je     1163 <isProgramExpression+0x63>
movl   $0x1,-0x4(%rbp)
jmp    116f <isProgramExpression+0x6f>
jmp    1168 <isProgramExpression+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isProgramExpression>:
lea    -0x20(%rdi),%eax
cmp    $0x5e,%eax
ja     1124 <isProgramExpression+0x24>
mov    $0x1,%eax
cmp    $0x3b,%edi
ja     1126 <isProgramExpression+0x26>
mov    %edi,%ecx
movabs $0x800038c00000000,%rdx
bt     %rcx,%rdx
jae    1126 <isProgramExpression+0x26>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isProgramExpression(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 32
br i1 %5, label %6, label %29
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 126
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 34
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 35
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 39
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 40
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 41
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp ne i32 %25, 59
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 1, i32* %2
br label %30
28: ; preds = %24, %21, %18, %15, %12, %9
br label %29
29: ; preds = %28, %6, %1
store i32 0, i32* %2
br label %30
30: ; preds = %29, %27
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @isProgramExpression(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
br i1 %3, label %4, label %5
4: ; preds = %1
switch i32 %0, label %6 [
i32 59, label %5
i32 41, label %5
i32 40, label %5
i32 39, label %5
i32 35, label %5
i32 34, label %5
]
5: ; preds = %4, %4, %4, %4, %4, %4, %1
br label %6
6: ; preds = %4, %5
%7 = phi i32 [ 0, %5 ], [ 1, %4 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void empezarConversion(void) { outb(0x04, 0x0260 + 0x01); }


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

x86 assembly (clang, -O2):
<empezarConversion>:
mov    $0x4,%edi
mov    $0x261,%esi
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @empezarConversion() {
%1 = call i32 @outb(i32 4, i32 609)
ret void
}

LLVM IR (-O2):
define void @empezarConversion() {
%1 = tail call i32 @outb(i32 4, i32 609)
ret void
}
void RTMemExecFree(void) {}


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

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

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

LLVM IR (-O2):
define void @RTMemExecFree() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fill(int *, int, int);
char *test_fill() {
  static int array[2];
  fill(array, 2, 1);
  do {
    if (!(*array == 1 && *(array + 1) == 2))
      return "e: test_fill";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2f0d(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fill@plt>
cmpl   $0x1,0x2ef7(%rip)
jne    1148 <test_fill+0x38>
cmpl   $0x2,0x2eee(%rip)
je     1158 <test_fill+0x48>
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1165 <test_fill+0x55>
jmp    115d <test_fill+0x4d>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fill>:
push   %rax
lea    0x2f14(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fill@plt>
mov    0x2eff(%rip),%ecx
xor    $0x1,%ecx
mov    0x2efa(%rip),%edx
xor    $0x2,%edx
lea    0xec0(%rip),%rsi
xor    %eax,%eax
or     %ecx,%edx
cmovne %rsi,%rax
pop    %rcx
ret

LLVM IR (-O0):
@test_fill.array = internal global [2 x i32] zeroinitializer
@.str = [13 x i8] c"e: test_fill\00"
define i8* @test_fill() {
%1 = alloca i8*
%2 = call i32 @fill(i32* getelementptr inbounds ([2 x i32], [2 x i32]* @test_fill.array, i64 0, i64 0), i32 2, i32 1)
br label %3
3: ; preds = %0
%4 = load i32, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @test_fill.array, i64 0, i64 0)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @test_fill.array, i64 0, i64 1)
%8 = icmp eq i32 %7, 2
br i1 %8, label %10, label %9
9: ; preds = %6, %3
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %1
br label %12
10: ; preds = %6
br label %11
11: ; preds = %10
store i8* null, i8** %1
br label %12
12: ; preds = %11, %9
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@test_fill.array = internal global [2 x i32] zeroinitializer
@.str = [13 x i8] c"e: test_fill\00"
define i8* @test_fill() {
%1 = tail call i32 @fill(i32* getelementptr inbounds ([2 x i32], [2 x i32]* @test_fill.array, i64 0, i64 0), i32 2, i32 1)
%2 = load i32, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @test_fill.array, i64 0, i64 0)
%3 = icmp eq i32 %2, 1
%4 = load i32, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @test_fill.array, i64 0, i64 1)
%5 = icmp eq i32 %4, 2
%6 = select i1 %3, i1 %5, i1 false
%7 = select i1 %6, i8* null, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
ret i8* %7
}
void sh_set_lines_and_columns(lines, cols) int lines, cols;
{ char *b; }


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

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

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

LLVM IR (-O2):
define void @sh_set_lines_and_columns(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int ini_getint_default_def(char *, int);
int get_iou_udp_port(int port) {
  return ini_getint_default_def("base_port", 49000) + port;
}


x86 assembly (clang, -O0):
<get_iou_udp_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0xbf68,%esi
call   1030 <ini_getint_default_def@plt>
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_iou_udp_port>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
mov    $0xbf68,%esi
call   1030 <ini_getint_default_def@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"base_port\00"
define i32 @get_iou_udp_port(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @ini_getint_default_def(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 49000)
%4 = load i32, i32* %2
%5 = add nsw i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
@.str = [10 x i8] c"base_port\00"
define i32 @get_iou_udp_port(i32 %0) {
%2 = tail call i32 @ini_getint_default_def(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 49000)
%3 = add nsw i32 %2, %0
ret i32 %3
}
void init_emulator(void) {}


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

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

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

LLVM IR (-O2):
define void @init_emulator() {
ret void
}