xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ reprintLine(char *);
void screenDeleteChar(char *cur) { reprintLine(cur); }


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

x86 assembly (clang, -O2):
<screenDeleteChar>:
jmp    1030 <reprintLine@plt>

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

LLVM IR (-O2):
define void @screenDeleteChar(i8* %0) {
%2 = tail call i32 @reprintLine(i8* %0)
ret void
}
int test_imm_67int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x67 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_67int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 6750208
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int core3_swap(char *, int);
int U_EMRDELETECOLORSPACE_swap(char *record, int torev) {
  return (core3_swap(record, torev));
}


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

x86 assembly (clang, -O2):
<U_EMRDELETECOLORSPACE_swap>:
jmp    1030 <core3_swap@plt>

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

LLVM IR (-O2):
define i32 @U_EMRDELETECOLORSPACE_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core3_swap(i8* %0, i32 %1)
ret i32 %3
}
int compare(const char *s1, const char *s2, int b) {
  int i;
  for (i = 0; i < b; ++i) {
    if (*s1++ != *s2++)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    116d <compare+0x6d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     115a <compare+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1174 <compare+0x74>
jmp    115f <compare+0x5f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <compare+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
test   %edx,%edx
jle    1121 <compare+0x21>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rcx,1),%edx
cmp    (%rsi,%rcx,1),%dl
jne    1124 <compare+0x24>
add    $0x1,%rcx
cmp    %ecx,%eax
jne    1110 <compare+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3, %12
%6 = phi i32 [ %15, %12 ], [ 0, %3 ]
%7 = phi i8* [ %13, %12 ], [ %1, %3 ]
%8 = phi i8* [ %14, %12 ], [ %0, %3 ]
%9 = load i8, i8* %8
%10 = load i8, i8* %7
%11 = icmp eq i8 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = add nuw nsw i32 %6, 1
%16 = icmp eq i32 %15, %2
br i1 %16, label %17, label %5
17: ; preds = %5, %12, %3
%18 = phi i32 [ 0, %3 ], [ 0, %12 ], [ 1, %5 ]
ret i32 %18
}
int par_present() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @par_present() {
ret i32 0
}
/* Variables and functions */
scalar_t__ codingTest();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (codingTest()) {
    printf("All test passed.\n");
    return 0;
  } else {
    printf("Testing failed.\n");
    return -1;
  }
}


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    $0x0,%al
call   1030 <codingTest@plt>
cmp    $0x0,%rax
je     115f <main+0x3f>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1172 <main+0x52>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <codingTest@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
lea    0xec9(%rip),%rax
lea    0xed2(%rip),%rdi
cmove  %rax,%rdi
neg    %ebx
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"All test passed.\0A\00"
@.str.1 = [17 x i8] c"Testing failed.\0A\00"
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 i64 (...) @codingTest()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@str = [16 x i8] c"Testing failed.\00"
@str.2 = [17 x i8] c"All test passed.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @codingTest()
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0)
%6 = sext i1 %4 to i32
%7 = tail call i32 @puts(i8* dereferenceable(1) %5)
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
const uint32_t __generic_swab32(uint32_t x) {
  return ((((uint8_t *)&x)[0] << 24) | (((uint8_t *)&x)[1] << 16) |
          (((uint8_t *)&x)[2] << 8) | (((uint8_t *)&x)[3]));
}


x86 assembly (clang, -O0):
<__generic_swab32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x18,%eax
mov    0x0(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    0x4(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @__generic_swab32(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ __testTermIo();
int main() {
  __testTermIo();
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__testTermIo()
ret i32 1
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
void ts_zero(struct timespec *d) {
  d->tv_sec = 0;
  d->tv_nsec = 0;
}


x86 assembly (clang, -O0):
<ts_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_zero>:
xorps  %xmm0,%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @ts_zero(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = load %struct.timespec*, %struct.timespec** %2
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
store i64 0, i64* %6
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @ts_zero(%struct.timespec* nocapture writeonly %0) {
%2 = bitcast %struct.timespec* %0 to i8*
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cleanup();
int /*<<< orphan*/ dotest();
int /*<<< orphan*/ setup();
int main() {
  setup();
  dotest();
  dotest();
  cleanup();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <setup@plt>
mov    $0x0,%al
call   1030 <dotest@plt>
mov    $0x0,%al
call   1030 <dotest@plt>
mov    $0x0,%al
call   1040 <cleanup@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <setup@plt>
xor    %eax,%eax
call   1030 <dotest@plt>
xor    %eax,%eax
call   1030 <dotest@plt>
xor    %eax,%eax
call   1040 <cleanup@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @setup()
%3 = call i32 (...) @dotest()
%4 = call i32 (...) @dotest()
%5 = call i32 (...) @cleanup()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @setup()
%2 = tail call i32 (...) @dotest()
%3 = tail call i32 (...) @dotest()
%4 = tail call i32 (...) @cleanup()
ret i32 0
}
int(so_delfl)(int fd, int flags, int require) {
  return so_rstfl(fd, &(int){0}, ~flags, flags, require);
}


x86 assembly (clang, -O0):
<so_delfl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <so_rstfl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_delfl>:
push   %rax
mov    %edx,%r8d
mov    %esi,%ecx
movl   $0x0,0x4(%rsp)
mov    %esi,%edx
not    %edx
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <so_rstfl@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @so_delfl(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
store i32 0, i32* %7
%9 = load i32, i32* %5
%10 = xor i32 %9, -1
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 (i32, i32*, i32, i32, i32, ...) bitcast (i32 (...)* @so_rstfl to i32 (i32, i32*, i32, i32, i32, ...)*)(i32 %8, i32* %7, i32 %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @so_delfl(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
store i32 0, i32* %4
%5 = xor i32 %1, -1
%6 = call i32 (i32, i32*, i32, i32, i32, ...) bitcast (i32 (...)* @so_rstfl to i32 (i32, i32*, i32, i32, i32, ...)*)(i32 %0, i32* %4, i32 %5, i32 %1, i32 %2)
ret i32 %6
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t impl2(int64_t n) { return 2 * n * n / 1024; }


x86 assembly (clang, -O0):
<impl2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<impl2>:
imul   %edi,%edi
lea    (%rdi,%rdi,1),%eax
add    $0x3ff,%eax
mov    %edi,%ecx
add    %edi,%ecx
cmovns %ecx,%eax
sar    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @impl2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 2, %3
%5 = load i32, i32* %2
%6 = mul nsw i32 %4, %5
%7 = sdiv i32 %6, 1024
ret i32 %7
}

LLVM IR (-O2):
define i32 @impl2(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = sdiv i32 %3, 1024
ret i32 %4
}
/* Variables and functions */
int write(int, unsigned short const *, int);
int write_uint2_array(int f, const unsigned short *iarray, int n) {
  int nwritten;
  nwritten = write(f, iarray, 2 * n);
  if (nwritten <= 0)
    return 0;
  else
    return nwritten / 2;
}


x86 assembly (clang, -O0):
<write_uint2_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     114d <write_uint2_array+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    115b <write_uint2_array+0x4b>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_uint2_array>:
push   %rax
add    %edx,%edx
call   1030 <write@plt>
test   %eax,%eax
jle    1127 <write_uint2_array+0x17>
mov    %eax,%ecx
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @write_uint2_array(i32 %0, i16* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i16*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i16* %1, i16** %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = load i16*, i16** %6
%11 = load i32, i32* %7
%12 = mul nsw i32 2, %11
%13 = call i32 @write(i32 %9, i16* %10, i32 %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp sle i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %3
store i32 0, i32* %4
br label %20
17: ; preds = %3
%18 = load i32, i32* %8
%19 = sdiv i32 %18, 2
store i32 %19, i32* %4
br label %20
20: ; preds = %17, %16
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
define i32 @write_uint2_array(i32 %0, i16* nocapture %1, i32 %2) {
%4 = shl nsw i32 %2, 1
%5 = tail call i32 @write(i32 %0, i16* %1, i32 %4)
%6 = sdiv i32 %5, 2
%7 = icmp sgt i32 %5, 0
%8 = select i1 %7, i32 %6, i32 0
ret i32 %8
}
/* Variables and functions */
char *mlr_malloc_or_die(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *mlr_paste_2_strings(char *s1, char *s2) {
  int n1 = strlen(s1);
  int n2 = strlen(s2);
  char *s = mlr_malloc_or_die(n1 + n2 + 1);
  strcpy(s, s1);
  strcat(s, s2);
  return s;
}


x86 assembly (clang, -O0):
<mlr_paste_2_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
add    -0x18(%rbp),%edi
add    $0x1,%edi
call   1050 <mlr_malloc_or_die@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlr_paste_2_strings>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%edi
add    $0x1,%edi
call   1050 <mlr_malloc_or_die@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @mlr_paste_2_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = add nsw i32 %12, %13
%15 = add nsw i32 %14, 1
%16 = call i8* @mlr_malloc_or_die(i32 %15)
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = load i8*, i8** %3
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = load i8*, i8** %7
%21 = load i8*, i8** %4
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
define i8* @mlr_paste_2_strings(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 1
%6 = add i32 %5, %4
%7 = tail call i8* @mlr_malloc_or_die(i32 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = tail call i32 @strcat(i8* %7, i8* %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printCombination(int *, int, int);
int main(void) {
  int arr[] = {1, 2, 3, 4, 5, 6};
  printCombination(arr, 6, 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
mov    $0x4,%edx
call   1030 <printCombination@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
mov    $0x4,%edx
call   1030 <printCombination@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
store i32 0, i32* %1
%3 = bitcast [6 x i32]* %2 to i8*
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%5 = call i32 @printCombination(i32* %4, i32 6, i32 4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @printCombination(i32* %3, i32 6, i32 4)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ add_CRC(scalar_t__ *, int, int);
int rt_modbus_read_exception_status(uint8_t *buf, int sz) {
  buf[2] = 0;
  add_CRC(buf, 5, 0xffff);
  return 5;
}


x86 assembly (clang, -O0):
<rt_modbus_read_exception_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
mov    $0xffff,%edx
call   1030 <add_CRC@plt>
mov    $0x5,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_modbus_read_exception_status>:
push   %rax
movq   $0x0,0x10(%rdi)
mov    $0x5,%esi
mov    $0xffff,%edx
call   1030 <add_CRC@plt>
mov    $0x5,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rt_modbus_read_exception_status(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i64*, i64** %3
%6 = getelementptr inbounds i64, i64* %5, i64 2
store i64 0, i64* %6
%7 = load i64*, i64** %3
%8 = call i32 @add_CRC(i64* %7, i32 5, i32 65535)
ret i32 5
}

LLVM IR (-O2):
define i32 @rt_modbus_read_exception_status(i64* %0, i32 %1) {
%3 = getelementptr inbounds i64, i64* %0, i64 2
store i64 0, i64* %3
%4 = tail call i32 @add_CRC(i64* %0, i32 5, i32 65535)
ret i32 5
}
int test_imm_4Cuint32_reg(unsigned int val) {
  return ((val) & (0x4C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_4Cuint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x4c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_4Cuint32_reg>:
test   $0x4c,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_4Cuint32_reg(i32 %0) {
%2 = and i32 %0, 76
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_9497() {
  Assert_real((isqrt(9497) == 97),
              "/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",
              1475, ("Integer square root of 9497 should be 97"));
}


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

x86 assembly (clang, -O2):
<t_sqrt_9497>:
push   %rax
mov    $0x2519,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x61,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x5c3,%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 = [41 x i8] c"Integer square root of 9497 should be 97\00"
define void @t_sqrt_9497() {
%1 = call i32 @isqrt(i32 9497)
%2 = icmp eq i32 %1, 97
%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 1475, i8* getelementptr inbounds ([41 x i8], [41 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 = [41 x i8] c"Integer square root of 9497 should be 97\00"
define void @t_sqrt_9497() {
%1 = tail call i32 @isqrt(i32 9497)
%2 = icmp eq i32 %1, 97
%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 1475, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void _abort() {}


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

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

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

LLVM IR (-O2):
define void @_abort() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xc8() {
  Assert_real((isbdigit(200) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              1005, ("isbdigit should be 0 for 0xc8"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0xc8>:
push   %rax
mov    $0xc8,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x3ed,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xc8\00"
define void @t_isbdigit_0xc8() {
%1 = call i64 @isbdigit(i32 200)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1005, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xc8\00"
define void @t_isbdigit_0xc8() {
%1 = tail call i64 @isbdigit(i32 200)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1005, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void gtp_kernel_stop(void) {}


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

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

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

LLVM IR (-O2):
define void @gtp_kernel_stop() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int testJmpAbsolute();
int testJmpIndirect();
int testJsrAbsolute();
void testJmp() {
  printf("testJmpAbsolute: %d\r\n", testJmpAbsolute());
  printf("testJmpIndirect: %d\r\n", testJmpIndirect());
  printf("testJsrAbsolute: %d\r\n", testJsrAbsolute());
}


x86 assembly (clang, -O0):
<testJmp>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <testJmpAbsolute@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <testJmpIndirect@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <testJsrAbsolute@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1050 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testJmp>:
push   %rax
xor    %eax,%eax
call   1060 <testJmpAbsolute@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <testJmpIndirect@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <testJsrAbsolute@plt>
lea    0xeb3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"testJmpAbsolute: %d\0D\0A\00"
@.str.1 = [22 x i8] c"testJmpIndirect: %d\0D\0A\00"
@.str.2 = [22 x i8] c"testJsrAbsolute: %d\0D\0A\00"
define void @testJmp() {
%1 = call i32 (...) @testJmpAbsolute()
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @testJmpIndirect()
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @testJsrAbsolute()
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"testJmpAbsolute: %d\0D\0A\00"
@.str.1 = [22 x i8] c"testJmpIndirect: %d\0D\0A\00"
@.str.2 = [22 x i8] c"testJsrAbsolute: %d\0D\0A\00"
define void @testJmp() {
%1 = tail call i32 (...) @testJmpAbsolute()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @testJmpIndirect()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @testJsrAbsolute()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void emit_pushimm(int imm) {
  assem_debug("push $%x\n", imm);
  assert(0);
}


x86 assembly (clang, -O0):
<emit_pushimm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <assem_debug@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_pushimm>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <assem_debug@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"push $%x\0A\00"
define void @emit_pushimm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @assert(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"push $%x\0A\00"
define void @emit_pushimm(i32 %0) {
%2 = tail call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @assert(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void my_handler(int signal) { printf("\nRecibida la señal %d\n", signal); }


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

x86 assembly (clang, -O2):
<my_handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0ARecibida la se\C3\B1al %d\0A\00"
define void @my_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0ARecibida la se\C3\B1al %d\0A\00"
define void @my_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
void prefetch(const void *x) { x = NULL; }


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

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

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

LLVM IR (-O2):
define void @prefetch(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(char const *, unsigned int, int, int /*<<< orphan*/ *);
int msgpack_fbuffer_write(void *data, const char *buf, unsigned int len) {
  return (1 == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1;
}


x86 assembly (clang, -O0):
<msgpack_fbuffer_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
mov    %eax,%esi
mov    $0x1,%edx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgpack_fbuffer_write>:
push   %rax
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    %edx,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @msgpack_fbuffer_write(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @fwrite(i8* %1, i32 %2, i32 1, i32* %4)
%6 = icmp ne i32 %5, 1
%7 = sext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ dump_file_content(char *);
char *tracecmd_get_tracing_file(char const *);
int /*<<< orphan*/ tracecmd_put_tracing_file(char *);
void show_file(const char *name) {
  char *path;
  path = tracecmd_get_tracing_file(name);
  dump_file_content(path);
  tracecmd_put_tracing_file(path);
}


x86 assembly (clang, -O0):
<show_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <tracecmd_get_tracing_file@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <dump_file_content@plt>
mov    -0x10(%rbp),%rdi
call   1030 <tracecmd_put_tracing_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_file>:
push   %rbx
call   1040 <tracecmd_get_tracing_file@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <dump_file_content@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <tracecmd_put_tracing_file@plt>

LLVM IR (-O0):
define void @show_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @tracecmd_get_tracing_file(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @dump_file_content(i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @tracecmd_put_tracing_file(i8* %8)
ret void
}

LLVM IR (-O2):
define void @show_file(i8* %0) {
%2 = tail call i8* @tracecmd_get_tracing_file(i8* %0)
%3 = tail call i32 @dump_file_content(i8* %2)
%4 = tail call i32 @tracecmd_put_tracing_file(i8* %2)
ret void
}
/* Variables and functions */
int strlen(const char *str) {
  int length = 0;
  while (str[length] != '\0')
    length++;
  return length;
}


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

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

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

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

/* Variables and functions */
int hdhomerun_device_set_tuner_target_to_local_protocol(
    struct hdhomerun_device_t *, char *);
int hdhomerun_device_set_tuner_target_to_local(struct hdhomerun_device_t *hd) {
  return hdhomerun_device_set_tuner_target_to_local_protocol(hd, "udp");
}


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

x86 assembly (clang, -O2):
<hdhomerun_device_set_tuner_target_to_local>:
lea    0xee9(%rip),%rsi
jmp    1030 <hdhomerun_device_set_tuner_target_to_local_protocol@plt>

LLVM IR (-O0):
%struct.hdhomerun_device_t = type { i32 }
@.str = [4 x i8] c"udp\00"
define i32 @hdhomerun_device_set_tuner_target_to_local(%struct.hdhomerun_device_t* %0) {
%2 = alloca %struct.hdhomerun_device_t*
store %struct.hdhomerun_device_t* %0, %struct.hdhomerun_device_t** %2
%3 = load %struct.hdhomerun_device_t*, %struct.hdhomerun_device_t** %2
%4 = call i32 @hdhomerun_device_set_tuner_target_to_local_protocol(%struct.hdhomerun_device_t* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
%struct.hdhomerun_device_t = type { i32 }
@.str = [4 x i8] c"udp\00"
define i32 @hdhomerun_device_set_tuner_target_to_local(%struct.hdhomerun_device_t* %0) {
%2 = tail call i32 @hdhomerun_device_set_tuner_target_to_local_protocol(%struct.hdhomerun_device_t* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
unsigned long popcntb(unsigned long n) {
  n -= (n >> 1) & 0x55555555;
  n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
  n = (n + (n >> 4)) & 0x0f0f0f0f;
  return n;
}


x86 assembly (clang, -O0):
<popcntb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
and    $0x55555555,%rcx
mov    -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x33333333,%rax
mov    -0x8(%rbp),%rcx
shr    $0x2,%rcx
and    $0x33333333,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x4,%rcx
add    %rcx,%rax
and    $0xf0f0f0f,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcntb>:
mov    %rdi,%rax
shr    %rax
and    $0x55555555,%eax
sub    %rax,%rdi
mov    %edi,%ecx
and    $0x33333333,%ecx
shr    $0x2,%edi
and    $0x33333333,%edi
add    %edi,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
add    %ecx,%eax
and    $0xf0f0f0f,%eax
ret

LLVM IR (-O0):
define i64 @popcntb(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 1
%5 = and i64 %4, 1431655765
%6 = load i64, i64* %2
%7 = sub i64 %6, %5
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = and i64 %8, 858993459
%10 = load i64, i64* %2
%11 = lshr i64 %10, 2
%12 = and i64 %11, 858993459
%13 = add i64 %9, %12
store i64 %13, i64* %2
%14 = load i64, i64* %2
%15 = load i64, i64* %2
%16 = lshr i64 %15, 4
%17 = add i64 %14, %16
%18 = and i64 %17, 252645135
store i64 %18, i64* %2
%19 = load i64, i64* %2
ret i64 %19
}

LLVM IR (-O2):
define i64 @popcntb(i64 %0) {
%2 = lshr i64 %0, 1
%3 = and i64 %2, 1431655765
%4 = sub i64 %0, %3
%5 = and i64 %4, 858993459
%6 = lshr i64 %4, 2
%7 = and i64 %6, 858993459
%8 = add nuw nsw i64 %7, %5
%9 = lshr i64 %8, 4
%10 = add nuw nsw i64 %9, %8
%11 = and i64 %10, 252645135
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xba() {
  Assert_real((iscntrl(186) == 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",
              935, ("iscntrl should be 0 for 0xba"));
}


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

x86 assembly (clang, -O2):
<t_iscntrl_0xba>:
push   %rax
mov    $0xba,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3a7,%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 = [29 x i8] c"iscntrl should be 0 for 0xba\00"
define void @t_iscntrl_0xba() {
%1 = call i64 @iscntrl(i32 186)
%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 935, 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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xba\00"
define void @t_iscntrl_0xba() {
%1 = tail call i64 @iscntrl(i32 186)
%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 935, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clear_screen() {
  for (int i = 0; i < 80; i++) {
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<clear_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x50,-0x4(%rbp)
jge    1143 <clear_screen+0x33>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <clear_screen+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_screen>:
push   %rbx
mov    $0x50,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <clear_screen+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @clear_screen() {
br label %2
1: ; preds = %2
ret void
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @putchar(i32 10)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 80
br i1 %6, label %1, label %2
}
/* Variables and functions */
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ sig_default(int /*<<< orphan*/);
extern void sig_quit_default(void) { sig_default(SIGQUIT); }


x86 assembly (clang, -O0):
<sig_quit_default>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sig_default@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_quit_default>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sig_default@plt>

LLVM IR (-O0):
@SIGQUIT = global i32 0
define void @sig_quit_default() {
%1 = load i32, i32* @SIGQUIT
%2 = call i32 @sig_default(i32 %1)
ret void
}

LLVM IR (-O2):
@SIGQUIT = global i32 0
define void @sig_quit_default() {
%1 = load i32, i32* @SIGQUIT
%2 = tail call i32 @sig_default(i32 %1)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t hex2ascii(uint8_t n) {
  if (n < 10)
    return (0x30 | (n & 0x0f));
  else if (n < 16)
    return (n - 10 + 'a');
  else
    return 'N';
}


x86 assembly (clang, -O0):
<hex2ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1122 <hex2ascii+0x22>
mov    -0x8(%rbp),%eax
and    $0xf,%eax
or     $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <hex2ascii+0x44>
cmpl   $0x10,-0x8(%rbp)
jge    113d <hex2ascii+0x3d>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <hex2ascii+0x44>
movl   $0x4e,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2ascii>:
mov    %edi,%eax
cmp    $0x9,%edi
jg     110e <hex2ascii+0xe>
and    $0xf,%eax
or     $0x30,%eax
ret
lea    0x57(%rax),%ecx
cmp    $0x10,%eax
mov    $0x4e,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hex2ascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = and i32 %7, 15
%9 = or i32 48, %8
store i32 %9, i32* %2
br label %18
10: ; preds = %1
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 16
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 10
%16 = add nsw i32 %15, 97
store i32 %16, i32* %2
br label %18
17: ; preds = %10
store i32 78, i32* %2
br label %18
18: ; preds = %17, %13, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @hex2ascii(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = and i32 %0, 15
%5 = or i32 %4, 48
br label %10
6: ; preds = %1
%7 = icmp ult i32 %0, 16
%8 = add nuw nsw i32 %0, 87
%9 = select i1 %7, i32 %8, i32 78
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ %5, %3 ], [ %9, %6 ]
ret i32 %11
}
unsigned short swab16(unsigned short h) {
  unsigned short r = 0;
  r |= (h & 0x00ffU) << 8;
  r |= (h & 0xff00U) >> 8;
  return r;
}


x86 assembly (clang, -O0):
<swab16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movw   $0x0,-0x4(%rbp)
movzwl -0x2(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
movzwl -0x4(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%ecx
and    $0xff00,%ecx
shr    $0x8,%ecx
movzwl -0x4(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swab16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @swab16(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
store i16 0, i16* %3
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = and i32 %5, 255
%7 = shl i32 %6, 8
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = or i32 %9, %7
%11 = trunc i32 %10 to i16
store i16 %11, i16* %3
%12 = load i16, i16* %2
%13 = zext i16 %12 to i32
%14 = and i32 %13, 65280
%15 = lshr i32 %14, 8
%16 = load i16, i16* %3
%17 = zext i16 %16 to i32
%18 = or i32 %17, %15
%19 = trunc i32 %18 to i16
store i16 %19, i16* %3
%20 = load i16, i16* %3
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @swab16(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}