xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ ptrdiff_t;

/* Variables and functions */
ptrdiff_t objpc_to_ptrdiff(const void *ptr) {
  ptrdiff_t distance;
  distance =
      (ptrdiff_t)(((const unsigned char *)ptr) - ((const unsigned char *)NULL));
  return ((ptrdiff_t)distance);
}


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

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

LLVM IR (-O0):
define i64 @objpc_to_ptrdiff(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = sub i64 %5, 0
store i64 %6, i64* %3
%7 = load i64, i64* %3
ret i64 %7
}

LLVM IR (-O2):
define i64 @objpc_to_ptrdiff(i8* %0) {
%2 = ptrtoint i8* %0 to i64
ret i64 %2
}
int test_imm_21uint8_reg(unsigned char val) {
  return ((val) & (-0x21 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_21uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffffdf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_21uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -33
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void thd_mutex_unlock(int *p) {}


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

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

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

LLVM IR (-O2):
define void @thd_mutex_unlock(i32* nocapture %0) {
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ spn_die(char *, unsigned long);
void *spn_calloc(size_t nelem, size_t elsize) {
  void *ptr = calloc(nelem, elsize);
  if (ptr == NULL && nelem * elsize > 0) {
    unsigned long uln = nelem * elsize;
    spn_die("allocation of %lu zero-init'ed bytes failed", uln);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<spn_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117c <spn_calloc+0x5c>
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
cmp    $0x0,%rax
jbe    117c <spn_calloc+0x5c>
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1030 <spn_die@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spn_calloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r15
call   1040 <calloc@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1150 <spn_calloc+0x30>
imul   %r15,%rbx
test   %rbx,%rbx
je     1150 <spn_calloc+0x30>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <spn_die@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [44 x i8] c"allocation of %lu zero-init'ed bytes failed\00"
define i8* @spn_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call i8* @calloc(i64 %7, i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %23
12: ; preds = %2
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = mul i64 %13, %14
%16 = icmp ugt i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i64, i64* %3
%19 = load i64, i64* %4
%20 = mul i64 %18, %19
store i64 %20, i64* %6
%21 = load i64, i64* %6
%22 = call i32 @spn_die(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %21)
br label %23
23: ; preds = %17, %12, %2
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
@.str = [44 x i8] c"allocation of %lu zero-init'ed bytes failed\00"
define noalias i8* @spn_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = mul i64 %1, %0
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @spn_die(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %6)
br label %10
10: ; preds = %8, %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void consumer(int n, int *arr) {
  assert(n == 3);
  assert(arr[0] == 0);
  assert(arr[1] == 1);
  assert(arr[2] == 2);
}


x86 assembly (clang, -O0):
<consumer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x1,0x4(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x2,0x8(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consumer>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x3,%edi
sete   %al
mov    %eax,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,(%rbx)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0x4(%rbx)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0x8(%rbx)
sete   %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @consumer(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 = icmp eq i32 %5, 3
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 1
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i64 2
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 2
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
ret void
}

LLVM IR (-O2):
define void @consumer(i32 %0, i32* nocapture %1) {
%3 = icmp eq i32 %0, 3
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = getelementptr inbounds i32, i32* %1, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 1
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = getelementptr inbounds i32, i32* %1, i64 2
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 2
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
ret void
}
void disable_interrupts(void) { asm volatile("cli"); }


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

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

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

LLVM IR (-O2):
define void @disable_interrupts() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
char *strcat(s1, s2)
register char *s1, *s2;
{
  register char *os1;
  os1 = s1;
  while (*s1++)
    ;
  --s1;
  while (*s1++ = *s2++)
    ;
  return (os1);
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1131 <strcat+0x31>
jmp    1114 <strcat+0x14>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     116c <strcat+0x6c>
jmp    113d <strcat+0x3d>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
const char *strlib_version(void) {
  return ("strlib : V1.05 Peter Boesecke 2011-12-12");
}


x86 assembly (clang, -O0):
<strlib_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlib_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [41 x i8] c"strlib : V1.05 Peter Boesecke 2011-12-12\00"
define i8* @strlib_version() {
ret i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [41 x i8] c"strlib : V1.05 Peter Boesecke 2011-12-12\00"
define i8* @strlib_version() {
ret i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0)
}
int numstrchr(char *s, char c) {
  int i;
  for (i = 0; *s != '\0'; s++) {
    if (*s == c)
      i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<numstrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1157 <numstrchr+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1141 <numstrchr+0x41>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <numstrchr+0x46>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1115 <numstrchr+0x15>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @numstrchr(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %0, %2 ]
%9 = icmp eq i8 %6, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %16
}
unsigned swap_pairs(unsigned n) {
  unsigned odd_mask = 0xAAAAAAAA;
  return ((n & odd_mask) >> 1U) | ((n & (odd_mask >> 1U)) << 1U);
}


x86 assembly (clang, -O0):
<swap_pairs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xaaaaaaaa,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%edx
shr    $0x1,%edx
and    %edx,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_pairs>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
and    $0xd5555555,%edi
lea    (%rax,%rdi,2),%eax
ret

LLVM IR (-O0):
define i32 @swap_pairs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1431655766, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = and i32 %4, %5
%7 = lshr i32 %6, 1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = lshr i32 %9, 1
%11 = and i32 %8, %10
%12 = shl i32 %11, 1
%13 = or i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @swap_pairs(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = shl i32 %0, 1
%5 = and i32 %4, -1431655766
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ lsc(char *, char *);
int main(void) {
  char *cad1 = "dcbaabc";
  char *cad2 = "abcdcba";
  lsc(cad1, cad2);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee9(%rip),%rsi
call   1030 <lsc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"dcbaabc\00"
@.str.1 = [8 x i8] c"abcdcba\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %3
%6 = call i32 @lsc(i8* %4, i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"dcbaabc\00"
@.str.1 = [8 x i8] c"abcdcba\00"
define i32 @main() {
%1 = tail call i32 @lsc(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void UnpackRCFPState(int s, int *j, int *nu, int *J) {
  *J = s % 1024;
  *nu = (s = s / 1024) % 1024;
  *j = (s / 1024) % 1024;
}


x86 assembly (clang, -O0):
<UnpackRCFPState>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%rax
mov    %edx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UnpackRCFPState>:
lea    0x3ff(%rdi),%r9d
lea    0xfffff(%rdi),%r8d
test   %edi,%edi
cmovns %edi,%r9d
cmovns %edi,%r8d
mov    %r9d,%eax
and    $0xfffffc00,%eax
sub    %eax,%edi
mov    %edi,(%rcx)
sar    $0xa,%r9d
lea    0x3ff(%r9),%eax
test   %r9d,%r9d
cmovns %r9d,%eax
and    $0xfffffc00,%eax
sub    %eax,%r9d
mov    %r9d,(%rdx)
sar    $0x14,%r8d
lea    0x3ff(%r8),%eax
test   %r8w,%r8w
cmovns %r8d,%eax
and    $0xfffffc00,%eax
sub    %eax,%r8d
movswl %r8w,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @UnpackRCFPState(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = srem i32 %9, 1024
%11 = load i32*, i32** %8
store i32 %10, i32* %11
%12 = load i32, i32* %5
%13 = sdiv i32 %12, 1024
store i32 %13, i32* %5
%14 = srem i32 %13, 1024
%15 = load i32*, i32** %7
store i32 %14, i32* %15
%16 = load i32, i32* %5
%17 = sdiv i32 %16, 1024
%18 = srem i32 %17, 1024
%19 = load i32*, i32** %6
store i32 %18, i32* %19
ret void
}

LLVM IR (-O2):
define void @UnpackRCFPState(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = srem i32 %0, 1024
store i32 %5, i32* %3
%6 = sdiv i32 %0, 1024
%7 = srem i32 %6, 1024
store i32 %7, i32* %2
%8 = sdiv i32 %0, 1048576
%9 = trunc i32 %8 to i16
%10 = srem i16 %9, 1024
%11 = sext i16 %10 to i32
store i32 %11, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ shm_error(char *);
int shm_open(char *, int, int);
int /*<<< orphan*/ trace_flow(char *);
int open_and_confirm(char *name, int o_flags, int flags) {
  if (0) {
    trace_flow("ENTERING: open_and_confirm");
  }
  int fd = shm_open(name, o_flags, flags);
  if (0 && fd == -1) {
    shm_error("fd");
  }
  if (0) {
    trace_flow("LEAVING: open_and_confirm");
  }
  return fd;
}


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

x86 assembly (clang, -O2):
<open_and_confirm>:
jmp    1030 <shm_open@plt>

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

LLVM IR (-O2):
define i32 @open_and_confirm(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @shm_open(i8* %0, i32 %1, i32 %2)
ret i32 %4
}
unsigned find_digits(unsigned num) {
  unsigned count = 0;
  while (num) {
    ++count;
    num /= 10;
  }
  return count;
}


x86 assembly (clang, -O0):
<find_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1135 <find_digits+0x35>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <find_digits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_digits>:
xor    %eax,%eax
test   %edi,%edi
je     1124 <find_digits+0x24>
mov    $0xcccccccd,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <find_digits+0x10>
ret

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

LLVM IR (-O2):
define i32 @find_digits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %4, 1
%7 = udiv i32 %5, 10
%8 = icmp ult i32 %5, 10
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;

/* Variables and functions */
int ENOSYS;
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr,
                                  int *shared) {
  return -ENOSYS;
}


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

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

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @pthread_rwlockattr_getpshared(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOSYS
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @pthread_rwlockattr_getpshared(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = sub nsw i32 0, %3
ret i32 %4
}
void init_openhpsdr(void) {}


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

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

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

LLVM IR (-O2):
define void @init_openhpsdr() {
ret void
}
/* Variables and functions */
long double remquol(long double, long double, int *);
long double wrap_remquol(long double x, long double y) {
  int quo;
  return remquol(x, y, &quo);
}


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

x86 assembly (clang, -O2):
<wrap_remquol>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fldt   0x40(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0x24(%rsp),%rdi
call   1030 <remquol@plt>
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define x86_fp80 @wrap_remquol(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call x86_fp80 @remquol(x86_fp80 %0, x86_fp80 %1, i32* %3)
ret x86_fp80 %5
}
const char *locale_charset(void) { return "utf-8"; }


x86 assembly (clang, -O0):
<locale_charset>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<locale_charset>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"utf-8\00"
define i8* @locale_charset() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"utf-8\00"
define i8* @locale_charset() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
void rule_dgp_act_free(const struct XCSF *xcsf, const struct Cl *c) {
  (void)xcsf;
  (void)c;
}


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

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

LLVM IR (-O0):
%struct.XCSF = type opaque
%struct.Cl = type opaque
define void @rule_dgp_act_free(%struct.XCSF* %0, %struct.Cl* %1) {
%3 = alloca %struct.XCSF*
%4 = alloca %struct.Cl*
store %struct.XCSF* %0, %struct.XCSF** %3
store %struct.Cl* %1, %struct.Cl** %4
%5 = load %struct.XCSF*, %struct.XCSF** %3
%6 = load %struct.Cl*, %struct.Cl** %4
ret void
}

LLVM IR (-O2):
%struct.XCSF = type opaque
%struct.Cl = type opaque
define void @rule_dgp_act_free(%struct.XCSF* nocapture %0, %struct.Cl* nocapture %1) {
ret void
}
/* Variables and functions */
int rand();
float Random() { return (float)(rand() % 200000) / 100000.0f - 1.0f; }


x86 assembly (clang, -O0):
<Random>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x30d40,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movss  0xed5(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xec5(%rip),%xmm1
subss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Random>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2e,%rcx
add    %edx,%ecx
imul   $0x30d40,%ecx,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
divss  0xebe(%rip),%xmm0
addss  0xeba(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Random() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 200000
%3 = sitofp i32 %2 to float
%4 = fdiv float %3, 1.000000e+05
%5 = fsub float %4, 1.000000e+00
ret float %5
}

LLVM IR (-O2):
define float @Random() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 200000
%3 = sitofp i32 %2 to float
%4 = fdiv float %3, 1.000000e+05
%5 = fadd float %4, -1.000000e+00
ret float %5
}
void log_error(const char *type, int code, const char *msg) {
  (void)type;
  (void)code;
  (void)msg;
}


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

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

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

LLVM IR (-O2):
define void @log_error(i8* nocapture %0, i32 %1, i8* nocapture %2) {
ret void
}
int test_main() {
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<test_main>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <test_main+0x9>
jmp    1109 <test_main+0x9>

x86 assembly (clang, -O2):
<test_main>:
jmp    1100 <test_main>

LLVM IR (-O0):
define i32 @test_main() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define i32 @test_main() {
br label %1
1: ; preds = %0, %1
br label %1
}
int dbg_check_cats(struct ubifs_info *c) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.ubifs_info = type opaque
define i32 @dbg_check_cats(%struct.ubifs_info* nocapture readnone %0) {
ret i32 0
}
void foo1(int n) {}


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

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

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

LLVM IR (-O2):
define void @foo1(i32 %0) {
ret void
}
/* Variables and functions */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, char);
int main() {
  char z;
  while ((z = getchar()) != EOF)
    printf("%c", z);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2ea5(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1163 <main+0x43>
lea    0xeab(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%al
je     1157 <main+0x37>
lea    0xec2(%rip),%rbx
xchg   %ax,%ax
movsbl %al,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %9, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = load i8, i8* @EOF
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i8, i8* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %10)
br label %3
12: ; preds = %3
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %5)
%7 = tail call signext i8 (...) @getchar()
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
int withinArray(int *intArray, int size, int *ptr) {
  return ((ptr < (intArray + size)) && (ptr >= intArray));
}


x86 assembly (clang, -O0):
<withinArray>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rdx
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x19(%rbp)
jae    113e <withinArray+0x3e>
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
setae  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<withinArray>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rax
cmp    %rdx,%rax
seta   %al
cmp    %rdi,%rdx
setae  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @withinArray(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = icmp ult i32* %7, %11
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32*, i32** %6
%15 = load i32*, i32** %4
%16 = icmp uge i32* %14, %15
br label %17
17: ; preds = %13, %3
%18 = phi i1 [ false, %3 ], [ %16, %13 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @withinArray(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = icmp ugt i32* %5, %2
%7 = icmp uge i32* %2, %0
%8 = and i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int myFunc();
int main(void) {
  if (myFunc() == 55)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <myFunc@plt>
cmp    $0x37,%eax
jne    113b <main+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1142 <main+0x32>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <myFunc@plt>
xor    %ecx,%ecx
cmp    $0x37,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @myFunc()
%3 = icmp eq i32 %2, 55
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 0, i32* %1
br label %6
5: ; preds = %0
store i32 1, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @myFunc()
%2 = icmp ne i32 %1, 55
%3 = zext i1 %2 to i32
ret i32 %3
}
int child5() {
  int a = 0;
  int ii;
  for (ii = 0; ii < 10; ++ii)
    a += ii;
  return a;
}


x86 assembly (clang, -O0):
<child5>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1133 <child5+0x33>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <child5+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @child5() {
ret i32 45
}
/* Variables and functions */
int sum(int, int);
int div(int a, int b) { return sum(a, b); }


x86 assembly (clang, -O0):
<div>:
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 <sum@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<div>:
jmp    1030 <sum@plt>

LLVM IR (-O0):
define i32 @div(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 @sum(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @div(i32 %0, i32 %1) {
%3 = tail call i32 @sum(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int tofb(int, char **);
int main(int argc, char *argv[]) { return tofb(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <tofb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <tofb@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @tofb(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ exit(int);
int mq_open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int open_mq(char *filename) {
  int mq = mq_open(filename, O_RDWR);
  if (mq == -1) {
    perror("error creating mq");
    exit(1);
  }
  return mq;
}


x86 assembly (clang, -O0):
<open_mq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <mq_open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1171 <open_mq+0x41>
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_mq>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1030 <mq_open@plt>
cmp    $0xffffffff,%eax
je     1146 <open_mq+0x16>
pop    %rcx
ret
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
@.str = [18 x i8] c"error creating mq\00"
define i32 @open_mq(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDWR
%6 = call i32 @mq_open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@.str = [18 x i8] c"error creating mq\00"
define i32 @open_mq(i8* %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @mq_open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i32 %3
}
int test_imm_66uint16_mem(unsigned short *val) {
  return ((*val) & (-0x66 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_66uint16_mem>:
movzwl (%rdi),%eax
test   $0xff9a,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_66uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -102
%7 = icmp ne i32 %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_66uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -102
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *trim(char *s) {
  char *t = s;
  while (*t)
    t++;
  while (t > s && *--t == ' ')
    *t = 0;
  return s;
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <trim+0x2e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <trim+0x10>
jmp    1133 <trim+0x33>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x11(%rbp)
jbe    1162 <trim+0x62>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1172 <trim+0x72>
jmp    117e <trim+0x7e>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    1133 <trim+0x33>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
mov    %rdi,%rax
lea    -0x1(%rdi),%rcx
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <trim+0x10>
jmp    1128 <trim+0x28>
nopl   0x0(%rax)
movb   $0x0,-0x1(%rcx)
add    $0xffffffffffffffff,%rcx
cmp    %rax,%rcx
jbe    1133 <trim+0x33>
cmpb   $0x20,-0x1(%rcx)
je     1120 <trim+0x20>
ret

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

LLVM IR (-O2):
define i8* @trim(i8* returned %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = icmp ugt i8* %3, %0
br i1 %8, label %9, label %16
9: ; preds = %7, %14
%10 = phi i8* [ %11, %14 ], [ %3, %7 ]
%11 = getelementptr inbounds i8, i8* %10, i64 -1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 32
br i1 %13, label %14, label %16
14: ; preds = %9
store i8 0, i8* %11
%15 = icmp ugt i8* %11, %0
br i1 %15, label %9, label %16
16: ; preds = %9, %14, %7
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double a = 1.0;
  printf("%#0000000000000000x", a);
  getchar();
  getchar();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"%x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 1.000000e+00, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %3)
%5 = call i32 (...) @getchar()
%6 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"%x\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%2 = tail call i32 (...) @getchar()
%3 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void a(int a) {
  puts("Flag: HCL8{Maths_are_hard_comput3rs_are_harder}");
  exit(0);
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<a>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Flag: HCL8{Maths_are_hard_comput3rs_are_harder}\00"
define void @a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [48 x i8] c"Flag: HCL8{Maths_are_hard_comput3rs_are_harder}\00"
define void @a(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
void gtk_cell_renderer_get_fixed_size() {}


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

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

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

LLVM IR (-O2):
define void @gtk_cell_renderer_get_fixed_size() {
ret void
}
void foo024() {}


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

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

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

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

/* Variables and functions */
int ubi_leb_read(struct ubi_volume_desc *, int, char *, int, int,
                 int /*<<< orphan*/);
int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
             int len) {
  return ubi_leb_read(desc, lnum, buf, offset, len, 0);
}


x86 assembly (clang, -O0):
<ubi_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <ubi_leb_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ubi_read>:
xor    %r9d,%r9d
jmp    1030 <ubi_leb_read@plt>

LLVM IR (-O0):
%struct.ubi_volume_desc = type { i32 }
define i32 @ubi_read(%struct.ubi_volume_desc* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca %struct.ubi_volume_desc*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store %struct.ubi_volume_desc* %0, %struct.ubi_volume_desc** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.ubi_volume_desc*, %struct.ubi_volume_desc** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @ubi_leb_read(%struct.ubi_volume_desc* %11, i32 %12, i8* %13, i32 %14, i32 %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.ubi_volume_desc = type { i32 }
define i32 @ubi_read(%struct.ubi_volume_desc* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @ubi_leb_read(%struct.ubi_volume_desc* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 0)
ret i32 %6
}
/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getline(char **, size_t *, int /*<<< orphan*/ *);
char *get_line(int line_number, FILE *file) {
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  int i = line_number;
  while ((read = getline(&line, &len, file)) != -1) {
    if (i == line_number) {
      break;
    }
    i++;
  }
  return line;
}


x86 assembly (clang, -O0):
<get_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <getline@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1171 <get_line+0x61>
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1163 <get_line+0x53>
jmp    1171 <get_line+0x61>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1135 <get_line+0x25>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_line>:
sub    $0x18,%rsp
mov    %rsi,%rdx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <getline@plt>
mov    0x8(%rsp),%rax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i8* @get_line(i32 %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%7 = call i32 @getline(i8** %3, i64* %4, i32* %1)
%8 = load i8*, i8** %3
ret i8* %8
}