xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void main(int argnum, char *arg[]) {
  int i;
  for (i = argnum - 1; i > 0; i--) {
    printf("%s ", arg[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    115a <main+0x4a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1128 <main+0x18>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     115b <main+0x3b>
mov    %rsi,%r15
mov    %edi,%ebx
add    $0x1,%rbx
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    (%r15,%rax,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
ja     1140 <main+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = icmp ugt i64 %7, 2
br i1 %13, label %6, label %14
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ disp_str(char *);
int /*<<< orphan*/ milli_delay(int);
void TestB() {
  int i = 0x1000;
  while (1) {
    disp_str("B.");
    milli_delay(200);
  }
}


x86 assembly (clang, -O0):
<TestB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1000,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <disp_str@plt>
mov    $0xc8,%edi
call   1040 <milli_delay@plt>
jmp    112f <TestB+0xf>

x86 assembly (clang, -O2):
<TestB>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <disp_str@plt>
mov    $0xc8,%edi
call   1040 <milli_delay@plt>
jmp    1130 <TestB+0x10>

LLVM IR (-O0):
@.str = [3 x i8] c"B.\00"
define void @TestB() {
%1 = alloca i32
store i32 4096, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @disp_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @milli_delay(i32 200)
br label %2
}

LLVM IR (-O2):
@.str = [3 x i8] c"B.\00"
define void @TestB() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @disp_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @milli_delay(i32 200)
br label %1
}
/* Variables and functions */
int ulstrcmp(char const *, char const *);
int mystrcasecmp(char const *a, char const *b) {
  if (a && b)
    return ulstrcmp(a, b);
  else
    return 1;
}


x86 assembly (clang, -O0):
<mystrcasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <mystrcasecmp+0x3b>
cmpq   $0x0,-0x18(%rbp)
je     114b <mystrcasecmp+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ulstrcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <mystrcasecmp+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcasecmp>:
test   %rdi,%rdi
je     111f <mystrcasecmp+0xf>
test   %rsi,%rsi
je     111f <mystrcasecmp+0xf>
jmp    1030 <ulstrcmp@plt>
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @mystrcasecmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = call i32 @ulstrcmp(i8* %12, i8* %13)
store i32 %14, i32* %3
br label %16
15: ; preds = %8, %2
store i32 1, i32* %3
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @mystrcasecmp(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @ulstrcmp(i8* %0, i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
unsigned pages(unsigned linesPerPage, unsigned totalLines) {
  unsigned retVal;
  if ((linesPerPage < 1) || (linesPerPage > 999))
    die("Lines per page falls outside the range [1,999].\n");
  retVal = totalLines / linesPerPage;
  if ((totalLines % linesPerPage) != 0)
    retVal++;
  return retVal;
}


x86 assembly (clang, -O0):
<pages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jb     1135 <pages+0x25>
cmpl   $0x3e7,-0x4(%rbp)
jbe    1141 <pages+0x31>
lea    0xec4(%rip),%rdi
call   1030 <die@plt>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0x4(%rbp)
cmp    $0x0,%edx
je     1166 <pages+0x56>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pages>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    -0x3e8(%rbx),%eax
cmp    $0xfffffc18,%eax
ja     1130 <pages+0x20>
lea    0xed5(%rip),%rdi
call   1030 <die@plt>
mov    %ebp,%eax
xor    %edx,%edx
div    %ebx
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Lines per page falls outside the range [1,999].\0A\00"
define i32 @pages(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp ult i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = icmp ugt i32 %9, 999
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = udiv i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %4
%18 = load i32, i32* %3
%19 = urem i32 %17, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = load i32, i32* %5
%23 = add i32 %22, 1
store i32 %23, i32* %5
br label %24
24: ; preds = %21, %13
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
@.str = [49 x i8] c"Lines per page falls outside the range [1,999].\0A\00"
define i32 @pages(i32 %0, i32 %1) {
%3 = add i32 %0, -1000
%4 = icmp ult i32 %3, -999
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = udiv i32 %1, %0
%9 = urem i32 %1, %0
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
%12 = add i32 %8, %11
ret i32 %12
}
void egg_memory_lock(void) {}


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

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

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

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

/* Variables and functions */
struct magic_set *file_ms_alloc(int);
struct magic_set *magic_open(int flags) {
  return file_ms_alloc(flags);
}


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

x86 assembly (clang, -O2):
<magic_open>:
jmp    1030 <file_ms_alloc@plt>

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

LLVM IR (-O2):
%struct.magic_set = type { i32 }
define %struct.magic_set* @magic_open(i32 %0) {
%2 = tail call %struct.magic_set* @file_ms_alloc(i32 %0)
ret %struct.magic_set* %2
}
int valookup(void *argv[], void *item) {
  int found = 0;
  while (argv && *argv)
    if (*argv++ == item)
      return found;
    else
      found++;
  return -1;
}


x86 assembly (clang, -O0):
<valookup>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1d(%rbp)
je     1131 <valookup+0x31>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1141 <valookup+0x41>
jmp    1176 <valookup+0x76>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jne    1168 <valookup+0x68>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <valookup+0x7d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <valookup+0x13>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valookup>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1133 <valookup+0x33>
mov    (%rdi),%rdx
test   %rdx,%rdx
je     1133 <valookup+0x33>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %rsi,%rdx
je     1134 <valookup+0x34>
mov    0x8(%rdi,%rcx,8),%rdx
add    $0x1,%rcx
test   %rdx,%rdx
jne    1120 <valookup+0x20>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @valookup(i8** %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %27, %2
%8 = load i8**, i8*** %4
%9 = icmp ne i8** %8, null
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br label %14
14: ; preds = %10, %7
%15 = phi i1 [ false, %7 ], [ %13, %10 ]
br i1 %15, label %16, label %28
16: ; preds = %14
%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** %5
%21 = icmp eq i8* %19, %20
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = load i32, i32* %6
store i32 %23, i32* %3
br label %29
24: ; preds = %16
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %27
27: ; preds = %24
br label %7
28: ; preds = %14
store i32 -1, i32* %3
br label %29
29: ; preds = %28, %22
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @valookup(i8** %0, i8* readnone %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = load i8*, i8** %0
%6 = icmp eq i8* %5, null
br i1 %6, label %17, label %7
7: ; preds = %4, %12
%8 = phi i8* [ %15, %12 ], [ %5, %4 ]
%9 = phi i8** [ %13, %12 ], [ %0, %4 ]
%10 = phi i32 [ %14, %12 ], [ 0, %4 ]
%11 = icmp eq i8* %8, %1
br i1 %11, label %17, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %9, i64 1
%14 = add nuw nsw i32 %10, 1
%15 = load i8*, i8** %13
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %7
17: ; preds = %12, %7, %4, %2
%18 = phi i32 [ -1, %2 ], [ -1, %4 ], [ %10, %7 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ GPIOPinTypeGPIOOutput(int, int);
int /*<<< orphan*/ SysCtlPeripheralEnable(int);
void DAC_init_gpio(void) {
  SysCtlPeripheralEnable(0x20000008);
  SysCtlPeripheralEnable(0x20000002);
  GPIOPinTypeGPIOOutput(0x40007000, (0x00000020 | 0x00000010));
  GPIOPinTypeGPIOOutput(0x40005000, (0x00000020));
}


x86 assembly (clang, -O0):
<DAC_init_gpio>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20000008,%edi
call   1030 <SysCtlPeripheralEnable@plt>
mov    $0x20000002,%edi
call   1030 <SysCtlPeripheralEnable@plt>
mov    $0x40007000,%edi
mov    $0x30,%esi
call   1040 <GPIOPinTypeGPIOOutput@plt>
mov    $0x40005000,%edi
mov    $0x20,%esi
call   1040 <GPIOPinTypeGPIOOutput@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DAC_init_gpio>:
push   %rax
mov    $0x20000008,%edi
call   1030 <SysCtlPeripheralEnable@plt>
mov    $0x20000002,%edi
call   1030 <SysCtlPeripheralEnable@plt>
mov    $0x40007000,%edi
mov    $0x30,%esi
call   1040 <GPIOPinTypeGPIOOutput@plt>
mov    $0x40005000,%edi
mov    $0x20,%esi
pop    %rax
jmp    1040 <GPIOPinTypeGPIOOutput@plt>

LLVM IR (-O0):
define void @DAC_init_gpio() {
%1 = call i32 @SysCtlPeripheralEnable(i32 536870920)
%2 = call i32 @SysCtlPeripheralEnable(i32 536870914)
%3 = call i32 @GPIOPinTypeGPIOOutput(i32 1073770496, i32 48)
%4 = call i32 @GPIOPinTypeGPIOOutput(i32 1073762304, i32 32)
ret void
}

LLVM IR (-O2):
define void @DAC_init_gpio() {
%1 = tail call i32 @SysCtlPeripheralEnable(i32 536870920)
%2 = tail call i32 @SysCtlPeripheralEnable(i32 536870914)
%3 = tail call i32 @GPIOPinTypeGPIOOutput(i32 1073770496, i32 48)
%4 = tail call i32 @GPIOPinTypeGPIOOutput(i32 1073762304, i32 32)
ret void
}
/* Variables and functions */
int strlen(char *);
char DotSuffix(char *string) { return string[strlen(string) - 1]; }


x86 assembly (clang, -O0):
<DotSuffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DotSuffix>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
mov    -0x1(%rax,%rbx,1),%al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @DotSuffix(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = sub nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %3, i64 %7
%9 = load i8, i8* %8
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @DotSuffix(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
ret i8 %6
}
/* Type definitions */
struct cpufreq_available_frequencies {
  int dummy;
};

/* Variables and functions */
struct cpufreq_available_frequencies *
proc_get_available_frequencies(unsigned int cpu) {
  return NULL;
}


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

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

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

LLVM IR (-O2):
%struct.cpufreq_available_frequencies = type { i32 }
define noalias %struct.cpufreq_available_frequencies* @proc_get_available_frequencies(i32 %0) {
ret %struct.cpufreq_available_frequencies* null
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ err_sys(char *);
char *getenv(char *);
scalar_t__ listen(int, int);
void Listen(int fd, int backlog) {
  char *ptr;
  if ((ptr = getenv("LISTENQ")) != NULL)
    backlog = atoi(ptr);
  if (listen(fd, backlog) < 0)
    err_sys("listen error");
}


x86 assembly (clang, -O0):
<Listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xeab(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1174 <Listen+0x34>
mov    -0x10(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <listen@plt>
cmp    $0x0,%rax
jge    1195 <Listen+0x55>
lea    0xe78(%rip),%rdi
call   1040 <err_sys@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Listen>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xeb2(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1162 <Listen+0x22>
mov    %rax,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <listen@plt>
test   %rax,%rax
js     1177 <Listen+0x37>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe8a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <err_sys@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"LISTENQ\00"
@.str.1 = [13 x i8] c"listen error\00"
define void @Listen(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = call i32 @atoi(i8* %9)
store i32 %10, i32* %4
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i64 @listen(i32 %12, i32 %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @err_sys(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"LISTENQ\00"
@.str.1 = [13 x i8] c"listen error\00"
define void @Listen(i32 %0, i32 %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @atoi(i8* %3)
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ %1, %2 ]
%9 = tail call i64 @listen(i32 %0, i32 %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @err_sys(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ bucket_sort(int *, int);
int /*<<< orphan*/ print(int *, int);
int main() {
  int nums[] = {2, 10, 3, 14, 15, 6, 3, 9};
  int n = sizeof(nums) / sizeof(nums[0]);
  bucket_sort(nums, n);
  print(nums, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <bucket_sort@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <bucket_sort@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [8 x i32] [i32 2, i32 10, i32 3, i32 14, i32 15, i32 6, i32 3, i32 9]
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @bucket_sort(i32* %5, i32 %6)
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @print(i32* %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [8 x i32] [i32 2, i32 10, i32 3, i32 14, i32 15, i32 6, i32 3, i32 9]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @bucket_sort(i32* %3, i32 8)
%5 = call i32 @print(i32* %3, i32 8)
ret i32 0
}
/* Variables and functions */
char *memptystr();
char *mprintf(char *, int);
char *buildstr(int b) {
  if (b < 0 || b > 99)
    return NULL;
  if (b == 99)
    return memptystr();
  return mprintf("%02d", b);
}


x86 assembly (clang, -O0):
<buildstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     113f <buildstr+0x1f>
cmpl   $0x63,-0xc(%rbp)
jle    114c <buildstr+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1179 <buildstr+0x59>
cmpl   $0x63,-0xc(%rbp)
jne    1166 <buildstr+0x46>
mov    $0x0,%al
call   1040 <memptystr@plt>
mov    %rax,-0x8(%rbp)
jmp    1179 <buildstr+0x59>
mov    -0xc(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1030 <mprintf@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildstr>:
cmp    $0x63,%edi
jbe    1128 <buildstr+0x8>
xor    %eax,%eax
ret
jne    1131 <buildstr+0x11>
xor    %eax,%eax
jmp    1040 <memptystr@plt>
mov    %edi,%esi
lea    0xec6(%rip),%rdi
jmp    1030 <mprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02d\00"
define i8* @buildstr(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 99
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i8* null, i8** %2
br label %18
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 99
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i8* (...) @memptystr()
store i8* %14, i8** %2
br label %18
15: ; preds = %10
%16 = load i32, i32* %3
%17 = call i8* @mprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %16)
store i8* %17, i8** %2
br label %18
18: ; preds = %15, %13, %9
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02d\00"
define i8* @buildstr(i32 %0) {
%2 = icmp ugt i32 %0, 99
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 99
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i8* (...) @memptystr()
br label %9
7: ; preds = %3
%8 = tail call i8* @mprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
9: ; preds = %1, %7, %5
%10 = phi i8* [ %6, %5 ], [ %8, %7 ], [ null, %1 ]
ret i8* %10
}
int ft_isdigit(char c) { return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<ft_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <ft_isdigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isdigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_isdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ fabs(double);
int fmax(scalar_t__, int /*<<< orphan*/);
double soft_threshold(double beta, double gamma) {
  return ((beta > 0) - (beta < 0)) * fmax(fabs(beta) - gamma, 0);
}


x86 assembly (clang, -O0):
<soft_threshold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %rax,%xmm0
subsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
xor    %esi,%esi
call   1040 <fmax@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soft_threshold>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm2,%xmm2
xor    %ebx,%ebx
ucomisd %xmm2,%xmm0
seta   %bl
xor    %eax,%eax
ucomisd %xmm0,%xmm2
movsd  %xmm1,0x8(%rsp)
seta   %al
sub    %eax,%ebx
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
subsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%rdi
xor    %esi,%esi
call   1040 <fmax@plt>
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @soft_threshold(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 = fcmp ogt double %5, 0.000000e+00
%7 = zext i1 %6 to i32
%8 = load double, double* %3
%9 = fcmp olt double %8, 0.000000e+00
%10 = zext i1 %9 to i32
%11 = sub nsw i32 %7, %10
%12 = load double, double* %3
%13 = call i64 @fabs(double %12)
%14 = sitofp i64 %13 to double
%15 = load double, double* %4
%16 = fsub double %14, %15
%17 = fptosi double %16 to i64
%18 = call i32 @fmax(i64 %17, i32 0)
%19 = mul nsw i32 %11, %18
%20 = sitofp i32 %19 to double
ret double %20
}

LLVM IR (-O2):
define double @soft_threshold(double %0, double %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = fcmp olt double %0, 0.000000e+00
%6 = sext i1 %5 to i32
%7 = add nsw i32 %6, %4
%8 = tail call i64 @fabs(double %0)
%9 = sitofp i64 %8 to double
%10 = fsub double %9, %1
%11 = fptosi double %10 to i64
%12 = tail call i32 @fmax(i64 %11, i32 0)
%13 = mul nsw i32 %12, %7
%14 = sitofp i32 %13 to double
ret double %14
}
int intmask(char *s) {
  char *sptr;
  int mask;
  mask = 0;
  for (sptr = s; *sptr != '\0'; sptr++)
    if ((*sptr >= 'A') && (*sptr <= 'Z'))
      mask |= 1 << (int)(*sptr - 'A');
  return (mask);
}


x86 assembly (clang, -O0):
<intmask>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1174 <intmask+0x74>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     115e <intmask+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     115e <intmask+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x41,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <intmask+0x63>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <intmask+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intmask>:
mov    (%rdi),%cl
test   %cl,%cl
je     112e <intmask+0x2e>
add    $0x1,%rdi
xor    %edx,%edx
xor    %eax,%eax
xchg   %ax,%ax
add    $0xbf,%cl
mov    $0x1,%esi
shl    %cl,%esi
cmp    $0x1a,%cl
cmovae %edx,%esi
or     %esi,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <intmask+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @intmask(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %30, %1
%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 %33
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 65
br i1 %15, label %16, label %29
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 90
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 65
%26 = shl i32 1, %25
%27 = load i32, i32* %4
%28 = or i32 %27, %26
store i32 %28, i32* %4
br label %29
29: ; preds = %21, %16, %11
br label %30
30: ; preds = %29
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
br label %6
33: ; preds = %6
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
define i32 @intmask(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 i32 [ %14, %4 ], [ 0, %1 ]
%7 = phi i8* [ %15, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = add i8 %5, -65
%10 = icmp ult i8 %9, 26
%11 = add nsw i32 %8, -65
%12 = shl nuw i32 1, %11
%13 = select i1 %10, i32 %12, i32 0
%14 = or i32 %13, %6
%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 i32 [ 0, %1 ], [ %14, %4 ]
ret i32 %19
}
/* Variables and functions */
int calculate(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main() {
  char input[200];
  fgets(input, 200, stdin);
  printf("%d", calculate(input));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1050 <fgets@plt>
lea    -0xd0(%rbp),%rdi
call   1040 <calculate@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1040 <calculate@plt>
lea    0xea0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 200, i32 %3)
%5 = call i32 @calculate(i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ plazaui_async_resize();
void resize_handler(int signum) { plazaui_async_resize(); }


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

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

LLVM IR (-O0):
define void @resize_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @plazaui_async_resize()
ret void
}

LLVM IR (-O2):
define void @resize_handler(i32 %0) {
%2 = tail call i32 (...) @plazaui_async_resize()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void bail(char const *prefix, char const *msg) {
  fprintf(stderr, "%s: %s\n", prefix, msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<bail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bail>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @bail(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ appendCODE(int /*<<< orphan*/);
int /*<<< orphan*/ makeCODEif_acmpne(int, int /*<<< orphan*/ *);
void code_if_acmpne(int label) { appendCODE(makeCODEif_acmpne(label, NULL)); }


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

x86 assembly (clang, -O2):
<code_if_acmpne>:
push   %rax
xor    %esi,%esi
call   1030 <makeCODEif_acmpne@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <appendCODE@plt>

LLVM IR (-O0):
define void @code_if_acmpne(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @makeCODEif_acmpne(i32 %3, i32* null)
%5 = call i32 @appendCODE(i32 %4)
ret void
}

LLVM IR (-O2):
define void @code_if_acmpne(i32 %0) {
%2 = tail call i32 @makeCODEif_acmpne(i32 %0, i32* null)
%3 = tail call i32 @appendCODE(i32 %2)
ret void
}
void f8() {
  typedef int __attribute__((__mode__(__DI__))) di_int_type;
  di_int_type di_int;
  __sync_bool_compare_and_swap(&di_int, (di_int_type)0, (di_int_type)1);
}


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    $0x1,%ecx
lock cmpxchg %rcx,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f8>:
mov    $0x1,%ecx
xor    %eax,%eax
lock cmpxchg %rcx,-0x8(%rsp)
ret

LLVM IR (-O0):
define void @f8() {
%1 = alloca i64
%2 = cmpxchg i64* %1, i64 0, i64 1 seq_cst seq_cst
%3 = extractvalue { i64, i1 } %2, 1
ret void
}

LLVM IR (-O2):
define void @f8() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = cmpxchg i64* %1, i64 0, i64 1 seq_cst seq_cst
ret void
}
/* Variables and functions */
int RSA2048_load(int, char *, unsigned char *, int);
int RSA2048_load_prikey_dP(int fd, unsigned char *RSA2048_dP) {
  int ret;
  ret = RSA2048_load(fd, "BF51020480", RSA2048_dP, 128);
  if (ret != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<RSA2048_load_prikey_dP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rsi
mov    $0x80,%ecx
call   1030 <RSA2048_load@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1150 <RSA2048_load_prikey_dP+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1157 <RSA2048_load_prikey_dP+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RSA2048_load_prikey_dP>:
push   %rax
mov    %rsi,%rdx
lea    0xee5(%rip),%rsi
mov    $0x80,%ecx
call   1030 <RSA2048_load@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"BF51020480\00"
define i32 @RSA2048_load_prikey_dP(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = call i32 @RSA2048_load(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i32 128)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [11 x i8] c"BF51020480\00"
define i32 @RSA2048_load_prikey_dP(i32 %0, i8* %1) {
%3 = tail call i32 @RSA2048_load(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1, i32 128)
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void foo_2_2_1_1_2_1_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_1_1_2_1_1_2_2() {
ret void
}
signed int signedint_ignoring_signedlonglong(signed int x, signed long long y) {
  return x;
}


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

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

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

LLVM IR (-O2):
define i32 @signedint_ignoring_signedlonglong(i32 returned %0, i64 %1) {
ret i32 %0
}
/* Variables and functions */
long __infer_nondet_long_int();
long int lroundf(float x) { return __infer_nondet_long_int(); }


x86 assembly (clang, -O0):
<lroundf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_long_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @lroundf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call i64 (...) @__infer_nondet_long_int()
ret i64 %3
}

LLVM IR (-O2):
define i64 @lroundf(float %0) {
%2 = tail call i64 (...) @__infer_nondet_long_int()
ret i64 %2
}
void f(void) {
  struct {
    int i;
  } * p;
#pragma acc data copyout(p) if (1) if (1)
  ;
#pragma acc update device(p) if (*p)
}


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

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

LLVM IR (-O0):
%struct.anon = type { i32 }
define void @f() {
%1 = alloca %struct.anon*
ret void
}

LLVM IR (-O2):
%struct.anon = type { i32 }
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ psignal(int, char *);
void sigdown(int signo) {
  psignal(signo, "shutting down, got signal");
  exit(0);
}


x86 assembly (clang, -O0):
<sigdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xecb(%rip),%rsi
call   1040 <psignal@plt>
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
@.str = [26 x i8] c"shutting down, got signal\00"
define void @sigdown(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @psignal(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"shutting down, got signal\00"
define void @sigdown(i32 %0) {
%2 = tail call i32 @psignal(i32 %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ assert(unsigned short *);
unsigned int arithmetic_decimal_subtract(unsigned short a, unsigned short b,
                                         unsigned short *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (a - b);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<arithmetic_decimal_subtract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1151 <arithmetic_decimal_subtract+0x41>
movl   $0x2,-0x14(%rbp)
jmp    1165 <arithmetic_decimal_subtract+0x55>
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arithmetic_decimal_subtract>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    %rdx,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     1133 <arithmetic_decimal_subtract+0x23>
sub    %r14d,%ebp
mov    %bp,(%rbx)
xor    %eax,%eax
jmp    1138 <arithmetic_decimal_subtract+0x28>
mov    $0x2,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @arithmetic_decimal_subtract(i16 zeroext %0, i16 zeroext %1, i16* %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16*
%7 = alloca i32
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16* %2, i16** %6
%8 = load i16*, i16** %6
%9 = call i32 @assert(i16* %8)
store i32 0, i32* %7
%10 = load i16*, i16** %6
%11 = icmp ne i16* %10, null
br i1 %11, label %13, label %12
12: ; preds = %3
store i32 2, i32* %7
br label %21
13: ; preds = %3
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = load i16, i16* %5
%17 = zext i16 %16 to i32
%18 = sub nsw i32 %15, %17
%19 = trunc i32 %18 to i16
%20 = load i16*, i16** %6
store i16 %19, i16* %20
br label %21
21: ; preds = %13, %12
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @arithmetic_decimal_subtract(i16 zeroext %0, i16 zeroext %1, i16* %2) {
%4 = tail call i32 @assert(i16* %2)
%5 = icmp eq i16* %2, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = sub i16 %0, %1
store i16 %7, i16* %2
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ 0, %6 ], [ 2, %3 ]
ret i32 %9
}
int x_fold_capitialize(c)
int c;
{ return x_fold_case('C'); }


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

x86 assembly (clang, -O2):
<x_fold_capitialize>:
mov    $0x43,%edi
xor    %eax,%eax
jmp    1030 <x_fold_case@plt>

LLVM IR (-O0):
define i32 @x_fold_capitialize(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @x_fold_case to i32 (i32, ...)*)(i32 67)
ret i32 %3
}

LLVM IR (-O2):
define i32 @x_fold_capitialize(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @x_fold_case to i32 (i32, ...)*)(i32 67)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ rip_images(char *);
int main(int argc, char **argv) {
  rip_images(argv[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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <rip_images@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <rip_images@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @rip_images(i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(char *);
int snprintf(char *, int, char *, int);
char *int_to_str(int n, char *s, int size) {
  int used = snprintf(s, size, "%d", n);
  if (used >= size)
    fatal_error("float_to_str, string too small");
  return s;
}


x86 assembly (clang, -O0):
<int_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x4(%rbp),%ecx
lea    0xebd(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1163 <int_to_str+0x43>
lea    0xea5(%rip),%rdi
call   1040 <fatal_error@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_str>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%ecx
lea    0xecf(%rip),%rdx
mov    %rsi,%rdi
mov    %ebp,%esi
call   1030 <snprintf@plt>
cmp    %ebp,%eax
jl     114b <int_to_str+0x2b>
lea    0xebd(%rip),%rdi
call   1040 <fatal_error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [31 x i8] c"float_to_str, string too small\00"
define i8* @int_to_str(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = call i32 @snprintf(i8* %8, i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = icmp sge i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 @fatal_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %3
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [31 x i8] c"float_to_str, string too small\00"
define i8* @int_to_str(i32 %0, i8* returned %1, i32 %2) {
%4 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = icmp slt i32 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @fatal_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i8* %1
}