xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Sio_puts(char *);
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void sigint_handler(int sig) {
  Sio_puts("So you think you can stop the bomb with ctrl-c, do you?\n");
  sleep(2);
  Sio_puts("Well...");
  sleep(1);
  Sio_puts("OK. :-)\n");
  _exit(0);
}


x86 assembly (clang, -O0):
<sigint_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <Sio_puts@plt>
mov    $0x2,%edi
call   1050 <sleep@plt>
lea    0xee1(%rip),%rdi
call   1040 <Sio_puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xed3(%rip),%rdi
call   1040 <Sio_puts@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<sigint_handler>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <Sio_puts@plt>
mov    $0x2,%edi
call   1050 <sleep@plt>
lea    0xeeb(%rip),%rdi
call   1040 <Sio_puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xedd(%rip),%rdi
call   1040 <Sio_puts@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"So you think you can stop the bomb with ctrl-c, do you?\0A\00"
@.str.1 = [8 x i8] c"Well...\00"
@.str.2 = [9 x i8] c"OK. :-)\0A\00"
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @Sio_puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 2)
%5 = call i32 @Sio_puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @sleep(i32 1)
%7 = call i32 @Sio_puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [57 x i8] c"So you think you can stop the bomb with ctrl-c, do you?\0A\00"
@.str.1 = [8 x i8] c"Well...\00"
@.str.2 = [9 x i8] c"OK. :-)\0A\00"
define void @sigint_handler(i32 %0) {
%2 = tail call i32 @Sio_puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 2)
%4 = tail call i32 @Sio_puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @Sio_puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @_exit(i32 0)
unreachable
}
void avio_free_directory_entry() {}


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

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

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

LLVM IR (-O2):
define void @avio_free_directory_entry() {
ret void
}
int main() {
  volatile short a = 0x0123;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movw   $0x123,-0x6(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movw   $0x123,-0x2(%rsp)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
store i32 0, i32* %1
store volatile i16 291, i16* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
store volatile i16 291, i16* %1
ret i32 0
}
/* Variables and functions */
int strcmp(char const, char const);
int compare_string(const char *a, const char *b) { return strcmp(*a, *b); }


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

x86 assembly (clang, -O2):
<compare_string>:
movsbl (%rdi),%edi
movsbl (%rsi),%esi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compare_string(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = tail call i32 @strcmp(i8 signext %3, i8 signext %4)
ret i32 %5
}
int get_rtc_date(void) {
  (*(volatile unsigned int *)(0x7E005040)) |= (1 << 3);
  (*(volatile unsigned int *)(0x7E005040)) = 1;
  char value = (*(volatile unsigned int *)(0x7E00507C));
  int date = ((value >> 4) & 0x3) * 10 + (value & 0xF);
  (*(volatile unsigned int *)(0x7E005040)) = 0;
  return date;
}


x86 assembly (clang, -O0):
<get_rtc_date>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7e005040,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0x7e005040,%eax
mov    %ecx,(%rax)
mov    $0x7e005040,%eax
movl   $0x1,(%rax)
mov    $0x7e00507c,%eax
mov    (%rax),%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0x3,%eax
imul   $0xa,%eax,%eax
movsbl -0x1(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x7e005040,%eax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rtc_date>:
orl    $0x8,0x7e005040
08
movl   $0x1,0x7e005040
mov    0x7e00507c,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
and    $0x3,%ecx
lea    (%rcx,%rcx,4),%ecx
and    $0xf,%eax
lea    (%rax,%rcx,2),%eax
movl   $0x0,0x7e005040
ret

LLVM IR (-O0):
define i32 @get_rtc_date() {
%1 = alloca i8
%2 = alloca i32
%3 = load volatile i32, i32* inttoptr (i64 2113949760 to i32*)
%4 = or i32 %3, 8
store volatile i32 %4, i32* inttoptr (i64 2113949760 to i32*)
store volatile i32 1, i32* inttoptr (i64 2113949760 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 2113949820 to i32*)
%6 = trunc i32 %5 to i8
store i8 %6, i8* %1
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = ashr i32 %8, 4
%10 = and i32 %9, 3
%11 = mul nsw i32 %10, 10
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = and i32 %13, 15
%15 = add nsw i32 %11, %14
store i32 %15, i32* %2
store volatile i32 0, i32* inttoptr (i64 2113949760 to i32*)
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @get_rtc_date() {
%1 = load volatile i32, i32* inttoptr (i64 2113949760 to i32*)
%2 = or i32 %1, 8
store volatile i32 %2, i32* inttoptr (i64 2113949760 to i32*)
store volatile i32 1, i32* inttoptr (i64 2113949760 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 2113949820 to i32*)
%4 = lshr i32 %3, 4
%5 = and i32 %4, 3
%6 = mul nuw nsw i32 %5, 10
%7 = and i32 %3, 15
%8 = add nuw nsw i32 %6, %7
store volatile i32 0, i32* inttoptr (i64 2113949760 to i32*)
ret i32 %8
}
/* Variables and functions */
char *access_stack_mem();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char *p;
  p = access_stack_mem();
  printf("\nmain : %s", p);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <access_stack_mem@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"\0Amain : %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* (...) @access_stack_mem()
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0Amain : %s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @access_stack_mem()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int *, int);
int64_t sign_extend(uint64_t a, int bits) {
  int64_t sret;
  if ((a & (1 << (bits - 1))) != 0) {
    a = ((uint64_t)0xffffffffffffffffLL << bits) | a;
    memcpy(&sret, &a, 8);
    return sret;
  }
  return (int64_t)a;
}


x86 assembly (clang, -O0):
<sign_extend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1168 <sign_extend+0x58>
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <sign_extend+0x5e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_extend>:
mov    %edi,%eax
lea    -0x1(%rsi),%ecx
movzbl %cl,%ecx
bt     %ecx,%edi
jae    1146 <sign_extend+0x36>
push   %rax
mov    $0xffffffff,%edx
mov    %esi,%ecx
shl    %cl,%edx
or     %eax,%edx
mov    %edx,0x4(%rsp)
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = shl i32 1, %9
%11 = and i32 %7, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* %5
%15 = shl i32 -1, %14
%16 = load i32, i32* %4
%17 = or i32 %15, %16
store i32 %17, i32* %4
%18 = call i32 @memcpy(i32* %6, i32* %4, i32 8)
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %22
20: ; preds = %2
%21 = load i32, i32* %4
store i32 %21, i32* %3
br label %22
22: ; preds = %20, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = add nsw i32 %1, -1
%7 = shl nuw i32 1, %6
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = shl nsw i32 -1, %1
%12 = or i32 %11, %0
store i32 %12, i32* %3
%13 = call i32 @memcpy(i32* %4, i32* %3, i32 8)
%14 = load i32, i32* %4
br label %15
15: ; preds = %2, %10
%16 = phi i32 [ %14, %10 ], [ %0, %2 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *malloc(size_t);
void *enca_malloc(size_t size) {
  void *ptr;
  if (size == 0)
    size = 1;
  ptr = malloc(size);
  assert(ptr != NULL);
  return ptr;
}


x86 assembly (clang, -O0):
<enca_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113f <enca_malloc+0x1f>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enca_malloc>:
push   %rbx
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %rax,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @enca_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 1, i64 %0
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp ne i8* %4, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
ret i8* %4
}
int test_imm_6Euint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x6E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Euint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0x6e,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Euint64_highword_mem>:
testb  $0x6e,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_6Euint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 472446402560
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void uDMAChannelAssign(unsigned long ulMapping) {
  unsigned long ulMapReg;
  unsigned long ulMapShift;
  unsigned long ulChannelNum;
  ;
  ulChannelNum = ulMapping & 0x1f;
  ulMapping = ulMapping >> 16;
  ulMapReg = 0x400FF000 + 0x00000510 + ((ulChannelNum / 8) * 4);
  ulMapShift = (ulChannelNum % 8) * 4;
  (*((volatile unsigned long *)(ulMapReg))) =
      ((*((volatile unsigned long *)(ulMapReg))) & ~(0xf << ulMapShift)) |
      ulMapping << ulMapShift;
}


x86 assembly (clang, -O0):
<uDMAChannelAssign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1f,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%rax
shr    $0x3,%rax
shl    $0x2,%rax
add    $0x400ff510,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
and    $0x7,%rax
shl    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
mov    $0xf,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    %cl,%rax
mov    -0x28(%rbp),%rcx
or     %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelAssign>:
mov    %rdi,%rax
lea    0x0(,%rdi,4),%ecx
shr    $0x10,%rdi
mov    $0xf,%edx
shl    %cl,%edx
shr    %rax
and    $0xc,%eax
and    $0x1c,%cl
not    %edx
movslq %edx,%rdx
shl    %cl,%rdi
and    0x400ff510(%rax),%rdx
or     %rdx,%rdi
mov    %rdi,0x400ff510(%rax)
ret

LLVM IR (-O0):
define void @uDMAChannelAssign(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
%6 = load i64, i64* %2
%7 = and i64 %6, 31
store i64 %7, i64* %5
%8 = load i64, i64* %2
%9 = lshr i64 %8, 16
store i64 %9, i64* %2
%10 = load i64, i64* %5
%11 = udiv i64 %10, 8
%12 = mul i64 %11, 4
%13 = add i64 1074787600, %12
store i64 %13, i64* %3
%14 = load i64, i64* %5
%15 = urem i64 %14, 8
%16 = mul i64 %15, 4
store i64 %16, i64* %4
%17 = load i64, i64* %3
%18 = inttoptr i64 %17 to i64*
%19 = load volatile i64, i64* %18
%20 = load i64, i64* %4
%21 = trunc i64 %20 to i32
%22 = shl i32 15, %21
%23 = xor i32 %22, -1
%24 = sext i32 %23 to i64
%25 = and i64 %19, %24
%26 = load i64, i64* %2
%27 = load i64, i64* %4
%28 = shl i64 %26, %27
%29 = or i64 %25, %28
%30 = load i64, i64* %3
%31 = inttoptr i64 %30 to i64*
store volatile i64 %29, i64* %31
ret void
}

LLVM IR (-O2):
define void @uDMAChannelAssign(i64 %0) {
%2 = lshr i64 %0, 16
%3 = lshr i64 %0, 1
%4 = and i64 %3, 12
%5 = or i64 %4, 1074787600
%6 = shl i64 %0, 2
%7 = and i64 %6, 28
%8 = inttoptr i64 %5 to i64*
%9 = load volatile i64, i64* %8
%10 = trunc i64 %7 to i32
%11 = shl nuw i32 15, %10
%12 = xor i32 %11, -1
%13 = sext i32 %12 to i64
%14 = and i64 %9, %13
%15 = shl i64 %2, %7
%16 = or i64 %14, %15
store volatile i64 %16, i64* %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ errn_exit(int, char *);
int pthread_cond_signal(int /*<<< orphan*/ *);
void _condsig(pthread_cond_t *c) {
  int n = pthread_cond_signal(c);
  if (n)
    errn_exit(n, "_condsig");
}


x86 assembly (clang, -O0):
<_condsig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_cond_signal@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1151 <_condsig+0x31>
mov    -0xc(%rbp),%edi
lea    0xeb4(%rip),%rsi
call   1030 <errn_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_condsig>:
push   %rax
call   1040 <pthread_cond_signal@plt>
test   %eax,%eax
je     1139 <_condsig+0x19>
lea    0xecf(%rip),%rsi
mov    %eax,%edi
pop    %rax
jmp    1030 <errn_exit@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"_condsig\00"
define void @_condsig(i32* %0) {
%2 = tail call i32 @pthread_cond_signal(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @errn_exit(i32 %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
void reset_ints(int *arr) {
  int i;
  for (i = 0; i < 1024; i++)
    arr[i] = 0;
}


x86 assembly (clang, -O0):
<reset_ints>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    1139 <reset_ints+0x39>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <reset_ints+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_ints>:
push   %rax
mov    $0x1000,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @reset_ints(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i8*
ret void
}
char *ft_isneg(int isneg, char *str) {
  if (isneg == 1)
    str[0] = '-';
  return (str);
}


x86 assembly (clang, -O0):
<ft_isneg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    111c <ft_isneg+0x1c>
mov    -0x10(%rbp),%rax
movb   $0x2d,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isneg>:
mov    %rsi,%rax
cmp    $0x1,%edi
jne    110b <ft_isneg+0xb>
movb   $0x2d,(%rax)
ret

LLVM IR (-O0):
define i8* @ft_isneg(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 45, i8* %9
br label %10
10: ; preds = %7, %2
%11 = load i8*, i8** %4
ret i8* %11
}

LLVM IR (-O2):
define i8* @ft_isneg(i32 %0, i8* returned writeonly %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %5
4: ; preds = %2
store i8 45, i8* %1
br label %5
5: ; preds = %4, %2
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
long strtol(char const *, char **, int);
long strtol_l(const char *nptr, char **endptr, int base, locale_t loc) {
  return strtol(nptr, endptr, base);
}


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

x86 assembly (clang, -O2):
<strtol_l>:
jmp    1030 <strtol@plt>

LLVM IR (-O0):
define i64 @strtol_l(i8* %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8**, i8*** %6
%11 = load i32, i32* %7
%12 = call i64 @strtol(i8* %9, i8** %10, i32 %11)
ret i64 %12
}

LLVM IR (-O2):
define i64 @strtol_l(i8* %0, i8** nocapture %1, i32 %2, i32 %3) {
%5 = tail call i64 @strtol(i8* %0, i8** %1, i32 %2)
ret i64 %5
}
void simple32_help(void) { printf("%s - TBD\n", __func__); }


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

x86 assembly (clang, -O2):
<simple32_help>:
lea    0xee9(%rip),%rdi
lea    0xeec(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%s - TBD\0A\00"
@__func__.simple32_help = [14 x i8] c"simple32_help\00"
define void @simple32_help() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.simple32_help, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s - TBD\0A\00"
@__func__.simple32_help = [14 x i8] c"simple32_help\00"
define void @simple32_help() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.simple32_help, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ log_fatal(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void lsd_fatal_error(char *file, int line, char *mesg) {
  log_fatal(file, line, mesg, strerror(errno));
}


x86 assembly (clang, -O0):
<lsd_fatal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
call   1030 <log_fatal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsd_fatal_error>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <log_fatal@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @lsd_fatal_error(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @log_fatal(i8* %7, i32 %8, i8* %9, i32 %11)
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @lsd_fatal_error(i8* %0, i32 %1, i8* %2) {
%4 = load i32, i32* @errno
%5 = tail call i32 @strerror(i32 %4)
%6 = tail call i32 @log_fatal(i8* %0, i32 %1, i8* %2, i32 %5)
ret void
}
void on_end_cycle() {}


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

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

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

LLVM IR (-O2):
define void @on_end_cycle() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo() {
  for (int i = 0; i < 5; ++i)
    bar();
  for (int i = 0; i < 11; ++i)
    bar();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    113e <foo+0x2e>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <foo+0xf>
movl   $0x0,-0x8(%rbp)
cmpl   $0xb,-0x8(%rbp)
jge    1164 <foo+0x54>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <foo+0x35>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @bar()
%3 = tail call i32 (...) @bar()
%4 = tail call i32 (...) @bar()
%5 = tail call i32 (...) @bar()
%6 = tail call i32 (...) @bar()
%7 = tail call i32 (...) @bar()
%8 = tail call i32 (...) @bar()
%9 = tail call i32 (...) @bar()
%10 = tail call i32 (...) @bar()
%11 = tail call i32 (...) @bar()
%12 = tail call i32 (...) @bar()
%13 = tail call i32 (...) @bar()
%14 = tail call i32 (...) @bar()
%15 = tail call i32 (...) @bar()
%16 = tail call i32 (...) @bar()
ret void
}
/* Type definitions */
typedef unsigned int uint8_t;

/* Variables and functions */
uint8_t pcg_rotr_8(uint8_t value, unsigned int rot) {
  return (value >> rot) | (value << ((-rot) & 7));
}


x86 assembly (clang, -O0):
<pcg_rotr_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
and    $0x7,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcg_rotr_8>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
neg    %cl
and    $0x7,%cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @pcg_rotr_8(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 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub i32 0, %9
%11 = and i32 %10, 7
%12 = shl i32 %8, %11
%13 = or i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @pcg_rotr_8(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 0, %1
%5 = and i32 %4, 7
%6 = shl i32 %0, %5
%7 = or i32 %6, %3
ret i32 %7
}
/* Variables and functions */
char *getString();
int /*<<< orphan*/ printf(char *, char *);
void test4() { printf("String: %s\n", getString()); }


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getString@plt>
mov    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %rax
xor    %eax,%eax
call   1030 <getString@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"String: %s\0A\00"
define void @test4() {
%1 = call i8* (...) @getString()
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"String: %s\0A\00"
define void @test4() {
%1 = tail call i8* (...) @getString()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int, int);
void fillmem(void *start, int nr) { memset(start, nr, (1460)); }


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

x86 assembly (clang, -O2):
<fillmem>:
mov    $0x5b4,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @fillmem(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @memset(i8* %5, i32 %6, i32 1460)
ret void
}

LLVM IR (-O2):
define void @fillmem(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 %1, i32 1460)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Error(char *, char *, size_t);
void *realloc(void *, size_t);
void *Q_realloc(void *ptr, size_t size) {
  void *r;
  r = realloc(ptr, size);
  if (!r)
    Error("Out of memory! %s failed for %i bytes!", "realloc", size);
  return r;
}


x86 assembly (clang, -O0):
<Q_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1163 <Q_realloc+0x43>
mov    -0x10(%rbp),%rdx
lea    0xea9(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <Error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <Q_realloc+0x2a>
lea    0xec5(%rip),%rdi
lea    0xee5(%rip),%rsi
mov    %r14,%rdx
call   1030 <Error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Out of memory! %s failed for %i bytes!\00"
@.str.1 = [8 x i8] c"realloc\00"
define i8* @Q_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i64, i64* %4
%13 = call i32 @Error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 %12)
br label %14
14: ; preds = %11, %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [39 x i8] c"Out of memory! %s failed for %i bytes!\00"
@.str.1 = [8 x i8] c"realloc\00"
define noalias i8* @Q_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @Error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void gtk_buttons_type_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_buttons_type_get_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, int);
char *foo(char *, int);
int /*<<< orphan*/ free(char *);
int main() {
  char *tmp;
  asprintf(&tmp, "Hello %d\n", 42);
  free(tmp);
  tmp = foo("Hello %d\n", 17);
  free(tmp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x2a,%edx
call   1050 <asprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
lea    0xe9c(%rip),%rdi
mov    $0x11,%esi
call   1040 <foo@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x2a,%edx
call   1050 <asprintf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1040 <foo@plt>
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Hello %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 42)
%4 = load i8*, i8** %2
%5 = call i32 @free(i8* %4)
%6 = call i8* @foo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 17)
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @free(i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Hello %d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = call i32 @asprintf(i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 42)
%4 = load i8*, i8** %1
%5 = call i32 @free(i8* %4)
%6 = call i8* @foo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 17)
store i8* %6, i8** %1
%7 = call i32 @free(i8* %6)
ret i32 0
}
/* Variables and functions */
int fun(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int ret = 0;
  int nr_of_yields = 0;
  long nr_of_reductions;
  ret = fun(1);
  printf("Number of yields %d\n", nr_of_yields);
  printf("RETURNED %d\n", ret);
  if (ret != 5) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x1,%edi
call   1030 <fun@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x5,-0x14(%rbp)
je     1185 <main+0x65>
movl   $0x1,-0x4(%rbp)
jmp    118c <main+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1030 <fun@plt>
mov    %eax,%ebx
lea    0xecc(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
cmp    $0x5,%ebx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Number of yields %d\0A\00"
@.str.1 = [13 x i8] c"RETURNED %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%9 = call i32 @fun(i32 1)
store i32 %9, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 5
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [21 x i8] c"Number of yields %d\0A\00"
@.str.1 = [13 x i8] c"RETURNED %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @fun(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%6 = icmp ne i32 %3, 5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int fc8080_deinit(void *);
int bbm_com_deinit(void *handle) {
  int res;
  res = fc8080_deinit(handle);
  return res;
}


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

x86 assembly (clang, -O2):
<bbm_com_deinit>:
jmp    1030 <fc8080_deinit@plt>

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

LLVM IR (-O2):
define i32 @bbm_com_deinit(i8* %0) {
%2 = tail call i32 @fc8080_deinit(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ f(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ g(char *);
void t(char *s1, char *s2) {
  free(s1);
  f(s1);
  free(s2);
  g(s2);
}


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

x86 assembly (clang, -O2):
<t>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <free@plt>
mov    %rbx,%rdi
call   1040 <f@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <g@plt>

LLVM IR (-O0):
define void @t(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 = call i32 @free(i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @f(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @free(i8* %9)
%11 = load i8*, i8** %4
%12 = call i32 @g(i8* %11)
ret void
}

LLVM IR (-O2):
define void @t(i8* %0, i8* %1) {
%3 = tail call i32 @free(i8* %0)
%4 = tail call i32 @f(i8* %0)
%5 = tail call i32 @free(i8* %1)
%6 = tail call i32 @g(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((visibility("default"))) void slib_func(void) {
  printf("slib_func: hello, world!\n");
}


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

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

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

LLVM IR (-O2):
@str = [25 x i8] c"slib_func: hello, world!\00"
define void @slib_func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0xc8() {
  Assert_real((isascii(200) == 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_isascii.c",
              1005, ("isascii should be 0 for 0xc8"));
}


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

x86 assembly (clang, -O2):
<t_isascii_0xc8>:
push   %rax
mov    $0xc8,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3ed,%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_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xc8\00"
define void @t_isascii_0xc8() {
%1 = call i64 @isascii(i32 200)
%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 1005, 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_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xc8\00"
define void @t_isascii_0xc8() {
%1 = tail call i64 @isascii(i32 200)
%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 1005, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void wl_sj(s) char *s;
{
  wl_s(s);
  wl_j(s);
}


x86 assembly (clang, -O0):
<wl_sj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <wl_s@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <wl_j@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_sj>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <wl_s@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <wl_j@plt>

LLVM IR (-O0):
define void @wl_sj(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @wl_s to i32 (i8*, ...)*)(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @wl_j to i32 (i8*, ...)*)(i8* %5)
ret void
}

LLVM IR (-O2):
define void @wl_sj(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @wl_s to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @wl_j to i32 (i8*, ...)*)(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_puts(char *);
void key_3_handler(void) {
  uart_puts("\nkey_3_handler");
  return;
}


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

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"\0Akey_3_handler\00"
define void @key_3_handler() {
%1 = tail call i32 @uart_puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS7_ENVELOPE;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS7_ENVELOPE_it;
PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, const unsigned char **in,
                                   long len) {
  return (PKCS7_ENVELOPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                         &PKCS7_ENVELOPE_it);
}


x86 assembly (clang, -O0):
<d2i_PKCS7_ENVELOPE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2eb1(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_PKCS7_ENVELOPE>:
mov    0x2ed1(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@PKCS7_ENVELOPE_it = global i32 0
define i32* @d2i_PKCS7_ENVELOPE(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @PKCS7_ENVELOPE_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@PKCS7_ENVELOPE_it = global i32 0
define i32* @d2i_PKCS7_ENVELOPE(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @PKCS7_ENVELOPE_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void fatal(const char *s) {
  perror(s);
  exit(1);
}


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

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

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

LLVM IR (-O2):
define void @fatal(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ dis_fl_pred_PERT1();
int /*<<< orphan*/ dis_print_sched_ffsol(char *);
void dis_print_less_PERT_ffsol(char *fact_file_name) {
  dis_fl_pred_PERT1();
  dis_print_sched_ffsol(fact_file_name);
}


x86 assembly (clang, -O0):
<dis_print_less_PERT_ffsol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <dis_fl_pred_PERT1@plt>
mov    -0x8(%rbp),%rdi
call   1040 <dis_print_sched_ffsol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dis_print_less_PERT_ffsol>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <dis_fl_pred_PERT1@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <dis_print_sched_ffsol@plt>

LLVM IR (-O0):
define void @dis_print_less_PERT_ffsol(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @dis_fl_pred_PERT1()
%4 = load i8*, i8** %2
%5 = call i32 @dis_print_sched_ffsol(i8* %4)
ret void
}

LLVM IR (-O2):
define void @dis_print_less_PERT_ffsol(i8* %0) {
%2 = tail call i32 (...) @dis_fl_pred_PERT1()
%3 = tail call i32 @dis_print_sched_ffsol(i8* %0)
ret void
}