xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void erase(void) {
  int i;
  fputc('\r', stdout);
  for (i = 0; i < 79; i++)
    fputc(' ', stdout);
  fputc('\r', stdout);
}


x86 assembly (clang, -O0):
<erase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4f,-0x4(%rbp)
jge    115d <erase+0x4d>
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1030 <fputc@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <erase+0x22>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erase>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
mov    $0x4f,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    $0x20,%edi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jne    1130 <erase+0x20>
mov    (%rbx),%esi
mov    $0xd,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @erase() {
%1 = alloca i32
%2 = load i32, i32* @stdout
%3 = call i32 @fputc(i8 signext 13, i32 %2)
store i32 0, i32* %1
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 79
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* @stdout
%9 = call i32 @fputc(i8 signext 32, i32 %8)
br label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %4
13: ; preds = %4
%14 = load i32, i32* @stdout
%15 = call i32 @fputc(i8 signext 13, i32 %14)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @erase() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputc(i8 signext 13, i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %7, %3 ]
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputc(i8 signext 32, i32 %5)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 79
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = load i32, i32* @stdout
%11 = tail call i32 @fputc(i8 signext 13, i32 %10)
ret void
}
char cmplt32(float x, float y) { return x < y; }


x86 assembly (clang, -O0):
<cmplt32>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmplt32>:
ucomiss %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define signext i8 @cmplt32(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
%8 = zext i1 %7 to i32
%9 = trunc i32 %8 to i8
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @cmplt32(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = zext i1 %3 to i8
ret i8 %4
}
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  int i;
  i = 0;
  if (s && f) {
    while (s[i] != 0) {
      f((unsigned int)i, &s[i]);
      i++;
    }
  }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116e <ft_striteri+0x6e>
cmpq   $0x0,-0x10(%rbp)
je     116e <ft_striteri+0x6e>
jmp    1132 <ft_striteri+0x32>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1169 <ft_striteri+0x69>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rcx
add    %rcx,%rsi
call   *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <ft_striteri+0x32>
jmp    116e <ft_striteri+0x6e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1135 <ft_striteri+0x35>
mov    %rsi,%r14
test   %rsi,%rsi
je     1135 <ft_striteri+0x35>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     1135 <ft_striteri+0x35>
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
mov    %ebx,%edi
call   *%r14
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <ft_striteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne void (i32, i8*)* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6, %9
%10 = phi i64 [ %13, %9 ], [ 0, %6 ]
%11 = phi i8* [ %14, %9 ], [ %0, %6 ]
%12 = trunc i64 %10 to i32
tail call void %1(i32 %12, i8* %11)
%13 = add nuw i64 %10, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %6, %2
ret void
}
int myPow2(int num) { return num * num; }


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

x86 assembly (clang, -O2):
<myPow2>:
mov    %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @myPow2(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int __irq_xxidle();
int __irq_end() { return __irq_xxidle(); }


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

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

LLVM IR (-O0):
define i32 @__irq_end() {
%1 = call i32 (...) @__irq_xxidle()
ret i32 %1
}

LLVM IR (-O2):
define i32 @__irq_end() {
%1 = tail call i32 (...) @__irq_xxidle()
ret i32 %1
}
void pcibios_set_master(struct pci_dev *dev) {}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define void @pcibios_set_master(%struct.pci_dev* nocapture %0) {
ret void
}
unsigned int bit_nat_pred_uint(unsigned int num) {
  return ((num) - ((((num)&1) | (!!((num))) | ((num)&1))));
}


x86 assembly (clang, -O0):
<bit_nat_pred_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
cmpl   $0x0,-0x4(%rbp)
setne  %dl
xor    $0xff,%dl
xor    $0xff,%dl
and    $0x1,%dl
movzbl %dl,%edx
or     %edx,%ecx
mov    -0x4(%rbp),%edx
and    $0x1,%edx
or     %edx,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_nat_pred_uint>:
mov    %edi,%eax
mov    %edi,%ecx
and    $0x1,%ecx
xor    %edx,%edx
test   %edi,%edi
setne  %dl
or     %ecx,%edx
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @bit_nat_pred_uint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 1
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = or i32 %5, %10
%12 = load i32, i32* %2
%13 = and i32 %12, 1
%14 = or i32 %11, %13
%15 = sub i32 %3, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @bit_nat_pred_uint(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp ne i32 %0, 0
%4 = zext i1 %3 to i32
%5 = or i32 %2, %4
%6 = sub i32 %0, %5
ret i32 %6
}
/* Variables and functions */
int maxofarr(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int ar[5] = {32, 45, 12, 73, 50};
  printf("max: %d\n", maxofarr(ar, 5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <maxofarr@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <maxofarr@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.ar = [5 x i32] [i32 32, i32 45, i32 12, i32 73, i32 50]
@.str = [9 x i8] c"max: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = bitcast [5 x i32]* %2 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%5 = call i32 @maxofarr(i32* %4, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.ar = [5 x i32] [i32 32, i32 45, i32 12, i32 73, i32 50]
@.str = [9 x i8] c"max: %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @maxofarr(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
void ARGBRotate270() {}


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

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

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

LLVM IR (-O2):
define void @ARGBRotate270() {
ret void
}
void g_mem_set_vtable() {}


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

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

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

LLVM IR (-O2):
define void @g_mem_set_vtable() {
ret void
}
unsigned long ntohl(unsigned long x) {
  unsigned long n;
  unsigned char *p;
  n = x;
  p = (unsigned char *)&n;
  return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}


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

x86 assembly (clang, -O2):
<ntohl>:
bswap  %edi
movslq %edi,%rax
ret

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

LLVM IR (-O2):
define i64 @ntohl(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ baz_ptr(int /*<<< orphan*/);
int bar(int n) {
  int i = 0;
  while (i < n) {
    i = i << 1;
    baz_ptr(i++);
  }
  return i;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114c <bar+0x3c>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
call   1030 <baz_ptr@plt>
jmp    1122 <bar+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1134 <bar+0x24>
mov    %edi,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
add    %ebx,%edi
add    %ebx,%ebx
add    $0x1,%ebx
call   1030 <baz_ptr@plt>
cmp    %ebp,%ebx
jl     1120 <bar+0x10>
jmp    1136 <bar+0x26>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = shl i32 %4, 1
%6 = or i32 %5, 1
%7 = tail call i32 @baz_ptr(i32 %5)
%8 = icmp slt i32 %6, %0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ bar(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setjmp(int /*<<< orphan*/);
void foo() {
  jmp_buf buf;
  printf("Inside foo\n");
  if (!setjmp(buf))
    bar(buf);
  else
    printf("Returning from longjmp into foo\n");
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <setjmp@plt>
cmp    $0x0,%eax
jne    1162 <foo+0x32>
mov    -0x4(%rbp),%edi
call   1030 <bar@plt>
jmp    116e <foo+0x3e>
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
call   1050 <setjmp@plt>
test   %eax,%eax
je     1154 <foo+0x24>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret
call   1040 <bar@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Inside foo\0A\00"
@.str.1 = [33 x i8] c"Returning from longjmp into foo\0A\00"
define void @foo() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = call i32 @setjmp(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i32, i32* %1
%8 = call i32 @bar(i32 %7)
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"Inside foo\00"
@str.2 = [32 x i8] c"Returning from longjmp into foo\00"
define void @foo() {
%1 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = call i32 @setjmp(i32 undef)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @bar(i32 undef)
br label %8
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PR_SET_NAME;
int prctl(int /*<<< orphan*/, char const *);
void kore_platform_proctitle(const char *title) {
  if (prctl(PR_SET_NAME, title) == -1) {
    ;
  }
}


x86 assembly (clang, -O0):
<kore_platform_proctitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <prctl@plt>
cmp    $0xffffffff,%eax
jne    113c <kore_platform_proctitle+0x2c>
jmp    113c <kore_platform_proctitle+0x2c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kore_platform_proctitle>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
jmp    1030 <prctl@plt>

LLVM IR (-O0):
@PR_SET_NAME = global i32 0
define void @kore_platform_proctitle(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @PR_SET_NAME
%4 = load i8*, i8** %2
%5 = call i32 @prctl(i32 %3, i8* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@PR_SET_NAME = global i32 0
define void @kore_platform_proctitle(i8* %0) {
%2 = load i32, i32* @PR_SET_NAME
%3 = tail call i32 @prctl(i32 %2, i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ _U_Qfcmp(long double, long double, int);
int _U_Qfgt(long double a, long double b) {
  return (_U_Qfcmp(a, b, 1 | 16) != 0);
}


x86 assembly (clang, -O0):
<_U_Qfgt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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)
mov    $0x11,%edi
call   1030 <_U_Qfcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_U_Qfgt>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fldt   0x40(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    $0x11,%edi
call   1030 <_U_Qfcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @_U_Qfgt(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = call i64 @_U_Qfcmp(x86_fp80 %5, x86_fp80 %6, i32 17)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @_U_Qfgt(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @_U_Qfcmp(x86_fp80 %0, x86_fp80 %1, i32 17)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
__attribute__((format(printf, 1, 2))) int no_pr(const char *fmt, ...) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @no_pr(i8* nocapture readnone %0, ...) {
ret i32 0
}
unsigned long pjwhash(unsigned char *str) {
  unsigned long g, h;
  for (h = 0; *str != 0; str++) {
    h = (h << 4) + (*str & 0xFF);
    g = h & 0xF0000000;
    h ^= (g >> 24) | g;
  }
  return h;
}


x86 assembly (clang, -O0):
<pjwhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     1176 <pjwhash+0x76>
mov    -0x18(%rbp),%rax
shl    $0x4,%rax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
movabs $0xf0000000,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
or     -0x10(%rbp),%rax
xor    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <pjwhash+0x10>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pjwhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     113b <pjwhash+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x4,%rax
movzbl %cl,%ecx
add    %rax,%rcx
mov    %ecx,%edx
and    $0xf0000000,%edx
mov    %rdx,%rax
shr    $0x18,%rax
or     %rdx,%rax
xor    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <pjwhash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @pjwhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %16, %4 ], [ %2, %1 ]
%6 = phi i64 [ %14, %4 ], [ 0, %1 ]
%7 = phi i8* [ %15, %4 ], [ %0, %1 ]
%8 = shl i64 %6, 4
%9 = zext i8 %5 to i64
%10 = add i64 %8, %9
%11 = and i64 %10, 4026531840
%12 = lshr exact i64 %11, 24
%13 = or i64 %12, %11
%14 = xor i64 %13, %10
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %4, %1
%19 = phi i64 [ 0, %1 ], [ %14, %4 ]
ret i64 %19
}
/* Type definitions */
struct news {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct news *);
void news_close(struct news *n) { assert(n); }


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

x86 assembly (clang, -O2):
<news_close>:
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct.news = type { i32 }
define void @news_close(%struct.news* %0) {
%2 = alloca %struct.news*
store %struct.news* %0, %struct.news** %2
%3 = load %struct.news*, %struct.news** %2
%4 = call i32 @assert(%struct.news* %3)
ret void
}

LLVM IR (-O2):
%struct.news = type { i32 }
define void @news_close(%struct.news* %0) {
%2 = tail call i32 @assert(%struct.news* %0)
ret void
}
int intloc(char *str, int loc) { return *(str + (loc - 1)) - '0'; }


x86 assembly (clang, -O0):
<intloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intloc>:
movslq %esi,%rax
movsbl -0x1(%rax,%rdi,1),%eax
add    $0xffffffd0,%eax
ret

LLVM IR (-O0):
define i32 @intloc(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 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 48
ret i32 %12
}

LLVM IR (-O2):
define i32 @intloc(i8* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = add nsw i32 %7, -48
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int memcmp(char *, char *, size_t);
int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n) {
  return memcmp((char *)s1, (char *)s2, n);
}


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

x86 assembly (clang, -O2):
<wmemcmp>:
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @wmemcmp(i32* nocapture %0, i32* nocapture %1, i64 %2) {
%4 = bitcast i32* %0 to i8*
%5 = bitcast i32* %1 to i8*
%6 = tail call i32 @memcmp(i8* %4, i8* %5, i64 %2)
ret i32 %6
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t AUXTDCStatusGet(uint32_t ui32Base) {
  ;
  return (
      ((*((volatile unsigned long *)(ui32Base + 0x00000004))) & 0x0000003F) >>
      0);
}


x86 assembly (clang, -O0):
<AUXTDCStatusGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rax
and    $0x3f,%rax
shr    $0x0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AUXTDCStatusGet>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    0x4(%rax),%rax
and    $0x3f,%eax
ret

LLVM IR (-O0):
define i64 @AUXTDCStatusGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add i64 %3, 4
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 63
%8 = lshr i64 %7, 0
ret i64 %8
}

LLVM IR (-O2):
define i64 @AUXTDCStatusGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add i64 %3, 4
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 63
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ stress_double_put(double const);
double __attribute__((no))
stress_funccall_double_2(const double a, const double b) {
  stress_double_put(a);
  stress_double_put(b);
  return a + b;
}


x86 assembly (clang, -O0):
<stress_funccall_double_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <stress_double_put@plt>
movsd  -0x10(%rbp),%xmm0
call   1030 <stress_double_put@plt>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_funccall_double_2>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1030 <stress_double_put@plt>
movsd  0x8(%rsp),%xmm0
call   1030 <stress_double_put@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @stress_funccall_double_2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call i32 @stress_double_put(double %5)
%7 = load double, double* %4
%8 = call i32 @stress_double_put(double %7)
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fadd double %9, %10
ret double %11
}

LLVM IR (-O2):
define double @stress_funccall_double_2(double %0, double %1) {
%3 = tail call i32 @stress_double_put(double %0)
%4 = tail call i32 @stress_double_put(double %1)
%5 = fadd double %0, %1
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ __do_binderfs_test();
scalar_t__ geteuid();
int /*<<< orphan*/ ksft_print_msg(char *);
void binderfs_test_privileged() {
  if (geteuid() != 0)
    ksft_print_msg("Tests are not run as root. Skipping privileged tests\n");
  else
    __do_binderfs_test();
}


x86 assembly (clang, -O0):
<binderfs_test_privileged>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <geteuid@plt>
cmp    $0x0,%rax
je     1156 <binderfs_test_privileged+0x26>
lea    0xeb4(%rip),%rdi
call   1040 <ksft_print_msg@plt>
jmp    115d <binderfs_test_privileged+0x2d>
mov    $0x0,%al
call   1050 <__do_binderfs_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<binderfs_test_privileged>:
push   %rax
xor    %eax,%eax
call   1030 <geteuid@plt>
test   %rax,%rax
je     114a <binderfs_test_privileged+0x1a>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1040 <ksft_print_msg@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <__do_binderfs_test@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Tests are not run as root. Skipping privileged tests\0A\00"
define void @binderfs_test_privileged() {
%1 = call i64 (...) @geteuid()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @ksft_print_msg(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = call i32 (...) @__do_binderfs_test()
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Tests are not run as root. Skipping privileged tests\0A\00"
define void @binderfs_test_privileged() {
%1 = tail call i64 (...) @geteuid()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @ksft_print_msg(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 (...) @__do_binderfs_test()
br label %7
7: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ basic_test(int);
int /*<<< orphan*/ cleanup_test();
int /*<<< orphan*/ init_test();
int log_read_start(int);
void read_one_meg_start(void) {
  ssize_t n;
  init_test();
  n = log_read_start(1048576);
  basic_test(n == 1048576);
  cleanup_test();
}


x86 assembly (clang, -O0):
<read_one_meg_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <init_test@plt>
mov    $0x100000,%edi
call   1040 <log_read_start@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x100000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <basic_test@plt>
mov    $0x0,%al
call   1050 <cleanup_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_one_meg_start>:
push   %rax
xor    %eax,%eax
call   1060 <init_test@plt>
mov    $0x100000,%edi
call   1040 <log_read_start@plt>
xor    %edi,%edi
cmp    $0x100000,%eax
sete   %dil
call   1030 <basic_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <cleanup_test@plt>

LLVM IR (-O0):
define void @read_one_meg_start() {
%1 = alloca i32
%2 = call i32 (...) @init_test()
%3 = call i32 @log_read_start(i32 1048576)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1048576
%6 = zext i1 %5 to i32
%7 = call i32 @basic_test(i32 %6)
%8 = call i32 (...) @cleanup_test()
ret void
}

LLVM IR (-O2):
define void @read_one_meg_start() {
%1 = tail call i32 (...) @init_test()
%2 = tail call i32 @log_read_start(i32 1048576)
%3 = icmp eq i32 %2, 1048576
%4 = zext i1 %3 to i32
%5 = tail call i32 @basic_test(i32 %4)
%6 = tail call i32 (...) @cleanup_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  printf("I am the child\n");
  sleep(1);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"I am the child\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 i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @sleep(i32 1)
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"I am the child\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @sleep(i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ MSG_EOR;
int /*<<< orphan*/ send(int, char const *, size_t, int /*<<< orphan*/);
ssize_t unix_fd_write_cb(const char *buffer, size_t size, void *data) {
  int fd = *(int *)data;
  return send(fd, buffer, size, MSG_EOR);
}


x86 assembly (clang, -O0):
<unix_fd_write_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    0x2ea9(%rip),%rax
mov    (%rax),%ecx
call   1030 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unix_fd_write_cb>:
mov    %rsi,%rax
mov    %rdi,%rsi
mov    (%rdx),%edi
mov    0x2ec9(%rip),%rcx
mov    (%rcx),%ecx
mov    %rax,%rdx
jmp    1030 <send@plt>

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

LLVM IR (-O2):
@MSG_EOR = global i32 0
define i32 @unix_fd_write_cb(i8* %0, i64 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = load i32, i32* %4
%6 = load i32, i32* @MSG_EOR
%7 = tail call i32 @send(i32 %5, i8* %0, i64 %1, i32 %6)
ret i32 %7
}
long f1(char a, short b, int c, long d) { return a + b * c - d; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
movswl -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
cltq
sub    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
imul   %edx,%esi
add    %edi,%esi
movslq %esi,%rax
sub    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @f1(i8 signext %0, i16 signext %1, i32 %2, i64 %3) {
%5 = alloca i8
%6 = alloca i16
%7 = alloca i32
%8 = alloca i64
store i8 %0, i8* %5
store i16 %1, i16* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = load i16, i16* %6
%12 = sext i16 %11 to i32
%13 = load i32, i32* %7
%14 = mul nsw i32 %12, %13
%15 = add nsw i32 %10, %14
%16 = sext i32 %15 to i64
%17 = load i64, i64* %8
%18 = sub nsw i64 %16, %17
ret i64 %18
}

LLVM IR (-O2):
define i64 @f1(i8 signext %0, i16 signext %1, i32 %2, i64 %3) {
%5 = sext i8 %0 to i32
%6 = sext i16 %1 to i32
%7 = mul nsw i32 %6, %2
%8 = add nsw i32 %7, %5
%9 = sext i32 %8 to i64
%10 = sub nsw i64 %9, %3
ret i64 %10
}
/* Variables and functions */
double cos(double);
double c_cos(double arg0) { return cos(arg0); }


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

x86 assembly (clang, -O2):
<c_cos>:
jmp    1030 <cos@plt>

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

LLVM IR (-O2):
define double @c_cos(double %0) {
%2 = tail call double @cos(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ c_fstr2hecmw_connect_conv(int, int *, int *, int *);
void fstr2hecmw_connect_conv(int *n_elem, int elem_type[],
                             int elem_node_index[], int elem_node_item[]) {
  c_fstr2hecmw_connect_conv(*n_elem, elem_type, elem_node_index,
                            elem_node_item);
}


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

x86 assembly (clang, -O2):
<fstr2hecmw_connect_conv>:
mov    (%rdi),%edi
jmp    1030 <c_fstr2hecmw_connect_conv@plt>

LLVM IR (-O0):
define void @fstr2hecmw_connect_conv(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 = load i32, i32* %9
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = call i32 @c_fstr2hecmw_connect_conv(i32 %10, i32* %11, i32* %12, i32* %13)
ret void
}

LLVM IR (-O2):
define void @fstr2hecmw_connect_conv(i32* nocapture %0, i32* %1, i32* %2, i32* %3) {
%5 = load i32, i32* %0
%6 = tail call i32 @c_fstr2hecmw_connect_conv(i32 %5, i32* %1, i32* %2, i32* %3)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void mp2vpicx_set_fcode10(uint8_t *p_mp2vpicx, uint8_t i_fcode10) {
  p_mp2vpicx[5] &= 0xf0;
  p_mp2vpicx[5] |= i_fcode10 & 0xf;
}


x86 assembly (clang, -O0):
<mp2vpicx_set_fcode10>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%ecx
and    $0xf0,%ecx
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
and    $0xf,%ecx
mov    -0x8(%rbp),%rax
or     0x14(%rax),%ecx
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vpicx_set_fcode10>:
mov    $0xf0,%eax
and    0x14(%rdi),%eax
and    $0xf,%esi
or     %eax,%esi
mov    %esi,0x14(%rdi)
ret

LLVM IR (-O0):
define void @mp2vpicx_set_fcode10(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 = getelementptr inbounds i32, i32* %5, i64 5
%7 = load i32, i32* %6
%8 = and i32 %7, 240
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = and i32 %9, 15
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 5
%13 = load i32, i32* %12
%14 = or i32 %13, %10
store i32 %14, i32* %12
ret void
}

LLVM IR (-O2):
define void @mp2vpicx_set_fcode10(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 5
%4 = load i32, i32* %3
%5 = and i32 %4, 240
%6 = and i32 %1, 15
%7 = or i32 %5, %6
store i32 %7, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ display(int *, int);
int /*<<< orphan*/ radix_sort(int *, int, int);
int main() {
  int n = 10;
  int elements[] = {2342, 3543, 6755, 2481, 9789, 3383, 6263, 7369, 9790, 1709};
  int no_of_digits = 4;
  display(elements, n);
  radix_sort(elements, n, no_of_digits);
  display(elements, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x4,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <display@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1040 <radix_sort@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x4,%edx
call   1040 <radix_sort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.elements = [10 x i32] [i32 2342, i32 3543, i32 6755, i32 2481, i32 9789, i32 3383, i32 6263, i32 7369, i32 9790, i32 1709]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%5 = bitcast [10 x i32]* %3 to i8*
store i32 4, i32* %4
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* %2
%8 = call i32 @display(i32* %6, i32 %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = load i32, i32* %4
%12 = call i32 @radix_sort(i32* %9, i32 %10, i32 %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%14 = load i32, i32* %2
%15 = call i32 @display(i32* %13, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.elements = [10 x i32] [i32 2342, i32 3543, i32 6755, i32 2481, i32 9789, i32 3383, i32 6263, i32 7369, i32 9790, i32 1709]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @display(i32* %3, i32 10)
%5 = call i32 @radix_sort(i32* %3, i32 10, i32 4)
%6 = call i32 @display(i32* %3, i32 10)
ret i32 0
}
/* Variables and functions */
int pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a, b, c;
  a = 4;
  b = 2;
  c = pow(a, b);
  printf("%d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <pow@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @pow(i32 4, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int count_factors(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i = 1, n = 1;
  while (count_factors(n) <= 500) {
    i++;
    n += i;
  }
  printf("%d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <count_factors@plt>
cmp    $0x1f4,%eax
jg     116e <main+0x4e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1144 <main+0x24>
mov    -0x18(%rbp),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <count_factors@plt>
cmp    $0x1f4,%eax
jg     1163 <main+0x43>
mov    $0x1,%ebx
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %ebp,%ebx
mov    %ebx,%edi
call   1040 <count_factors@plt>
add    $0x1,%ebp
cmp    $0x1f5,%eax
jl     1150 <main+0x30>
lea    0xe96(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @count_factors(i32 1)
%4 = icmp slt i32 %3, 501
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 1, %2 ]
%7 = phi i32 [ %8, %5 ], [ 1, %2 ]
%8 = add nuw nsw i32 %7, 1
%9 = add nuw nsw i32 %6, %8
%10 = tail call i32 @count_factors(i32 %9)
%11 = icmp slt i32 %10, 501
br i1 %11, label %5, label %12
12: ; preds = %5, %2
%13 = phi i32 [ 1, %2 ], [ %9, %5 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}
void disable_interrupts() { __asm__ __volatile__("cli" : : : "memory"); }


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", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}