xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
void hdlc_set_uint16_low_first(uint8_t *buf, uint16_t val) {
  buf[0] = (uint8_t)(val & 0x00FFU);
  buf[1U] = (uint8_t)((val >> 8U) & 0x00FFU);
}


x86 assembly (clang, -O0):
<hdlc_set_uint16_low_first>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdlc_set_uint16_low_first>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %rcx,(%rdi)
movzbl %ah,%eax
mov    %rax,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @hdlc_set_uint16_low_first(i64* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
%4 = zext i32 %3 to i64
store i64 %4, i64* %0
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %7, i64* %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef size_t uint32_t;

/* Variables and functions */
int /*<<< orphan*/ uex_iowrite8(int /*<<< orphan*/, void *);
void uex_memcpy_toio(void *d, void *s, uint32_t count) {
  uint32_t i = 0;
  uint8_t *s_p = s;
  while (i < count) {
    uex_iowrite8(s_p[i], d + i);
    i++;
  }
}


x86 assembly (clang, -O0):
<uex_memcpy_toio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    116b <uex_memcpy_toio+0x5b>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x8(%rbp),%rsi
add    -0x20(%rbp),%rsi
call   1030 <uex_iowrite8@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1134 <uex_memcpy_toio+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uex_memcpy_toio>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1146 <uex_memcpy_toio+0x36>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
lea    (%r15,%rbx,1),%rsi
call   1030 <uex_iowrite8@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <uex_memcpy_toio+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @uex_memcpy_toio(i8* %0, i8* nocapture %1, i64 %2) {
%4 = bitcast i8* %1 to i32*
%5 = icmp eq i64 %2, 0
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %12, %6 ], [ 0, %3 ]
%8 = getelementptr inbounds i32, i32* %4, i64 %7
%9 = load i32, i32* %8
%10 = getelementptr i8, i8* %0, i64 %7
%11 = tail call i32 @uex_iowrite8(i32 %9, i8* %10)
%12 = add nuw i64 %7, 1
%13 = icmp eq i64 %12, %2
br i1 %13, label %14, label %6
14: ; preds = %6, %3
ret void
}
void xlBreak(void) {}


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

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

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

LLVM IR (-O2):
define void @xlBreak() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void fatal(char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(EXIT_FAILURE);
}


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

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
int abs(int num) { return num < 0 ? -num : num; }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int mt_rand_double_1();
float rand_float(void) { return (float)(mt_rand_double_1() * 1000); }


x86 assembly (clang, -O0):
<rand_float>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mt_rand_double_1@plt>
imul   $0x3e8,%eax,%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_float>:
push   %rax
xor    %eax,%eax
call   1030 <mt_rand_double_1@plt>
imul   $0x3e8,%eax,%eax
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @rand_float() {
%1 = call i32 (...) @mt_rand_double_1()
%2 = mul nsw i32 %1, 1000
%3 = sitofp i32 %2 to float
ret float %3
}

LLVM IR (-O2):
define float @rand_float() {
%1 = tail call i32 (...) @mt_rand_double_1()
%2 = mul nsw i32 %1, 1000
%3 = sitofp i32 %2 to float
ret float %3
}
int tail(int n, int a) {
  if (n < 0) {
    return 0;
  } else if (n == 0) {
    return 1;
  } else if (n == 1) {
    return a;
  } else {
    return tail(n - 1, n * a);
  }
}


x86 assembly (clang, -O0):
<tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1134 <tail+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1174 <tail+0x64>
cmpl   $0x0,-0x8(%rbp)
jne    114a <tail+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1174 <tail+0x64>
cmpl   $0x1,-0x8(%rbp)
jne    115f <tail+0x4f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <tail+0x64>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
call   1030 <tail@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tail>:
test   %edi,%edi
js     1125 <tail+0x25>
mov    %esi,%eax
test   %edi,%edi
je     111f <tail+0x1f>
nopw   0x0(%rax,%rax,1)
cmp    $0x1,%edi
je     1124 <tail+0x24>
imul   %edi,%eax
add    $0xffffffff,%edi
test   %edi,%edi
jne    1110 <tail+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @tail(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 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %25
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %3
br label %25
13: ; preds = %9
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* %5
store i32 %17, i32* %3
br label %25
18: ; preds = %13
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = mul nsw i32 %21, %22
%24 = call i32 @tail(i32 %20, i32 %23)
store i32 %24, i32* %3
br label %25
25: ; preds = %18, %16, %12, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @tail(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %7
%5 = phi i32 [ %9, %7 ], [ %1, %2 ]
%6 = phi i32 [ %8, %7 ], [ %0, %2 ]
switch i32 %6, label %7 [
i32 0, label %10
i32 1, label %11
]
7: ; preds = %4
%8 = add nsw i32 %6, -1
%9 = mul nsw i32 %5, %6
br label %4
10: ; preds = %4
br label %11
11: ; preds = %4, %10, %2
%12 = phi i32 [ 0, %2 ], [ 1, %10 ], [ %5, %4 ]
ret i32 %12
}
void glStencilMaskSeparate(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glStencilMaskSeparate() {
ret void
}
int splitspec_closestPowerOfTwo(int p) {
  int base = 2;
  while (base < p) {
    base *= 2;
  }
  return base;
}


x86 assembly (clang, -O0):
<splitspec_closestPowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1128 <splitspec_closestPowerOfTwo+0x28>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <splitspec_closestPowerOfTwo+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitspec_closestPowerOfTwo>:
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%eax
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
jl     1110 <splitspec_closestPowerOfTwo+0x10>
ret

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

LLVM IR (-O2):
define i32 @splitspec_closestPowerOfTwo(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 2, %1 ], [ %5, %2 ]
%4 = icmp slt i32 %3, %0
%5 = shl nsw i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ TracebackContextPreemptionGoFunction(int);
void TracebackContextPreemptionCallGo(int i) {
  TracebackContextPreemptionGoFunction(i);
}


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

x86 assembly (clang, -O2):
<TracebackContextPreemptionCallGo>:
jmp    1030 <TracebackContextPreemptionGoFunction@plt>

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

LLVM IR (-O2):
define void @TracebackContextPreemptionCallGo(i32 %0) {
%2 = tail call i32 @TracebackContextPreemptionGoFunction(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void msleep(int x) {
  for (; x > 0; x--) {
    usleep(1000);
  }
}


x86 assembly (clang, -O0):
<msleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    113d <msleep+0x2d>
mov    $0x3e8,%edi
call   1030 <usleep@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <msleep+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msleep>:
push   %rbx
test   %edi,%edi
jle    1132 <msleep+0x22>
mov    %edi,%ebx
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3e8,%edi
call   1030 <usleep@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <msleep+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @msleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %8, %1
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 @usleep(i32 1000)
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @msleep(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @usleep(i32 1000)
%6 = add nsw i32 %4, -1
%7 = icmp ugt i32 %4, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
long long proc_meminfo(char *);
long long meminfo_memavailable(void) {
  long long result;
  result = proc_meminfo("MemAvailable");
  if (result < 0)
    result = proc_meminfo("MemFree");
  return (result);
}


x86 assembly (clang, -O0):
<meminfo_memavailable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <proc_meminfo@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1143 <meminfo_memavailable+0x33>
lea    0xed3(%rip),%rdi
call   1030 <proc_meminfo@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meminfo_memavailable>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <proc_meminfo@plt>
test   %rax,%rax
js     1124 <meminfo_memavailable+0x14>
pop    %rcx
ret
lea    0xee2(%rip),%rdi
pop    %rax
jmp    1030 <proc_meminfo@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"MemAvailable\00"
@.str.1 = [8 x i8] c"MemFree\00"
define i64 @meminfo_memavailable() {
%1 = alloca i64
%2 = call i64 @proc_meminfo(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i64 @proc_meminfo(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i64 %6, i64* %1
br label %7
7: ; preds = %5, %0
%8 = load i64, i64* %1
ret i64 %8
}

LLVM IR (-O2):
@.str = [13 x i8] c"MemAvailable\00"
@.str.1 = [8 x i8] c"MemFree\00"
define i64 @meminfo_memavailable() {
%1 = tail call i64 @proc_meminfo(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i64 @proc_meminfo(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i64 [ %4, %3 ], [ %1, %0 ]
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void write_lines(char *lines[], int line_cnt) {
  int i;
  for (i = 0; i < line_cnt; i++)
    printf("%s\n", lines[i]);
}


x86 assembly (clang, -O0):
<write_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <write_lines+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <write_lines+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_lines>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <write_lines+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <write_lines+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @write_lines(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *thread1() {
  sleep(5);
  printf("This is thread 1 running.\n");
}


x86 assembly (clang, -O0):
<thread1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread1>:
push   %rax
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xece(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"This is thread 1 running.\0A\00"
define i8* @thread1() {
%1 = alloca i8*
%2 = call i32 @sleep(i32 5)
%3 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %1
ret i8* %4
}

LLVM IR (-O2):
@str = [26 x i8] c"This is thread 1 running.\00"
define noalias i8* @thread1() {
%1 = tail call i32 @sleep(i32 5)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ M_DrawCharacter(int, int, char);
void M_Print(int cx, int cy, char *str) {
  while (*str) {
    M_DrawCharacter(cx, cy, (*str) + 128);
    str++;
    cx += 8;
  }
}


x86 assembly (clang, -O0):
<M_Print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <M_Print+0x53>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x80,%eax
movsbl %al,%edx
call   1030 <M_DrawCharacter@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    1122 <M_Print+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_Print>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdx),%al
test   %al,%al
je     114d <M_Print+0x3d>
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xor    $0x80,%al
movsbl %al,%edx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <M_DrawCharacter@plt>
add    $0x8,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <M_Print+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
  return vsnprintf(str, size, format, ap);
}


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

x86 assembly (clang, -O2):
<c99_vsnprintf>:
jmp    1030 <vsnprintf@plt>

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

LLVM IR (-O2):
define i32 @c99_vsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
ret i32 %5
}
void XcmsTekHVCQueryMaxV() {}


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

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

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

LLVM IR (-O2):
define void @XcmsTekHVCQueryMaxV() {
ret void
}
void txt_metaspecial(type, leng, mess) char *mess;
{
  prtime();
  printf("Meta event, sequencer-specific, type=0x%02x leng=%d\n", type, leng);
}


x86 assembly (clang, -O0):
<txt_metaspecial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <prtime@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txt_metaspecial>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <prtime@plt>
lea    0xecb(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Meta event, sequencer-specific, type=0x%02x leng=%d\0A\00"
define void @txt_metaspecial(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = call i32 (...) @prtime()
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"Meta event, sequencer-specific, type=0x%02x leng=%d\0A\00"
define void @txt_metaspecial(i32 %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @prtime()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
void anonymous_struct() {
  struct {
    char *name;
    int age;
  } user;
  user.name = "unknown";
  user.age = 12;
}


x86 assembly (clang, -O0):
<anonymous_struct>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0xc,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i8*, i32 }
@.str = [8 x i8] c"unknown\00"
define void @anonymous_struct() {
%1 = alloca %struct.anon
%2 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 1
store i32 12, i32* %3
ret void
}

LLVM IR (-O2):
define void @anonymous_struct() {
ret void
}
/* Type definitions */
struct ofpbuf {
  int dummy;
};

/* Variables and functions */
scalar_t__ ofpbuf_end(struct ofpbuf const *);
scalar_t__ ofpbuf_tail(struct ofpbuf const *);
size_t ofpbuf_tailroom(const struct ofpbuf *b) {
  return (char *)ofpbuf_end(b) - (char *)ofpbuf_tail(b);
}


x86 assembly (clang, -O0):
<ofpbuf_tailroom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ofpbuf_end@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ofpbuf_tail@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
sub    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ofpbuf_tailroom>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <ofpbuf_end@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <ofpbuf_tail@plt>
sub    %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ofpbuf = type { i32 }
define i64 @ofpbuf_tailroom(%struct.ofpbuf* %0) {
%2 = alloca %struct.ofpbuf*
store %struct.ofpbuf* %0, %struct.ofpbuf** %2
%3 = load %struct.ofpbuf*, %struct.ofpbuf** %2
%4 = call i64 @ofpbuf_end(%struct.ofpbuf* %3)
%5 = inttoptr i64 %4 to i8*
%6 = load %struct.ofpbuf*, %struct.ofpbuf** %2
%7 = call i64 @ofpbuf_tail(%struct.ofpbuf* %6)
%8 = inttoptr i64 %7 to i8*
%9 = ptrtoint i8* %5 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
%struct.ofpbuf = type { i32 }
define i64 @ofpbuf_tailroom(%struct.ofpbuf* %0) {
%2 = tail call i64 @ofpbuf_end(%struct.ofpbuf* %0)
%3 = tail call i64 @ofpbuf_tail(%struct.ofpbuf* %0)
%4 = sub i64 %2, %3
ret i64 %4
}
/* Variables and functions */
scalar_t__ unknown();
int return_statement_expression() {
  if (unknown())
    return ({
      while (0)
        ;
      0;
    });
  else
    return 0;
}


x86 assembly (clang, -O0):
<return_statement_expression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <unknown@plt>
cmp    $0x0,%rax
je     1154 <return_statement_expression+0x44>
jmp    112e <return_statement_expression+0x1e>
xor    %eax,%eax
test   $0x1,%al
jne    113d <return_statement_expression+0x2d>
jmp    1142 <return_statement_expression+0x32>
jmp    112e <return_statement_expression+0x1e>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <return_statement_expression+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_statement_expression>:
push   %rax
xor    %eax,%eax
call   1030 <unknown@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @return_statement_expression() {
%1 = tail call i64 (...) @unknown()
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int_least8_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_EQUALS_int_least8_t(int_least8_t const k1,
                                           int_least8_t const k2) {
  return k1 == k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_MAP_KEY_EQUALS_int_least8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_EQUALS_int_least8_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_EQUALS_int_least8_t(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
char *test2(char *a, char *b) { return __builtin_memcpy(a, b, 4); }


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

x86 assembly (clang, -O2):
<test2>:
mov    %rdi,%rax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define i8* @test2(i8* returned writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %3
store i32 %5, i32* %4
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ test_assert(int);
int main(void) {
  int a = 0, b = 0;
  while (a < 10) {
    a += b;
    b += 1;
  }
  test_assert(a == 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
cmpl   $0xa,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <test_assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo();
void isr(void) { foo(); }


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

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

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

LLVM IR (-O2):
define void @isr() {
%1 = tail call i32 (...) @foo()
ret void
}
unsigned long nptohl(void *p) {
  unsigned char *up;
  unsigned long x;
  up = p;
  x = (up[0] << 24) | (up[1] << 16) | (up[2] << 8) | up[3];
  return x;
}


x86 assembly (clang, -O0):
<nptohl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nptohl>:
movzbl (%rdi),%eax
shl    $0x18,%eax
movzbl 0x1(%rdi),%ecx
shl    $0x10,%rcx
cltq
or     %rcx,%rax
movzbl 0x2(%rdi),%ecx
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0x3(%rdi),%eax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @nptohl(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 24
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = shl i32 %14, 16
%16 = or i32 %10, %15
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = shl i32 %20, 8
%22 = or i32 %16, %21
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 3
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = or i32 %22, %26
%28 = sext i32 %27 to i64
store i64 %28, i64* %4
%29 = load i64, i64* %4
ret i64 %29
}

LLVM IR (-O2):
define i64 @nptohl(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
%19 = sext i32 %18 to i64
ret i64 %19
}
/* Variables and functions */
int adder(int, int);
int calc(int a, int b) { return adder(a, b); }


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

x86 assembly (clang, -O2):
<calc>:
jmp    1030 <adder@plt>

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

LLVM IR (-O2):
define i32 @calc(i32 %0, i32 %1) {
%3 = tail call i32 @adder(i32 %0, i32 %1)
ret i32 %3
}
void inc_syscw(struct task_struct *tsk) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @inc_syscw(%struct.task_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int f291(int *);
int f292(int *p) { return f291(p); }


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

x86 assembly (clang, -O2):
<f292>:
jmp    1030 <f291@plt>

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

LLVM IR (-O2):
define i32 @f292(i32* %0) {
%2 = tail call i32 @f291(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0x30() {
  Assert_real((iscntrl(48) == 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_iscntrl.c",
              245, ("iscntrl should be 0 for 0"));
}


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

x86 assembly (clang, -O2):
<t_iscntrl_0x30>:
push   %rax
mov    $0x30,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xf5,%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_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for 0\00"
define void @t_iscntrl_0x30() {
%1 = call i64 @iscntrl(i32 48)
%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 245, i8* getelementptr inbounds ([26 x i8], [26 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_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for 0\00"
define void @t_iscntrl_0x30() {
%1 = tail call i64 @iscntrl(i32 48)
%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 245, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void loadExtensions() {}


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

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

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

LLVM IR (-O2):
define void @loadExtensions() {
ret void
}
void board_init_irq(const struct ts_platform_data *pdata) {}


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

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

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

LLVM IR (-O2):
%struct.ts_platform_data = type opaque
define void @board_init_irq(%struct.ts_platform_data* nocapture %0) {
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int io_read(int, void *, size_t);
int open(char const *, int /*<<< orphan*/);
ssize_t io_file_read(const char *filename, void *dst, size_t len) {
  int fd;
  ssize_t count;
  fd = open(filename, O_RDONLY);
  if (fd < 0) {
    return -1;
  }
  count = io_read(fd, dst, len);
  close(fd);
  return count;
}


x86 assembly (clang, -O0):
<io_file_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    116f <io_file_read+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1190 <io_file_read+0x60>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <io_read@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <close@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_file_read>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
test   %eax,%eax
js     1168 <io_file_read+0x38>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <io_read@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <close@plt>
mov    %ebx,%eax
jmp    116d <io_file_read+0x3d>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @io_file_read(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%10 = load i8*, i8** %5
%11 = load i32, i32* @O_RDONLY
%12 = call i32 @open(i8* %10, i32 %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 -1, i32* %4
br label %24
16: ; preds = %3
%17 = load i32, i32* %8
%18 = load i8*, i8** %6
%19 = load i64, i64* %7
%20 = call i32 @io_read(i32 %17, i8* %18, i64 %19)
store i32 %20, i32* %9
%21 = load i32, i32* %8
%22 = call i32 @close(i32 %21)
%23 = load i32, i32* %9
store i32 %23, i32* %4
br label %24
24: ; preds = %16, %15
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @io_file_read(i8* nocapture %0, i8* %1, i64 %2) {
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* %0, i32 %4)
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = tail call i32 @io_read(i32 %5, i8* %1, i64 %2)
%9 = tail call i32 @close(i32 %5)
br label %10
10: ; preds = %3, %7
%11 = phi i32 [ %8, %7 ], [ -1, %3 ]
ret i32 %11
}
int main() { int a = 4 % 0; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ TCSAFLUSH;
scalar_t__ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/, struct termios *);
int restaure_term(struct termios *initial_term) {
  if (tcsetattr(STDIN_FILENO, TCSAFLUSH, initial_term) != 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<restaure_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <tcsetattr@plt>
cmp    $0x0,%rax
je     114d <restaure_term+0x3d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <restaure_term+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restaure_term>:
push   %rax
mov    %rdi,%rdx
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
call   1030 <tcsetattr@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@STDIN_FILENO = global i32 0
@TCSAFLUSH = global i32 0
define i32 @restaure_term(%struct.termios* %0) {
%2 = alloca i32
%3 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %3
%4 = load i32, i32* @STDIN_FILENO
%5 = load i32, i32* @TCSAFLUSH
%6 = load %struct.termios*, %struct.termios** %3
%7 = call i64 @tcsetattr(i32 %4, i32 %5, %struct.termios* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@STDIN_FILENO = global i32 0
@TCSAFLUSH = global i32 0
define i32 @restaure_term(%struct.termios* %0) {
%2 = load i32, i32* @STDIN_FILENO
%3 = load i32, i32* @TCSAFLUSH
%4 = tail call i64 @tcsetattr(i32 %2, i32 %3, %struct.termios* %0)
%5 = icmp ne i64 %4, 0
%6 = sext i1 %5 to i32
ret i32 %6
}
int strn_len(const char *s, int count) {
  const char *sc;
  for (sc = s; count-- && *sc != '\0'; ++sc)
    ;
  return sc - s;
}


x86 assembly (clang, -O0):
<strn_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     113c <strn_len+0x3c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    114c <strn_len+0x4c>
jmp    1162 <strn_len+0x62>
jmp    1151 <strn_len+0x51>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1113 <strn_len+0x13>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strn_len>:
mov    %rdi,%rax
test   %esi,%esi
je     1133 <strn_len+0x33>
lea    -0x1(%rsi),%eax
lea    (%rax,%rdi,1),%rcx
add    $0x1,%rcx
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x0,(%rax)
je     1133 <strn_len+0x33>
add    $0xffffffff,%esi
add    $0x1,%rax
test   %esi,%esi
jne    1120 <strn_len+0x20>
mov    %rcx,%rax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @strn_len(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %11, %7
%17 = phi i1 [ false, %7 ], [ %15, %11 ]
br i1 %17, label %18, label %22
18: ; preds = %16
br label %19
19: ; preds = %18
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %5
br label %7
22: ; preds = %16
%23 = load i8*, i8** %5
%24 = load i8*, i8** %3
%25 = ptrtoint i8* %23 to i64
%26 = ptrtoint i8* %24 to i64
%27 = sub i64 %25, %26
%28 = trunc i64 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @strn_len(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = add i32 %1, -1
%6 = zext i32 %5 to i64
%7 = add nuw nsw i64 %6, 1
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %4, %15
%10 = phi i32 [ %12, %15 ], [ %1, %4 ]
%11 = phi i8* [ %16, %15 ], [ %0, %4 ]
%12 = add nsw i32 %10, -1
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %9
%16 = getelementptr inbounds i8, i8* %11, i64 1
%17 = icmp eq i32 %12, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %15, %2
%19 = phi i8* [ %0, %2 ], [ %8, %15 ], [ %11, %9 ]
%20 = ptrtoint i8* %19 to i64
%21 = ptrtoint i8* %0 to i64
%22 = sub i64 %20, %21
%23 = trunc i64 %22 to i32
ret i32 %23
}
void cdrela(icode) int *icode;
{}


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

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

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

LLVM IR (-O2):
define void @cdrela(i32* nocapture %0) {
ret void
}