xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ xip_fpo_less_d(int *, double, double);
int xil_fpo_less_d(double a, double b) {
  int res_int;
  xip_fpo_less_d(&res_int, a, b);
  return res_int;
}


x86 assembly (clang, -O0):
<xil_fpo_less_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x14(%rbp),%rdi
call   1030 <xip_fpo_less_d@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xil_fpo_less_d>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <xip_fpo_less_d@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @xil_fpo_less_d(double %0, double %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @xip_fpo_less_d(i32* %3, double %0, double %1)
%6 = load i32, i32* %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void ReadDma(void) {
  outb(0x0a, 0x06);
  outb(0x0b, 0x56);
  outb(0x0a, 0x02);
}


x86 assembly (clang, -O0):
<ReadDma>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
mov    $0x6,%esi
call   1030 <outb@plt>
mov    $0xb,%edi
mov    $0x56,%esi
call   1030 <outb@plt>
mov    $0xa,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadDma>:
push   %rax
mov    $0xa,%edi
mov    $0x6,%esi
call   1030 <outb@plt>
mov    $0xb,%edi
mov    $0x56,%esi
call   1030 <outb@plt>
mov    $0xa,%edi
mov    $0x2,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @ReadDma() {
%1 = call i32 @outb(i32 10, i32 6)
%2 = call i32 @outb(i32 11, i32 86)
%3 = call i32 @outb(i32 10, i32 2)
ret void
}

LLVM IR (-O2):
define void @ReadDma() {
%1 = tail call i32 @outb(i32 10, i32 6)
%2 = tail call i32 @outb(i32 11, i32 86)
%3 = tail call i32 @outb(i32 10, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  i = 198;
  while (i < 200) {
    i = i + 1;
    assert(i > 0);
  }
  assert(i == 200);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc6,-0x8(%rbp)
cmpl   $0xc8,-0x8(%rbp)
jge    1152 <main+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1126 <main+0x16>
cmpl   $0xc8,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 198, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 200
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
br label %3
13: ; preds = %3
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 200
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ box_char_string(char *);
int /*<<< orphan*/ dpop();
int /*<<< orphan*/ snprintf(char *, int, char *, double);
double untag_float(int /*<<< orphan*/);
void primitive_float_to_str(void) {
  char tmp[33];
  snprintf(tmp, 32, "%.16g", untag_float(dpop()));
  tmp[32] = '\0';
  box_char_string(tmp);
}


x86 assembly (clang, -O0):
<primitive_float_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1030 <dpop@plt>
mov    %eax,%edi
call   1050 <untag_float@plt>
mov    -0x38(%rbp),%rdi
mov    $0x20,%esi
lea    0xe92(%rip),%rdx
call   1040 <snprintf@plt>
movb   $0x0,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
call   1060 <box_char_string@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitive_float_to_str>:
push   %rbx
sub    $0x30,%rsp
xor    %eax,%eax
call   1030 <dpop@plt>
mov    %eax,%edi
call   1050 <untag_float@plt>
lea    0xea6(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <snprintf@plt>
movb   $0x0,0x20(%rsp)
mov    %rbx,%rdi
call   1060 <box_char_string@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.16g\00"
define void @primitive_float_to_str() {
%1 = alloca [33 x i8]
%2 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%3 = call i32 (...) @dpop()
%4 = call double @untag_float(i32 %3)
%5 = call i32 @snprintf(i8* %2, i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %4)
%6 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 32
store i8 0, i8* %6
%7 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%8 = call i32 @box_char_string(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.16g\00"
define void @primitive_float_to_str() {
%1 = alloca [33 x i8]
%2 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @dpop()
%4 = tail call double @untag_float(i32 %3)
%5 = call i32 @snprintf(i8* %2, i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %4)
%6 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 32
store i8 0, i8* %6
%7 = call i32 @box_char_string(i8* %2)
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int read(int, void *, size_t);
ssize_t xread(int fd, void *buf, size_t count) {
  int ret = read(fd, buf, count);
  if (ret < 0) {
    ;
  }
  return ret;
}


x86 assembly (clang, -O0):
<xread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1145 <xread+0x35>
jmp    1145 <xread+0x35>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xread>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @xread(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int strcmp(char const *, char const *);
int rstrcmp(const char *s1, const char *s2) { return (-strcmp(s1, s2)); }


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

x86 assembly (clang, -O2):
<rstrcmp>:
push   %rax
call   1030 <strcmp@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rstrcmp(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 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %5, i8* %6)
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @rstrcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = sub nsw i32 0, %3
ret i32 %4
}
void unlock_memory(void) {}


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

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

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

LLVM IR (-O2):
define void @unlock_memory() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PlayLevelSound(int, int, int);
void ActivateTrap(int x, int y) { PlayLevelSound(x, y, 149); }


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

x86 assembly (clang, -O2):
<ActivateTrap>:
mov    $0x95,%edx
jmp    1030 <PlayLevelSound@plt>

LLVM IR (-O0):
define void @ActivateTrap(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 @PlayLevelSound(i32 %5, i32 %6, i32 149)
ret void
}

LLVM IR (-O2):
define void @ActivateTrap(i32 %0, i32 %1) {
%3 = tail call i32 @PlayLevelSound(i32 %0, i32 %1, i32 149)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ read_interrupt_capture(int /*<<< orphan*/, int);
void reset_interrupts(uint8_t address) {
  read_interrupt_capture(address, 0);
  read_interrupt_capture(address, 1);
}


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

x86 assembly (clang, -O2):
<reset_interrupts>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
call   1030 <read_interrupt_capture@plt>
mov    %ebx,%edi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <read_interrupt_capture@plt>

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

LLVM IR (-O2):
define void @reset_interrupts(i32 %0) {
%2 = tail call i32 @read_interrupt_capture(i32 %0, i32 0)
%3 = tail call i32 @read_interrupt_capture(i32 %0, i32 1)
ret void
}
extern int checkran(rngstate)
long rngstate[2];
{
  if (rngstate[0] <= 0 || rngstate[0] >= 2147483563L || rngstate[1] <= 0 ||
      rngstate[1] >= 2147483399L) {
    return (0);
  } else {
    return (1);
  }
}


x86 assembly (clang, -O0):
<checkran>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jle    1148 <checkran+0x48>
mov    -0x10(%rbp),%rax
cmpq   $0x7fffffab,(%rax)
jge    1148 <checkran+0x48>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jle    1148 <checkran+0x48>
mov    -0x10(%rbp),%rax
cmpq   $0x7fffff07,0x8(%rax)
7f
jl     1154 <checkran+0x54>
movl   $0x0,-0x4(%rbp)
jmp    115b <checkran+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkran>:
mov    $0xffffffff80000055,%rcx
add    (%rdi),%rcx
xor    %eax,%eax
cmp    $0xffffffff80000056,%rcx
jb     1129 <checkran+0x29>
mov    0x8(%rdi),%rcx
add    $0xffffffffffffffff,%rcx
xor    %eax,%eax
cmp    $0x7fffff06,%rcx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @checkran(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = add i64 %2, -2147483563
%4 = icmp ult i64 %3, -2147483562
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = getelementptr inbounds i64, i64* %0, i64 1
%7 = load i64, i64* %6
%8 = add i64 %7, -1
%9 = icmp ult i64 %8, 2147483398
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %5, %1
%12 = phi i32 [ 0, %1 ], [ %10, %5 ]
ret i32 %12
}
void curl_multi_strerror() {}


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

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

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

LLVM IR (-O2):
define void @curl_multi_strerror() {
ret void
}
int f(int i) { return (i - 2) <= i; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
cmp    -0x4(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 2
%5 = load i32, i32* %2
%6 = icmp sle i32 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int);
char *ip2a(uint32_t ip, char *addr) {
  sprintf(addr, "%d.%d.%d.%d", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff,
          (ip >> 24) & 0xff);
  return addr;
}


x86 assembly (clang, -O0):
<ip2a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
and    $0xff,%edx
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x4(%rbp),%r8d
sar    $0x10,%r8d
and    $0xff,%r8d
mov    -0x4(%rbp),%r9d
sar    $0x18,%r9d
and    $0xff,%r9d
lea    0xea3(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip2a>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%eax
movzbl %al,%edx
movzbl %ah,%ecx
mov    %edi,%esi
shr    $0x10,%esi
movzbl %sil,%r8d
shr    $0x18,%eax
lea    0xed1(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%r9d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @ip2a(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = load i32, i32* %3
%9 = ashr i32 %8, 8
%10 = and i32 %9, 255
%11 = load i32, i32* %3
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = load i32, i32* %3
%15 = ashr i32 %14, 24
%16 = and i32 %15, 255
%17 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %13, i32 %16)
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @ip2a(i32 %0, i8* returned writeonly %1) {
%3 = and i32 %0, 255
%4 = lshr i32 %0, 8
%5 = and i32 %4, 255
%6 = lshr i32 %0, 16
%7 = and i32 %6, 255
%8 = lshr i32 %0, 24
%9 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7, i32 %8)
ret i8* %1
}
/* Variables and functions */
int ENXIO;
int pm8921_bms_get_aged_capacity(int *result) { return -ENXIO; }


x86 assembly (clang, -O0):
<pm8921_bms_get_aged_capacity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ecf(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm8921_bms_get_aged_capacity>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENXIO = global i32 0
define i32 @pm8921_bms_get_aged_capacity(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @ENXIO
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@ENXIO = global i32 0
define i32 @pm8921_bms_get_aged_capacity(i32* nocapture readnone %0) {
%2 = load i32, i32* @ENXIO
%3 = sub nsw i32 0, %2
ret i32 %3
}
char capital(char c) { return (char)((int)c - 32); }


x86 assembly (clang, -O0):
<capital>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<capital>:
lea    -0x20(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @capital(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 32
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @capital(i8 signext %0) {
%2 = add i8 %0, -32
ret i8 %2
}
void task_yield() {
  __asm__("mov $0x02, %eax");
  __asm__("int $0x82");
}


x86 assembly (clang, -O0):
<task_yield>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%eax
int    $0x82
pop    %rbp
ret

x86 assembly (clang, -O2):
<task_yield>:
mov    $0x2,%eax
int    $0x82
ret

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

LLVM IR (-O2):
define void @task_yield() {
tail call void asm sideeffect "mov $$0x02, %eax", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "int $$0x82", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ debug_print(char *, void *, char const *, int, size_t);
void *debug_calloc(size_t nmemb, size_t size, const char *filename, int line) {
  void *p = calloc(nmemb, size);
  debug_print("+calloc", p, filename, line, nmemb * size);
  return p;
}


x86 assembly (clang, -O0):
<debug_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%r8
imul   -0x10(%rbp),%r8
lea    0xe9d(%rip),%rdi
call   1040 <debug_print@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_calloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1030 <calloc@plt>
mov    %rax,%r12
imul   %rbx,%rbp
lea    0xeb9(%rip),%rdi
mov    %rax,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %rbp,%r8
call   1040 <debug_print@plt>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"+calloc\00"
define i8* @debug_calloc(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = call i8* @calloc(i64 %10, i64 %11)
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = load i64, i64* %5
%17 = load i64, i64* %6
%18 = mul i64 %16, %17
%19 = call i32 @debug_print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14, i32 %15, i64 %18)
%20 = load i8*, i8** %9
ret i8* %20
}

LLVM IR (-O2):
@.str = [8 x i8] c"+calloc\00"
define i8* @debug_calloc(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i8* @calloc(i64 %0, i64 %1)
%6 = mul i64 %1, %0
%7 = tail call i32 @debug_print(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %2, i32 %3, i64 %6)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void err_quit(char *errmsg) {
  fprintf(stderr, errmsg);
  exit(-1);
}


x86 assembly (clang, -O0):
<err_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err_quit>:
push   %rax
mov    %rdi,%rsi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @err_quit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* %4)
%6 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
define void @err_quit(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* %0)
%4 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
test() {
  char *arr[] = {"abc", "string", "hello"};
  printf("%s\n", arr[0]);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ce1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cde(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cdb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
lea    0xeed(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [7 x i8] c"string\00"
@.str.2 = [6 x i8] c"hello\00"
@__const.test.arr = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @test() {
%1 = alloca i32
%2 = alloca [3 x i8*]
%3 = bitcast [3 x i8*]* %2 to i8*
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void pictcmd(int cmd, int pict) { return; }


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

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

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

LLVM IR (-O2):
define void @pictcmd(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
size_t str_count(const char *s, char c) {
  size_t count = 0;
  char cc;
  while ((cc = *s++) != '\0')
    if (cc == c)
      count += 1;
  return count;
}


x86 assembly (clang, -O0):
<str_count>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1157 <str_count+0x57>
movsbl -0x19(%rbp),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1152 <str_count+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1116 <str_count+0x16>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_count>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <str_count+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str_count+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @str_count(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i64 [ %12, %5 ], [ 0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = icmp eq i8 %6, %1
%11 = zext i1 %10 to i64
%12 = add i64 %8, %11
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i64 [ 0, %2 ], [ %12, %5 ]
ret i64 %16
}
/* Type definitions */
typedef int /*<<< orphan*/ on;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ Setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int const *, int);
int /*<<< orphan*/ TCP_NODELAY;
void Setsockopt_nodelay(int s) {
  const int on = 1;
  Setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
}


x86 assembly (clang, -O0):
<Setsockopt_nodelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <Setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Setsockopt_nodelay>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <Setsockopt@plt>
pop    %rax
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define void @Setsockopt_nodelay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_TCP
%6 = load i32, i32* @TCP_NODELAY
%7 = call i32 @Setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret void
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define void @Setsockopt_nodelay(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_NODELAY
%6 = call i32 @Setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret void
}
double asin(x)
double x;
{ return arcsine(x, 0); }


x86 assembly (clang, -O0):
<asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %edi,%edi
mov    $0x1,%al
call   1030 <arcsine@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asin>:
push   %rax
xor    %edi,%edi
mov    $0x1,%al
call   1030 <arcsine@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @asin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 (double, i32, ...) bitcast (i32 (...)* @arcsine to i32 (double, i32, ...)*)(double %3, i32 0)
%5 = sitofp i32 %4 to double
ret double %5
}

LLVM IR (-O2):
define double @asin(double %0) {
%2 = tail call i32 (double, i32, ...) bitcast (i32 (...)* @arcsine to i32 (double, i32, ...)*)(double %0, i32 0)
%3 = sitofp i32 %2 to double
ret double %3
}
/* Variables and functions */
long double sqrtl(long double);
long double cbuiltin_sqrtl(long double x) { return sqrtl(x); }


x86 assembly (clang, -O0):
<cbuiltin_sqrtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sqrtl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuiltin_sqrtl>:
jmp    1030 <sqrtl@plt>

LLVM IR (-O0):
define x86_fp80 @cbuiltin_sqrtl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @sqrtl(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @cbuiltin_sqrtl(x86_fp80 %0) {
%2 = tail call x86_fp80 @sqrtl(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
int /*<<< orphan*/ sock_sendline(char *, char *);
void ircproto_pong(char *id) { sock_sendline("PONG %s", id); }


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

x86 assembly (clang, -O2):
<ircproto_pong>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <sock_sendline@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"PONG %s\00"
define void @ircproto_pong(i8* %0) {
%2 = tail call i32 @sock_sendline(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
short int host_to_usrp_short(short int x) { return x; }


x86 assembly (clang, -O0):
<host_to_usrp_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @host_to_usrp_short(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define signext i16 @host_to_usrp_short(i16 returned signext %0) {
ret i16 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ *create_win(int, int, int, int);
WINDOW *create_wgeninstr() { return create_win(15, 25 + 5, 3 + 15, 50 + 32); }


x86 assembly (clang, -O0):
<create_wgeninstr>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
mov    $0x1e,%esi
mov    $0x12,%edx
mov    $0x52,%ecx
call   1030 <create_win@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_wgeninstr>:
mov    $0xf,%edi
mov    $0x1e,%esi
mov    $0x12,%edx
mov    $0x52,%ecx
jmp    1030 <create_win@plt>

LLVM IR (-O0):
define i32* @create_wgeninstr() {
%1 = call i32* @create_win(i32 15, i32 30, i32 18, i32 82)
ret i32* %1
}

LLVM IR (-O2):
define i32* @create_wgeninstr() {
%1 = tail call i32* @create_win(i32 15, i32 30, i32 18, i32 82)
ret i32* %1
}
/* Type definitions */
struct item {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(char *);
int item_get_data(struct item *, char **);
int item_get_data_as_int(struct item *item) {
  int result;
  char *data;
  int size = item_get_data(item, &data);
  if (size != (int)sizeof(int))
    abort();
  result = *((int *)((void *)data));
  free(data);
  return result;
}


x86 assembly (clang, -O0):
<item_get_data_as_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <item_get_data@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
je     115d <item_get_data_as_int+0x2d>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<item_get_data_as_int>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rsi
call   1050 <item_get_data@plt>
cmp    $0x4,%eax
jne    1158 <item_get_data_as_int+0x28>
mov    0x8(%rsp),%rdi
mov    (%rdi),%ebx
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
%struct.item = type { i32 }
define i32 @item_get_data_as_int(%struct.item* %0) {
%2 = alloca %struct.item*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store %struct.item* %0, %struct.item** %2
%6 = load %struct.item*, %struct.item** %2
%7 = call i32 @item_get_data(%struct.item* %6, i8** %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 4
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = bitcast i8* %13 to i32*
%15 = load i32, i32* %14
store i32 %15, i32* %3
%16 = load i8*, i8** %4
%17 = call i32 @free(i8* %16)
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
%struct.item = type { i32 }
define i32 @item_get_data_as_int(%struct.item* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @item_get_data(%struct.item* %0, i8** %2)
%5 = icmp eq i32 %4, 4
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = call i32 @free(i8* %9)
ret i32 %11
}
_Bool isHilda(double q, double e, double i) {
  if (i > 18 || e > .4)
    return 0;
  double a = q / (1 - e);
  return a > 3.9 && a < 4.02;
}


x86 assembly (clang, -O0):
<isHilda>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1141 <isHilda+0x41>
movsd  -0x18(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    114a <isHilda+0x4a>
movb   $0x0,-0x1(%rbp)
jmp    119c <isHilda+0x9c>
movsd  -0x10(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x29(%rbp)
jbe    1194 <isHilda+0x94>
movsd  0xe97(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
seta   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isHilda>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm1
ja     1142 <isHilda+0x42>
ucomisd 0xef4(%rip),%xmm2
ja     1142 <isHilda+0x42>
movsd  0xef2(%rip),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
ucomisd 0xeea(%rip),%xmm0
seta   %cl
movsd  0xee7(%rip),%xmm1
ucomisd %xmm0,%xmm1
seta   %al
and    %cl,%al
ret

LLVM IR (-O0):
define zeroext i1 @isHilda(double %0, double %1, double %2) {
%4 = alloca i1
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%9 = load double, double* %7
%10 = fcmp ogt double %9, 1.800000e+01
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = load double, double* %6
%13 = fcmp ogt double %12, 4.000000e-01
br i1 %13, label %14, label %15
14: ; preds = %11, %3
store i1 false, i1* %4
br label %27
15: ; preds = %11
%16 = load double, double* %5
%17 = load double, double* %6
%18 = fsub double 1.000000e+00, %17
%19 = fdiv double %16, %18
store double %19, double* %8
%20 = load double, double* %8
%21 = fcmp ogt double %20, 3.900000e+00
br i1 %21, label %22, label %25
22: ; preds = %15
%23 = load double, double* %8
%24 = fcmp olt double %23, 4.020000e+00
br label %25
25: ; preds = %22, %15
%26 = phi i1 [ false, %15 ], [ %24, %22 ]
store i1 %26, i1* %4
br label %27
27: ; preds = %25, %14
%28 = load i1, i1* %4
ret i1 %28
}

LLVM IR (-O2):
define zeroext i1 @isHilda(double %0, double %1, double %2) {
%4 = fcmp ogt double %2, 1.800000e+01
%5 = fcmp ogt double %1, 4.000000e-01
%6 = or i1 %5, %4
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = fsub double 1.000000e+00, %1
%9 = fdiv double %0, %8
%10 = fcmp ogt double %9, 3.900000e+00
%11 = fcmp olt double %9, 4.020000e+00
%12 = and i1 %10, %11
br label %13
13: ; preds = %3, %7
%14 = phi i1 [ %12, %7 ], [ false, %3 ]
ret i1 %14
}
/* Variables and functions */
int /*<<< orphan*/ f1();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("This is demo file");
  f1();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"This is demo file\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @f1()
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"This is demo file\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @f1()
ret i32 0
}
/* Variables and functions */
int get_line(int, char *);
char **string_split(char *, char);
char **unmarshall_multiple(int handle) {
  char buf[256];
  int ret;
  ret = get_line(handle, buf);
  if (ret == 0)
    return NULL;
  return string_split(buf, ',');
}


x86 assembly (clang, -O0):
<unmarshall_multiple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x110(%rbp),%rsi
call   1030 <get_line@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
jne    115d <unmarshall_multiple+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1172 <unmarshall_multiple+0x52>
lea    -0x110(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <string_split@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unmarshall_multiple>:
sub    $0x108,%rsp
mov    %rsp,%rsi
call   1030 <get_line@plt>
test   %eax,%eax
je     1148 <unmarshall_multiple+0x28>
mov    %rsp,%rdi
mov    $0x2c,%esi
call   1040 <string_split@plt>
add    $0x108,%rsp
ret
xor    %eax,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
define i8** @unmarshall_multiple(i32 %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = call i32 @get_line(i32 %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i8** null, i8*** %2
br label %15
12: ; preds = %1
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%14 = call i8** @string_split(i8* %13, i8 signext 44)
store i8** %14, i8*** %2
br label %15
15: ; preds = %12, %11
%16 = load i8**, i8*** %2
ret i8** %16
}

LLVM IR (-O2):
define i8** @unmarshall_multiple(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @get_line(i32 %0, i8* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i8** @string_split(i8* %3, i8 signext 44)
br label %8
8: ; preds = %1, %6
%9 = phi i8** [ %7, %6 ], [ null, %1 ]
ret i8** %9
}
/* Type definitions */
typedef int __u8;
typedef scalar_t__ __s32;

/* Variables and functions */
scalar_t__ i2c_smbus_read_byte_data(int, int);
int /*<<< orphan*/ printf(char *);
int ReadRegister(int _handle, int _reg) {
  __u8 reg = _reg;
  __s32 res;
  char buf[10];
  res = i2c_smbus_read_byte_data(_handle, reg);
  if (res < 0) {
    printf("unable to read register");
  } else {
  }
  return res;
}


x86 assembly (clang, -O0):
<ReadRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <i2c_smbus_read_byte_data@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    115f <ReadRegister+0x3f>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    1164 <ReadRegister+0x44>
jmp    1164 <ReadRegister+0x44>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadRegister>:
push   %rbx
call   1040 <i2c_smbus_read_byte_data@plt>
mov    %rax,%rbx
test   %rax,%rax
jns    113a <ReadRegister+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"unable to read register\00"
define i32 @ReadRegister(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca [10 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = call i64 @i2c_smbus_read_byte_data(i32 %9, i32 %10)
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %14
%18 = load i64, i64* %6
%19 = trunc i64 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
@.str = [24 x i8] c"unable to read register\00"
define i32 @ReadRegister(i32 %0, i32 %1) {
%3 = tail call i64 @i2c_smbus_read_byte_data(i32 %0, i32 %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = trunc i64 %3 to i32
ret i32 %8
}
/* Type definitions */
struct confctl_var {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ confctl_var_set_uptr(struct confctl_var *, void *);
void cv_mark(struct confctl_var *cv, bool v) {
  if (v)
    confctl_var_set_uptr(cv, (void *)1);
  else
    confctl_var_set_uptr(cv, NULL);
}


x86 assembly (clang, -O0):
<cv_mark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113c <cv_mark+0x2c>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <confctl_var_set_uptr@plt>
jmp    1149 <cv_mark+0x39>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <confctl_var_set_uptr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cv_mark>:
test   %esi,%esi
je     111e <cv_mark+0xe>
mov    $0x1,%esi
jmp    1030 <confctl_var_set_uptr@plt>
xor    %esi,%esi
jmp    1030 <confctl_var_set_uptr@plt>

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

LLVM IR (-O2):
%struct.confctl_var = type { i32 }
define void @cv_mark(%struct.confctl_var* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @confctl_var_set_uptr(%struct.confctl_var* %0, i8* inttoptr (i64 1 to i8*))
br label %8
6: ; preds = %2
%7 = tail call i32 @confctl_var_set_uptr(%struct.confctl_var* %0, i8* null)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
void *memcpy(void *, void *, int);
void *os_memcpy(void *src, void *dst, int len) { return memcpy(dst, src, len); }


x86 assembly (clang, -O0):
<os_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_memcpy>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define i8* @os_memcpy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @memcpy(i8* %1, i8* %0, i32 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("Testing shared library ...");
  foo();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"Testing shared library ...\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @foo()
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Testing shared library ...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @foo()
ret i32 0
}
long long bit12() { return 0x0000000000001000LL; }


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

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

LLVM IR (-O0):
define i64 @bit12() {
ret i64 4096
}

LLVM IR (-O2):
define i64 @bit12() {
ret i64 4096
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0xc6() {
  Assert_real((isgraph(198) == 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_isgraph.c",
              995, ("isgraph should be 0 for 0xc6"));
}


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

x86 assembly (clang, -O2):
<t_isgraph_0xc6>:
push   %rax
mov    $0xc6,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3e3,%edx
pop    %rax
jmp    1030 <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_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xc6\00"
define void @t_isgraph_0xc6() {
%1 = call i64 @isgraph(i32 198)
%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 995, 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_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xc6\00"
define void @t_isgraph_0xc6() {
%1 = tail call i64 @isgraph(i32 198)
%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 995, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}