xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int errno;
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sigchld_handler(int _) {
  int saved_errno = errno;
  while (waitpid(-1, NULL, WNOHANG) > 0)
    ;
  errno = saved_errno;
}


x86 assembly (clang, -O0):
<sigchld_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    114d <sigchld_handler+0x3d>
jmp    1127 <sigchld_handler+0x17>
mov    -0x8(%rbp),%ecx
mov    0x2e81(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchld_handler>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%r14
mov    (%r14),%ebp
mov    0x2ec3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1130 <sigchld_handler+0x20>
mov    %ebp,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
@WNOHANG = global i32 0
define void @sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @errno
store i32 %4, i32* %3
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* @WNOHANG
%7 = call i64 @waitpid(i32 -1, i32* null, i32 %6)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i32, i32* %3
store i32 %11, i32* @errno
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@WNOHANG = global i32 0
define void @sigchld_handler(i32 %0) {
%2 = load i32, i32* @errno
br label %3
3: ; preds = %3, %1
%4 = load i32, i32* @WNOHANG
%5 = tail call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
store i32 %2, i32* @errno
ret void
}
unsigned long insert_tbr(unsigned long insn, long value, const char **errmsg) {
  if (value == 0)
    value = (268);
  return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
}


x86 assembly (clang, -O0):
<insert_tbr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1123 <insert_tbr+0x23>
movq   $0x10c,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0x3e0,%rcx
shl    $0x6,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_tbr>:
test   %rsi,%rsi
mov    $0x10c,%eax
cmovne %esi,%eax
mov    %eax,%ecx
and    $0x1f,%ecx
shl    $0x10,%rcx
or     %rdi,%rcx
shl    $0x6,%eax
and    $0xf800,%eax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @insert_tbr(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %3
store i64 268, i64* %5
br label %10
10: ; preds = %9, %3
%11 = load i64, i64* %4
%12 = load i64, i64* %5
%13 = and i64 %12, 31
%14 = shl i64 %13, 16
%15 = or i64 %11, %14
%16 = load i64, i64* %5
%17 = and i64 %16, 992
%18 = shl i64 %17, 6
%19 = or i64 %15, %18
ret i64 %19
}

LLVM IR (-O2):
define i64 @insert_tbr(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = icmp eq i64 %1, 0
%5 = select i1 %4, i64 268, i64 %1
%6 = shl i64 %5, 16
%7 = and i64 %6, 2031616
%8 = or i64 %7, %0
%9 = shl i64 %5, 6
%10 = and i64 %9, 63488
%11 = or i64 %8, %10
ret i64 %11
}
void av_hwframe_ctx_init() {}


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

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

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

LLVM IR (-O2):
define void @av_hwframe_ctx_init() {
ret void
}
int adis16350_initialize_ring(struct iio_ring_buffer *ring) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.iio_ring_buffer = type opaque
define i32 @adis16350_initialize_ring(%struct.iio_ring_buffer* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ myalloc(short);
short **newmap(short length) {
  return ((short **)myalloc((length + 1) * sizeof(short *)));
}


x86 assembly (clang, -O0):
<newmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
movswl %ax,%edi
call   1030 <myalloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newmap>:
lea    0x8(,%rdi,8),%eax
movswl %ax,%edi
jmp    1030 <myalloc@plt>

LLVM IR (-O0):
define i16** @newmap(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 8
%8 = trunc i64 %7 to i16
%9 = call i64 @myalloc(i16 signext %8)
%10 = inttoptr i64 %9 to i16**
ret i16** %10
}

LLVM IR (-O2):
define i16** @newmap(i16 signext %0) {
%2 = shl i16 %0, 3
%3 = add i16 %2, 8
%4 = tail call i64 @myalloc(i16 signext %3)
%5 = inttoptr i64 %4 to i16**
ret i16** %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isprint(int);
void t_isprint_0xa3() {
  Assert_real((isprint(163) == 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_isprint.c",
              820, ("isprint should be 0 for 0xa3"));
}


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

x86 assembly (clang, -O2):
<t_isprint_0xa3>:
push   %rax
mov    $0xa3,%edi
call   1030 <isprint@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x334,%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_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xa3\00"
define void @t_isprint_0xa3() {
%1 = call i64 @isprint(i32 163)
%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 820, 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_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xa3\00"
define void @t_isprint_0xa3() {
%1 = tail call i64 @isprint(i32 163)
%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 820, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned int invert(unsigned int x, int p, int n) {
  return x ^ ~(~(~0 << n) << (p - n + 1));
}


x86 assembly (clang, -O0):
<invert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert>:
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shl    %cl,%eax
xor    %edi,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @invert(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = shl i32 -1, %8
%10 = xor i32 %9, -1
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = sub nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = shl i32 %10, %14
%16 = xor i32 %15, -1
%17 = xor i32 %7, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @invert(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = add i32 %1, 1
%7 = sub i32 %6, %2
%8 = shl i32 %5, %7
%9 = xor i32 %8, %0
%10 = xor i32 %9, -1
ret i32 %10
}
/* Variables and functions */
int per(int);
int sBoxLookup(int);
int roundfunc(int stateVal, int key_round) {
  stateVal = sBoxLookup(stateVal);
  stateVal = per(stateVal);
  stateVal = stateVal ^ key_round;
  return stateVal;
}


x86 assembly (clang, -O0):
<roundfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sBoxLookup@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <per@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundfunc>:
push   %rbx
mov    %esi,%ebx
call   1040 <sBoxLookup@plt>
mov    %eax,%edi
call   1030 <per@plt>
xor    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roundfunc(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 = call i32 @sBoxLookup(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @per(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = xor i32 %9, %10
store i32 %11, i32* %3
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @roundfunc(i32 %0, i32 %1) {
%3 = tail call i32 @sBoxLookup(i32 %0)
%4 = tail call i32 @per(i32 %3)
%5 = xor i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ machdep_Lock();
void McSrv_Lock(void) { machdep_Lock(); }


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

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

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

LLVM IR (-O2):
define void @McSrv_Lock() {
%1 = tail call i32 (...) @machdep_Lock()
ret void
}
int test_imm_8Fuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x8F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Fuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 143
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void rand_know_about(struct Identity *ID, int closeness) {}


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

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

LLVM IR (-O0):
%struct.Identity = type opaque
define void @rand_know_about(%struct.Identity* %0, i32 %1) {
%3 = alloca %struct.Identity*
%4 = alloca i32
store %struct.Identity* %0, %struct.Identity** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.Identity = type opaque
define void @rand_know_about(%struct.Identity* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
#pragma nanos instrument declare(myEvent, "This is my event")
  sleep(1);
#pragma nanos instrument emit(myEvent, "1")
  sleep(1);
#pragma nanos instrument emit(myEvent, "2")
  sleep(1);
#pragma nanos instrument emit(myEvent, "3")
  sleep(1);
#pragma nanos instrument emit(myEvent, "4")
  sleep(1);
#pragma nanos instrument emit(myEvent, "5")
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <sleep@plt>
mov    $0x1,%edi
call   1030 <sleep@plt>
mov    $0x1,%edi
call   1030 <sleep@plt>
mov    $0x1,%edi
call   1030 <sleep@plt>
mov    $0x1,%edi
call   1030 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @sleep(i32 1)
%7 = call i32 @sleep(i32 1)
%8 = call i32 @sleep(i32 1)
%9 = call i32 @sleep(i32 1)
%10 = call i32 @sleep(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @sleep(i32 1)
%7 = tail call i32 @sleep(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
main(int argc, char *argv[]) {
  struct A {
    int i, j;
  } x = {f(52), 3};
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x34,%edi
call   1030 <f@plt>
mov    %eax,-0x18(%rbp)
movl   $0x3,-0x14(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type { i32, i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.A
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 0
%7 = call i32 @f(i32 52)
store i32 %7, i32* %6
%8 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 1
store i32 3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @f(i32 52)
ret i32 0
}
int foo4() { return 4; }


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

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

LLVM IR (-O0):
define i32 @foo4() {
ret i32 4
}

LLVM IR (-O2):
define i32 @foo4() {
ret i32 4
}
/* Variables and functions */
char *remove_spaces(char *);
int strlen(char *);
int is_char(char *tbd) {
  char *rmvd_tbd = remove_spaces(tbd);
  return (strlen(rmvd_tbd) == 1 | strlen(rmvd_tbd) == 0);
}


x86 assembly (clang, -O0):
<is_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <remove_spaces@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    $0x0,%ecx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_char>:
push   %rbp
push   %rbx
push   %rax
call   1040 <remove_spaces@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
sete   %bpl
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
sete   %al
or     %bpl,%al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_char(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @remove_spaces(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @is_char(i8* %0) {
%2 = tail call i8* @remove_spaces(i8* %0)
%3 = tail call i32 @strlen(i8* %2)
%4 = icmp eq i32 %3, 1
%5 = tail call i32 @strlen(i8* %2)
%6 = icmp eq i32 %5, 0
%7 = or i1 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void taskdebug(char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @taskdebug(i8* nocapture %0, ...) {
ret void
}
int main() {
  int p = 42, *pi = (int *)malloc(10);
  for (int i = 0; 1; ++i) {
    printf("Adresa: 0x%x\t%d\n", pi + i, *(pi + i));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    115a <main+0x3a>
jmp    1190 <main+0x70>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [17 x i8] c"Adresa: 0x%x\09%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
%5 = call i8* @malloc(i64 10)
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
store i32 0, i32* %4
br label %7
7: ; preds = %19, %0
br i1 true, label %8, label %22
8: ; preds = %7
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32*, i32** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32* %12, i32 %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
int ang_sort_comp_hook_longs(const void *u, const void *v, int a, int b) {
  long *x = (long *)(u);
  (void)v;
  return (x[a] <= x[b]);
}


x86 assembly (clang, -O0):
<ang_sort_comp_hook_longs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ang_sort_comp_hook_longs>:
movslq %edx,%rax
mov    (%rdi,%rax,8),%rdx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%rdi,%rcx,8),%rdx
setle  %al
ret

LLVM IR (-O0):
define i32 @ang_sort_comp_hook_longs(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i64*
store i64* %11, i64** %9
%12 = load i8*, i8** %6
%13 = load i64*, i64** %9
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i64, i64* %13, i64 %15
%17 = load i64, i64* %16
%18 = load i64*, i64** %9
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i64, i64* %18, i64 %20
%22 = load i64, i64* %21
%23 = icmp sle i64 %17, %22
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @ang_sort_comp_hook_longs(i8* nocapture %0, i8* nocapture readnone %1, i32 %2, i32 %3) {
%5 = bitcast i8* %0 to i64*
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i64, i64* %5, i64 %6
%8 = load i64, i64* %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i64, i64* %5, i64 %9
%11 = load i64, i64* %10
%12 = icmp sle i64 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int equals(int expected, int actual) {
  if (expected == actual) {
    return 0;
  }
  printf("FAIL: expected %d but was %d\n", expected, actual);
  return 1;
}


x86 assembly (clang, -O0):
<equals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1136 <equals+0x26>
movl   $0x0,-0x4(%rbp)
jmp    114f <equals+0x3f>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equals>:
mov    %esi,%edx
xor    %eax,%eax
cmp    %esi,%edi
je     1130 <equals+0x20>
push   %rax
mov    %edi,%esi
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"FAIL: expected %d but was %d\0A\00"
define i32 @equals(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %14
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
store i32 1, i32* %3
br label %14
14: ; preds = %10, %9
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [30 x i8] c"FAIL: expected %d but was %d\0A\00"
define i32 @equals(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int get_bit(void *_bits, int num) {
  uint32_t *bits = _bits;
  return (bits[num / 32] >> (num % 32)) & 1;
}


x86 assembly (clang, -O0):
<get_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%eax
mov    %edx,%ecx
sar    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit>:
mov    %esi,%ecx
lea    0x1f(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x5,%eax
cltq
mov    (%rdi,%rax,4),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @get_bit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 32
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %8, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %4
%15 = srem i32 %14, 32
%16 = ashr i32 %13, %15
%17 = and i32 %16, 1
ret i32 %17
}

LLVM IR (-O2):
define i32 @get_bit(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = sdiv i32 %1, 32
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %3, i64 %5
%7 = load i32, i32* %6
%8 = and i32 %1, 31
%9 = lshr i32 %7, %8
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int memcmp(void const *, void const *, size_t);
int memcmp_wrapper(void *context, const void *first, const void *second) {
  return memcmp(first, second, *(size_t *)context);
}


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

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

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

LLVM IR (-O2):
define i32 @memcmp_wrapper(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
%4 = bitcast i8* %0 to i64*
%5 = load i64, i64* %4
%6 = tail call i32 @memcmp(i8* %1, i8* %2, i64 %5)
ret i32 %6
}
int smp_stack_elem_apption(void *stk_elem, void *data) {
  *((int *)stk_elem) = *((int *)data);
  return (0);
}


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

x86 assembly (clang, -O2):
<smp_stack_elem_apption>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @smp_stack_elem_apption(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret i32 0
}
unsigned char isNumber(unsigned char *s, unsigned short len) {
  unsigned short i = 0;
  for (i = 0; i < len; s++, i++) {
    if (!((unsigned)((*s) - '0') < 10)) {
      return 0x01;
    }
  }
  return 0x00;
}


x86 assembly (clang, -O0):
<isNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movw   $0x0,-0x14(%rbp)
movzwl -0x14(%rbp),%eax
movzwl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1169 <isNumber+0x69>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
sub    $0x30,%eax
cmp    $0xa,%eax
jb     1147 <isNumber+0x47>
movb   $0x1,-0x1(%rbp)
jmp    116d <isNumber+0x6d>
jmp    114c <isNumber+0x4c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x14(%rbp)
jmp    111b <isNumber+0x1b>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumber>:
test   %esi,%esi
je     1125 <isNumber+0x25>
movzwl %si,%eax
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%edx
add    $0xffffffd0,%edx
cmp    $0x9,%edx
ja     1128 <isNumber+0x28>
add    $0x1,%rcx
cmp    %cx,%ax
jne    1110 <isNumber+0x10>
xor    %eax,%eax
ret
mov    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i8 @isNumber(i8* %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 0, i16* %6
store i16 0, i16* %6
br label %7
7: ; preds = %21, %2
%8 = load i16, i16* %6
%9 = zext i16 %8 to i32
%10 = load i16, i16* %5
%11 = zext i16 %10 to i32
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %26
13: ; preds = %7
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = sub nsw i32 %16, 48
%18 = icmp ult i32 %17, 10
br i1 %18, label %20, label %19
19: ; preds = %13
store i8 1, i8* %3
br label %27
20: ; preds = %13
br label %21
21: ; preds = %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i16, i16* %6
%25 = add i16 %24, 1
store i16 %25, i16* %6
br label %7
26: ; preds = %7
store i8 0, i8* %3
br label %27
27: ; preds = %26, %19
%28 = load i8, i8* %3
ret i8 %28
}

LLVM IR (-O2):
define zeroext i8 @isNumber(i8* nocapture %0, i16 zeroext %1) {
%3 = icmp eq i16 %1, 0
br i1 %3, label %15, label %4
4: ; preds = %2, %11
%5 = phi i16 [ %13, %11 ], [ 0, %2 ]
%6 = phi i8* [ %12, %11 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = add nsw i32 %8, -48
%10 = icmp ult i32 %9, 10
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = add nuw i16 %5, 1
%14 = icmp eq i16 %13, %1
br i1 %14, label %15, label %4
15: ; preds = %4, %11, %2
%16 = phi i8 [ 0, %2 ], [ 0, %11 ], [ 1, %4 ]
ret i8 %16
}
/* Variables and functions */
int /*<<< orphan*/ escape_character(char *, char *, char);
char *escape_dollar_signs(char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
char *escape_single_quotes(char *data) {
  char buffer[131072];
  strcpy(data, escape_character(buffer, data, '\''));
  return escape_dollar_signs(data);
}


x86 assembly (clang, -O0):
<escape_single_quotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20020,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20018(%rbp)
lea    -0x20010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x27,%edx
call   1040 <escape_character@plt>
mov    -0x20018(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
call   1050 <escape_dollar_signs@plt>
add    $0x20020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape_single_quotes>:
push   %rbx
sub    $0x20000,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x27,%edx
call   1040 <escape_character@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <escape_dollar_signs@plt>
add    $0x20000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @escape_single_quotes(i8* %0) {
%2 = alloca i8*
%3 = alloca [131072 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [131072 x i8], [131072 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @escape_character(i8* %5, i8* %6, i8 signext 39)
%8 = call i32 @strcpy(i8* %4, i32 %7)
%9 = load i8*, i8** %2
%10 = call i8* @escape_dollar_signs(i8* %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @escape_single_quotes(i8* %0) {
%2 = alloca [131072 x i8]
%3 = getelementptr inbounds [131072 x i8], [131072 x i8]* %2, i64 0, i64 0
%4 = call i32 @escape_character(i8* %3, i8* %0, i8 signext 39)
%5 = call i32 @strcpy(i8* %0, i32 %4)
%6 = call i8* @escape_dollar_signs(i8* %0)
ret i8* %6
}
/* Type definitions */
typedef int uint16_t;
struct fb_bitfield {
  unsigned int offset;
  int length;
};

/* Variables and functions */
unsigned char get_color(unsigned int pixel, const struct fb_bitfield *bitfield,
                        uint16_t *colormap) {
  return colormap[(pixel >> bitfield->offset) &
                  ((1 << bitfield->length) - 1)] >>
         8;
}


x86 assembly (clang, -O0):
<get_color>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
shr    %cl,%edx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x1c(%rbp),%ecx
sub    $0x1,%edx
and    %edx,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
sar    $0x8,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_color>:
mov    %edi,%edi
mov    (%rsi),%cl
mov    0x4(%rsi),%al
shr    %cl,%rdi
mov    $0xffffffff,%esi
mov    %eax,%ecx
shl    %cl,%esi
not    %esi
and    %esi,%edi
mov    0x1(%rdx,%rdi,4),%al
ret

LLVM IR (-O0):
%struct.fb_bitfield = type { i32, i32 }
define zeroext i8 @get_color(i32 %0, %struct.fb_bitfield* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.fb_bitfield*
%6 = alloca i32*
store i32 %0, i32* %4
store %struct.fb_bitfield* %1, %struct.fb_bitfield** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = load i32, i32* %4
%9 = load %struct.fb_bitfield*, %struct.fb_bitfield** %5
%10 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = lshr i32 %8, %11
%13 = load %struct.fb_bitfield*, %struct.fb_bitfield** %5
%14 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = shl i32 1, %15
%17 = sub nsw i32 %16, 1
%18 = and i32 %12, %17
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %7, i64 %19
%21 = load i32, i32* %20
%22 = ashr i32 %21, 8
%23 = trunc i32 %22 to i8
ret i8 %23
}

LLVM IR (-O2):
%struct.fb_bitfield = type { i32, i32 }
define zeroext i8 @get_color(i32 %0, %struct.fb_bitfield* nocapture %1, i32* nocapture %2) {
%4 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = lshr i32 %0, %5
%7 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = shl nsw i32 -1, %8
%10 = xor i32 %9, -1
%11 = and i32 %6, %10
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %2, i64 %12
%14 = load i32, i32* %13
%15 = lshr i32 %14, 8
%16 = trunc i32 %15 to i8
ret i8 %16
}
/* Variables and functions */
int /*<<< orphan*/ safefree(void *);
void md5_free_context(void *handle) { safefree(handle); }


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

x86 assembly (clang, -O2):
<md5_free_context>:
jmp    1030 <safefree@plt>

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

LLVM IR (-O2):
define void @md5_free_context(i8* %0) {
%2 = tail call i32 @safefree(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(unsigned short, unsigned short);
void serial_configure_baud_rate(unsigned short com, unsigned short divisor) {
  outb((com + 3), 0x80);
  outb((com), (divisor >> 8) & 0x0FF);
  outb((com), divisor & 0x0FF);
}


x86 assembly (clang, -O0):
<serial_configure_baud_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x3,%eax
mov    $0x80,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
mov    -0x2(%rbp),%cx
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl %cx,%edi
movzwl %ax,%esi
call   1030 <outb@plt>
mov    -0x2(%rbp),%cx
movzwl -0x4(%rbp),%eax
and    $0xff,%eax
movzwl %cx,%edi
movzwl %ax,%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_configure_baud_rate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x3(%rbx),%eax
movzwl %ax,%edi
mov    $0x80,%esi
call   1030 <outb@plt>
mov    %ebp,%esi
shr    $0x8,%esi
mov    %ebx,%edi
call   1030 <outb@plt>
movzbl %bpl,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @serial_configure_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = add nsw i32 %6, 3
%8 = trunc i32 %7 to i16
%9 = call i32 @outb(i16 zeroext %8, i16 zeroext 128)
%10 = load i16, i16* %3
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i16
%16 = call i32 @outb(i16 zeroext %10, i16 zeroext %15)
%17 = load i16, i16* %3
%18 = load i16, i16* %4
%19 = zext i16 %18 to i32
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i16
%22 = call i32 @outb(i16 zeroext %17, i16 zeroext %21)
ret void
}

LLVM IR (-O2):
define void @serial_configure_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = add i16 %0, 3
%4 = tail call i32 @outb(i16 zeroext %3, i16 zeroext 128)
%5 = lshr i16 %1, 8
%6 = tail call i32 @outb(i16 zeroext %0, i16 zeroext %5)
%7 = and i16 %1, 255
%8 = tail call i32 @outb(i16 zeroext %0, i16 zeroext %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
scalar_t__ sem_wait(int /*<<< orphan*/ *);
void sem_ewait(sem_t *sem) {
  if (sem_wait(sem))
    do {
      perror("sem_wait failed");
      exit(EXIT_FAILURE);
    } while (0);
}


x86 assembly (clang, -O0):
<sem_ewait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sem_wait@plt>
cmp    $0x0,%rax
je     116e <sem_ewait+0x3e>
jmp    1154 <sem_ewait+0x24>
lea    0xea5(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_ewait>:
push   %rax
call   1030 <sem_wait@plt>
test   %rax,%rax
jne    113d <sem_ewait+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"sem_wait failed\00"
@EXIT_FAILURE = global i32 0
define void @sem_ewait(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @sem_wait(i32* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
br label %7
7: ; preds = %6
%8 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; No predecessors!
br label %12
12: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"sem_wait failed\00"
@EXIT_FAILURE = global i32 0
define void @sem_ewait(i32* %0) {
%2 = tail call i64 @sem_wait(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int latin1_upcase(unsigned int);
unsigned linux_char_to_upper_linux(unsigned c) { return latin1_upcase(c); }


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

x86 assembly (clang, -O2):
<linux_char_to_upper_linux>:
jmp    1030 <latin1_upcase@plt>

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

LLVM IR (-O2):
define i32 @linux_char_to_upper_linux(i32 %0) {
%2 = tail call i32 @latin1_upcase(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *name) {
  printf("Syntax: %s [-p type] file1 file2 [skip1-bytes] [skip2-bytes]\n",
         name);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [62 x i8] c"Syntax: %s [-p type] file1 file2 [skip1-bytes] [skip2-bytes]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [62 x i8] c"Syntax: %s [-p type] file1 file2 [skip1-bytes] [skip2-bytes]\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int operate(int a, int b, char op) {
  switch (op) {
  case '+':
    return a + b;
  case '-':
    return a - b;
  case '*':
    return a * b;
  case '/':
    return a / b;
  }
}


x86 assembly (clang, -O0):
<operate>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     116e <operate+0x6e>
mov    -0x18(%rbp),%rax
lea    0xed0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <operate+0x6e>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <operate+0x6e>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <operate+0x6e>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<operate>:
add    $0xffffffd6,%edx
cmp    $0x5,%edx
ja     112f <operate+0x2f>
lea    0xef1(%rip),%rax
movslq (%rax,%rdx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
imul   %edi,%esi
mov    %esi,%eax
ret
add    %edi,%esi
mov    %esi,%eax
ret
sub    %esi,%edi
mov    %edi,%eax
ret
mov    %edi,%eax
cltd
idiv   %esi
mov    %eax,%esi
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @operate(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %26 [
i32 43, label %10
i32 45, label %14
i32 42, label %18
i32 47, label %22
]
10: ; preds = %3
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
store i32 %13, i32* %4
br label %26
14: ; preds = %3
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = sub nsw i32 %15, %16
store i32 %17, i32* %4
br label %26
18: ; preds = %3
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
store i32 %21, i32* %4
br label %26
22: ; preds = %3
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = sdiv i32 %23, %24
store i32 %25, i32* %4
br label %26
26: ; preds = %10, %14, %18, %22, %3
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @operate(i32 %0, i32 %1, i8 signext %2) {
%4 = sext i8 %2 to i32
switch i32 %4, label %13 [
i32 43, label %5
i32 45, label %7
i32 42, label %9
i32 47, label %11
]
5: ; preds = %3
%6 = add nsw i32 %1, %0
br label %13
7: ; preds = %3
%8 = sub nsw i32 %0, %1
br label %13
9: ; preds = %3
%10 = mul nsw i32 %1, %0
br label %13
11: ; preds = %3
%12 = sdiv i32 %0, %1
br label %13
13: ; preds = %5, %7, %9, %11, %3
%14 = phi i32 [ undef, %3 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ]
ret i32 %14
}
void tegra_sata_aux_put(struct tegra_sata_aux *sata_aux) {}


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

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

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

LLVM IR (-O2):
%struct.tegra_sata_aux = type opaque
define void @tegra_sata_aux_put(%struct.tegra_sata_aux* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_124() {
  Assert_real((isqrt(124) == 11),
              "/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/stdlib/isqrt.c",
              625, ("Integer square root of 124 should be 11"));
}


x86 assembly (clang, -O0):
<t_sqrt_124>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7c,%edi
call   1030 <isqrt@plt>
cmp    $0xb,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x271,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_124>:
push   %rax
mov    $0x7c,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xb,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x271,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 124 should be 11\00"
define void @t_sqrt_124() {
%1 = call i32 @isqrt(i32 124)
%2 = icmp eq i32 %1, 11
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 625, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 124 should be 11\00"
define void @t_sqrt_124() {
%1 = tail call i32 @isqrt(i32 124)
%2 = icmp eq i32 %1, 11
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 625, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void *test_anti_range_68(unsigned long n) {
  extern void *alloc_anti_range_68(unsigned long)
      __attribute__((alloc_size(1)));
  if (0 <= n && n <= 0)
    n = 0 - 1;
  return alloc_anti_range_68(n);
}


x86 assembly (clang, -O0):
<test_anti_range_68>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
ja     113b <test_anti_range_68+0x2b>
cmpq   $0x0,-0x8(%rbp)
ja     113b <test_anti_range_68+0x2b>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rdi
call   1030 <alloc_anti_range_68@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_68>:
cmp    $0x1,%rdi
sbb    %rax,%rax
or     %rax,%rdi
jmp    1030 <alloc_anti_range_68@plt>

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

LLVM IR (-O2):
define i8* @test_anti_range_68(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 -1, i64 %0
%4 = tail call i8* @alloc_anti_range_68(i64 %3)
ret i8* %4
}