xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
scalar_t__ wcsncpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, size_t);
int wcscpy_s(wchar_t *str, size_t size, const wchar_t *src) {
  return wcsncpy(str, src, size) ? 0 : -1;
}


x86 assembly (clang, -O0):
<wcscpy_s>:
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    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <wcsncpy@plt>
mov    %rax,%rdx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscpy_s>:
push   %rax
mov    %rsi,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <wcsncpy@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @wcscpy_s(i32* %0, i64 %1, i32* %2) {
%4 = tail call i64 @wcsncpy(i32* %0, i32* %2, i64 %1)
%5 = icmp eq i64 %4, 0
%6 = sext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int glutBitmapStringWidth(void *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, float);
int glutBitmapFloatWidth(void *fontface, float i) {
  char buf[64];
  snprintf(buf, 64, "%.2f", i);
  return glutBitmapStringWidth(fontface, buf);
}


x86 assembly (clang, -O0):
<glutBitmapFloatWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
mov    $0x40,%esi
lea    0xeba(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <glutBitmapStringWidth@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glutBitmapFloatWidth>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
lea    0xecf(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <glutBitmapStringWidth@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.2f\00"
define i32 @glutBitmapFloatWidth(i8* %0, float %1) {
%3 = alloca i8*
%4 = alloca float
%5 = alloca [64 x i8]
store i8* %0, i8** %3
store float %1, float* %4
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = load float, float* %4
%8 = call i32 @snprintf(i8* %6, i32 64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = call i32 @glutBitmapStringWidth(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.2f\00"
define i32 @glutBitmapFloatWidth(i8* %0, float %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %1)
%6 = call i32 @glutBitmapStringWidth(i8* %0, i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void func2(void) {
  int count;
  for (count = 1; count < 10; count++)
    putchar('.');
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1141 <func2+0x31>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <func2+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %rax
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @func2() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %7, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = call i32 @putchar(i8 signext 46)
br label %7
7: ; preds = %5
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @func2() {
%1 = tail call i32 @putchar(i8 signext 46)
%2 = tail call i32 @putchar(i8 signext 46)
%3 = tail call i32 @putchar(i8 signext 46)
%4 = tail call i32 @putchar(i8 signext 46)
%5 = tail call i32 @putchar(i8 signext 46)
%6 = tail call i32 @putchar(i8 signext 46)
%7 = tail call i32 @putchar(i8 signext 46)
%8 = tail call i32 @putchar(i8 signext 46)
%9 = tail call i32 @putchar(i8 signext 46)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *sc_malloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<sc_malloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @sc_malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @malloc(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @sc_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
signed long fastrange(signed long argx, signed long argy) {
  signed long rs0, rs1;
  rs0 = argx;
  rs1 = argy;
  if (rs0 < 0)
    rs0 = -rs0;
  if (rs1 < 0)
    rs1 = -rs1;
  if (rs0 > rs1)
    return rs0;
  else
    return rs1;
}


x86 assembly (clang, -O0):
<fastrange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1131 <fastrange+0x31>
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    1146 <fastrange+0x46>
xor    %eax,%eax
sub    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1161 <fastrange+0x61>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <fastrange+0x69>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastrange>:
mov    %rdi,%rcx
neg    %rcx
cmovs  %rdi,%rcx
mov    %rsi,%rax
neg    %rax
cmovs  %rsi,%rax
cmp    %rax,%rcx
cmova  %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @fastrange(i64 %0, i64 %1) {
%3 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%4 = tail call i64 @llvm.abs.i64(i64 %1, i1 true)
%5 = icmp ugt i64 %3, %4
%6 = select i1 %5, i64 %3, i64 %4
ret i64 %6
}
int maximum(int a, int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<maximum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <maximum+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <maximum+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maximum>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @maximum(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int _any_except(char val, char *exceptions, unsigned size) {
  while (size-- > 0)
    if (val == exceptions[size])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<_any_except>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jbe    114d <_any_except+0x4d>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1148 <_any_except+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1154 <_any_except+0x54>
jmp    1111 <_any_except+0x11>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_any_except>:
mov    %edx,%eax
mov    %rax,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
sub    $0x1,%rcx
jb     1123 <_any_except+0x23>
cmp    %dil,-0x1(%rsi,%rax,1)
mov    %rcx,%rax
jne    1110 <_any_except+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @_any_except(i8 signext %0, i8* nocapture %1, i32 %2) {
%4 = zext i32 %2 to i64
br label %5
5: ; preds = %9, %3
%6 = phi i64 [ %7, %9 ], [ %4, %3 ]
%7 = add nsw i64 %6, -1
%8 = icmp eq i64 %6, 0
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %1, i64 %7
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, %0
br i1 %12, label %13, label %5
13: ; preds = %5, %9
%14 = phi i32 [ 0, %9 ], [ 1, %5 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ free(char **);
void g_strfreev(char **str_array) {
  char **p = str_array;
  if (p) {
    while (*p) {
      free(*p++);
    }
  }
  free(str_array);
}


x86 assembly (clang, -O0):
<g_strfreev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1163 <g_strfreev+0x53>
jmp    1134 <g_strfreev+0x24>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     115e <g_strfreev+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    1134 <g_strfreev+0x24>
jmp    1163 <g_strfreev+0x53>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_strfreev>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
je     1141 <g_strfreev+0x31>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1141 <g_strfreev+0x31>
lea    0x8(%r14),%rbx
nopl   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <g_strfreev+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @g_strfreev(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %12, %6 ], [ %4, %3 ]
%8 = phi i8** [ %9, %6 ], [ %0, %3 ]
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = bitcast i8* %7 to i8**
%11 = tail call i32 @free(i8** %10)
%12 = load i8*, i8** %9
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %6
14: ; preds = %6, %3, %1
%15 = tail call i32 @free(i8** %0)
ret void
}
/* Variables and functions */
int load_png(void const *filename, size_t len, void *data, void *link) {
  (void)filename;
  (void)len;
  (void)data;
  (void)link;
  return -1;
}


x86 assembly (clang, -O0):
<load_png>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @load_png(i8* nocapture readnone %0, i64 %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void segv_handler(int sig) {
  printf("Segmentation fault.  Try again.\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"Segmentation fault. Try again.\0A\00"
define void @segv_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [32 x i8] c"Segmentation fault. Try again.\00"
define void @segv_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int pid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int getpid();
extern void singleton_set_lock() {
  pid_t me = getpid();
  FILE *lock = fopen("/var/pushr/.lock", "w");
  fprintf(lock, "%d", me);
  fclose(lock);
}


x86 assembly (clang, -O0):
<singleton_set_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe9c(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singleton_set_lock>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
lea    0xead(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xeaa(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"/var/pushr/.lock\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%d\00"
define void @singleton_set_lock() {
%1 = alloca i32
%2 = alloca i32*
%3 = call i32 (...) @getpid()
store i32 %3, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %1
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 @fclose(i32* %8)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"/var/pushr/.lock\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%d\00"
define void @singleton_set_lock() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%4 = tail call i32 @fclose(i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ net_send(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *);
void irc_op(char *channel, char *nick) {
  char msg[(512 - 3)];
  snprintf(msg, (512 - 3), "%s %s +o %s", "MODE", channel, nick);
  net_send(msg);
}


x86 assembly (clang, -O0):
<irc_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    $0x1fd,%esi
lea    0xeb2(%rip),%rdx
lea    0xeb7(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x210(%rbp),%rdi
call   1040 <net_send@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_op>:
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r9
mov    %rdi,%r8
lea    0xecb(%rip),%rdx
lea    0xed0(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1fd,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <net_send@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s %s +o %s\00"
@.str.1 = [5 x i8] c"MODE\00"
define void @irc_op(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [509 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [509 x i8], [509 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @snprintf(i8* %6, i32 509, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %8)
%10 = getelementptr inbounds [509 x i8], [509 x i8]* %5, i64 0, i64 0
%11 = call i32 @net_send(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s %s +o %s\00"
@.str.1 = [5 x i8] c"MODE\00"
define void @irc_op(i8* %0, i8* %1) {
%3 = alloca [509 x i8]
%4 = getelementptr inbounds [509 x i8], [509 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 509, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i32 @net_send(i8* %4)
ret void
}
/* Type definitions */
typedef size_t int32_t;

/* Variables and functions */
size_t INT32_MAX;
int /*<<< orphan*/ quick_sort4(size_t *, int /*<<< orphan*/, size_t);
void sort4(int32_t *a, int32_t n) {
  a[n] = INT32_MAX;
  if (n >= 2)
    quick_sort4(a, 0, n);
}


x86 assembly (clang, -O0):
<sort4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
cmpq   $0x2,-0x10(%rbp)
jb     1150 <sort4+0x40>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <quick_sort4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort4>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%rax
mov    %rax,(%rdi,%rsi,8)
cmp    $0x2,%rsi
jb     112e <sort4+0x1e>
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <quick_sort4@plt>
ret

LLVM IR (-O0):
@INT32_MAX = global i64 0
define void @sort4(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%5 = load i64, i64* @INT32_MAX
%6 = load i64*, i64** %3
%7 = load i64, i64* %4
%8 = getelementptr inbounds i64, i64* %6, i64 %7
store i64 %5, i64* %8
%9 = load i64, i64* %4
%10 = icmp uge i64 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i64*, i64** %3
%13 = load i64, i64* %4
%14 = call i32 @quick_sort4(i64* %12, i32 0, i64 %13)
br label %15
15: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
@INT32_MAX = global i64 0
define void @sort4(i64* %0, i64 %1) {
%3 = load i64, i64* @INT32_MAX
%4 = getelementptr inbounds i64, i64* %0, i64 %1
store i64 %3, i64* %4
%5 = icmp ugt i64 %1, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @quick_sort4(i64* %0, i32 0, i64 %1)
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void _print_usage_header(const char *command) {
  printf("Usage: %s [OPTION]\n"
         "Reads stdin and sends it to stdout while prefixing each line with\n"
         "a timestamp.\n",
         command);
}


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

x86 assembly (clang, -O2):
<_print_usage_header>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [99 x i8] c"Usage: %s [OPTION]\0AReads stdin and sends it to stdout while prefixing each line with\0Aa timestamp.\0A\00"
define void @_print_usage_header(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [99 x i8] c"Usage: %s [OPTION]\0AReads stdin and sends it to stdout while prefixing each line with\0Aa timestamp.\0A\00"
define void @_print_usage_header(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned long long rdtsc() {
  unsigned int lo, hi;
  __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
  return ((unsigned long long)hi << 32) | lo;
}


x86 assembly (clang, -O0):
<rdtsc>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %eax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x20,%rax
mov    -0x4(%rbp),%ecx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdtsc>:
rdtsc
shl    $0x20,%rdx
mov    %eax,%eax
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @rdtsc() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = shl i64 %7, 32
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = or i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @rdtsc() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 %4, 32
%6 = zext i32 %2 to i64
%7 = or i64 %5, %6
ret i64 %7
}
/* Variables and functions */
scalar_t__ strtol(char *, char **, int);
int int_from_str(char *src) {
  char *ptr;
  int ret = (int)strtol(src, &ptr, 10);
  return ret;
}


x86 assembly (clang, -O0):
<int_from_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_from_str>:
push   %rax
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @int_from_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strtol(i8* %5, i8** %3, i32 10)
%7 = trunc i64 %6 to i32
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @int_from_str(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 10)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sendCommand(unsigned char, int, int /*<<< orphan*/,
                               int /*<<< orphan*/, int /*<<< orphan*/);
void LivingColors_turnLampOff(unsigned char index) {
  sendCommand(index, 0x07, 0, 0, 0);
}


x86 assembly (clang, -O0):
<LivingColors_turnLampOff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x7,%esi
xor    %r8d,%r8d
movzbl -0x1(%rbp),%edi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <sendCommand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LivingColors_turnLampOff>:
mov    $0x7,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <sendCommand@plt>

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

LLVM IR (-O2):
define void @LivingColors_turnLampOff(i8 zeroext %0) {
%2 = tail call i32 @sendCommand(i8 zeroext %0, i32 7, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MacMsg(char *, char *, int /*<<< orphan*/);
void WarnMsgCorruptedROM(void) {
  MacMsg("ROM checksum failed", "The ROM image file ;[^r;{ may be corrupted.",
         0);
}


x86 assembly (clang, -O0):
<WarnMsgCorruptedROM>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %edx,%edx
call   1030 <MacMsg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<WarnMsgCorruptedROM>:
lea    0xee9(%rip),%rdi
lea    0xef6(%rip),%rsi
xor    %edx,%edx
jmp    1030 <MacMsg@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"ROM checksum failed\00"
@.str.1 = [44 x i8] c"The ROM image file ;[^r;{ may be corrupted.\00"
define void @WarnMsgCorruptedROM() {
%1 = call i32 @MacMsg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"ROM checksum failed\00"
@.str.1 = [44 x i8] c"The ROM image file ;[^r;{ may be corrupted.\00"
define void @WarnMsgCorruptedROM() {
%1 = tail call i32 @MacMsg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
void XtCvtStringToDirectoryString() {}


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

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

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

LLVM IR (-O2):
define void @XtCvtStringToDirectoryString() {
ret void
}
void XBitmapPad() {}


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

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

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

LLVM IR (-O2):
define void @XBitmapPad() {
ret void
}
__attribute__((no)) void foo(int x) { __asm__ __volatile__("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @foo(i32 %0) {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
long my_readlink(char const *);
long recurse(const char *path, long count) {
  if (count <= 0) {
    return my_readlink(path);
  } else {
    long r = recurse(path, count - 1);
    return r;
  }
}


x86 assembly (clang, -O0):
<recurse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jg     114d <recurse+0x2d>
mov    -0x10(%rbp),%rdi
call   1040 <my_readlink@plt>
mov    %rax,-0x8(%rbp)
jmp    116a <recurse+0x4a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
call   1030 <recurse@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recurse>:
jmp    1030 <my_readlink@plt>

LLVM IR (-O0):
define i64 @recurse(i8* %0, i64 %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i64, i64* %5
%8 = icmp sle i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i64 @my_readlink(i8* %10)
store i64 %11, i64* %3
br label %18
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i64, i64* %5
%15 = sub nsw i64 %14, 1
%16 = call i64 @recurse(i8* %13, i64 %15)
store i64 %16, i64* %6
%17 = load i64, i64* %6
store i64 %17, i64* %3
br label %18
18: ; preds = %12, %9
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @recurse(i8* %0, i64 %1) {
%3 = tail call i64 @my_readlink(i8* %0)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ write_record(int, int, char *, char *);
void QMWriteu(int fno, char *id, char *data) {
  write_record(17, fno, id, data);
}


x86 assembly (clang, -O0):
<QMWriteu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x11,%edi
call   1030 <write_record@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QMWriteu>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x11,%edi
jmp    1030 <write_record@plt>

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

LLVM IR (-O2):
define void @QMWriteu(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @write_record(i32 17, i32 %0, i8* %1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void jl_near_rj(unsigned int saut) {
  put8(0x0F);
  put8(0x8C);
  put32(saut);
}


x86 assembly (clang, -O0):
<jl_near_rj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xf,%edi
call   1030 <put8@plt>
mov    $0x8c,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jl_near_rj>:
push   %rbx
mov    %edi,%ebx
mov    $0xf,%edi
call   1030 <put8@plt>
mov    $0x8c,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @jl_near_rj(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 15)
%4 = call i32 @put8(i32 140)
%5 = load i32, i32* %2
%6 = call i32 @put32(i32 %5)
ret void
}

LLVM IR (-O2):
define void @jl_near_rj(i32 %0) {
%2 = tail call i32 @put8(i32 15)
%3 = tail call i32 @put8(i32 140)
%4 = tail call i32 @put32(i32 %0)
ret void
}
int pad_to_int32(const int bytes) { return (((bytes) + 3) & ~3); }


x86 assembly (clang, -O0):
<pad_to_int32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
and    $0xfffffffc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pad_to_int32>:
lea    0x3(%rdi),%eax
and    $0xfffffffc,%eax
ret

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

LLVM IR (-O2):
define i32 @pad_to_int32(i32 %0) {
%2 = add nsw i32 %0, 3
%3 = and i32 %2, -4
ret i32 %3
}
/* Variables and functions */
float cosf(float);
float IvCos(float a) { return cosf(a); }


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

x86 assembly (clang, -O2):
<IvCos>:
jmp    1030 <cosf@plt>

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

LLVM IR (-O2):
define float @IvCos(float %0) {
%2 = tail call float @cosf(float %0)
ret float %2
}
int fun957() { return 957; }


x86 assembly (clang, -O0):
<fun957>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3bd,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun957() {
ret i32 957
}

LLVM IR (-O2):
define i32 @fun957() {
ret i32 957
}
int d_blg_rm1(double a1, double *a2) {
  return (__builtin_islessgreater(a1, *a2));
}


x86 assembly (clang, -O0):
<d_blg_rm1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_blg_rm1>:
xor    %eax,%eax
ucomisd (%rdi),%xmm0
setne  %al
ret

LLVM IR (-O0):
define i32 @d_blg_rm1(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 = load double*, double** %4
%7 = load double, double* %6
%8 = fcmp one double %5, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @d_blg_rm1(double %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = fcmp one double %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct spaceSaver {
  int dummy;
};
struct spaceRange {
  int dummy;
};
struct spaceNode {
  int dummy;
};

/* Variables and functions */
struct spaceNode *spaceSaverAddOverflowMulti(struct spaceSaver *,
                                             struct spaceRange *,
                                             struct spaceNode *,
                                             int /*<<< orphan*/);
struct spaceNode *spaceSaverAddMulti(struct spaceSaver *ss,
                                     struct spaceRange *rangeList,
                                     struct spaceNode *nodeList) {
  return spaceSaverAddOverflowMulti(ss, rangeList, nodeList, 0);
}


x86 assembly (clang, -O0):
<spaceSaverAddMulti>:
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
xor    %ecx,%ecx
call   1030 <spaceSaverAddOverflowMulti@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spaceSaverAddMulti>:
xor    %ecx,%ecx
jmp    1030 <spaceSaverAddOverflowMulti@plt>

LLVM IR (-O0):
%struct.spaceSaver = type { i32 }
%struct.spaceRange = type { i32 }
%struct.spaceNode = type { i32 }
define %struct.spaceNode* @spaceSaverAddMulti(%struct.spaceSaver* %0, %struct.spaceRange* %1, %struct.spaceNode* %2) {
%4 = alloca %struct.spaceSaver*
%5 = alloca %struct.spaceRange*
%6 = alloca %struct.spaceNode*
store %struct.spaceSaver* %0, %struct.spaceSaver** %4
store %struct.spaceRange* %1, %struct.spaceRange** %5
store %struct.spaceNode* %2, %struct.spaceNode** %6
%7 = load %struct.spaceSaver*, %struct.spaceSaver** %4
%8 = load %struct.spaceRange*, %struct.spaceRange** %5
%9 = load %struct.spaceNode*, %struct.spaceNode** %6
%10 = call %struct.spaceNode* @spaceSaverAddOverflowMulti(%struct.spaceSaver* %7, %struct.spaceRange* %8, %struct.spaceNode* %9, i32 0)
ret %struct.spaceNode* %10
}

LLVM IR (-O2):
%struct.spaceSaver = type { i32 }
%struct.spaceRange = type { i32 }
%struct.spaceNode = type { i32 }
define %struct.spaceNode* @spaceSaverAddMulti(%struct.spaceSaver* %0, %struct.spaceRange* %1, %struct.spaceNode* %2) {
%4 = tail call %struct.spaceNode* @spaceSaverAddOverflowMulti(%struct.spaceSaver* %0, %struct.spaceRange* %1, %struct.spaceNode* %2, i32 0)
ret %struct.spaceNode* %4
}
int net_hashmap_core_module_destroy(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @net_hashmap_core_module_destroy() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ decimalToBinary(long, int /*<<< orphan*/, int, char *);
scalar_t__ pow(int, int);
void excess(long n, int size, char result[size + 1]) {
  long bias = (long)pow(2, size - 1) - 1;
  n += bias;
  result[size] = '\0';
  decimalToBinary(n, 0, size, result);
}


x86 assembly (clang, -O0):
<excess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %esi,%esi
call   1030 <decimalToBinary@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<excess>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r15
lea    -0x1(%rbx),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
lea    (%r15,%rax,1),%rdi
add    $0xffffffffffffffff,%rdi
movslq %ebx,%rdx
movb   $0x0,(%r14,%rdx,1)
xor    %esi,%esi
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <decimalToBinary@plt>

LLVM IR (-O0):
define void @excess(i64 %0, i32 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i64 %0, i64* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %5
%9 = add nsw i32 %8, 1
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = call i64 @pow(i32 2, i32 %12)
%14 = sub nsw i64 %13, 1
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = load i64, i64* %4
%17 = add nsw i64 %16, %15
store i64 %17, i64* %4
%18 = load i8*, i8** %6
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i64, i64* %4
%23 = load i32, i32* %5
%24 = load i8*, i8** %6
%25 = call i32 @decimalToBinary(i64 %22, i32 0, i32 %23, i8* %24)
ret void
}

LLVM IR (-O2):
define void @excess(i64 %0, i32 %1, i8* %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i64 @pow(i32 2, i32 %4)
%6 = add i64 %0, -1
%7 = add i64 %6, %5
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds i8, i8* %2, i64 %8
store i8 0, i8* %9
%10 = tail call i32 @decimalToBinary(i64 %7, i32 0, i32 %1, i8* %2)
ret void
}
int main(int argc, char **argv) {
  void *ptr;
  unsigned long dst;
  unsigned long src = ~0;
  ptr = __builtin_memcpy(&dst, &src, sizeof(dst));
  (void)ptr;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xffffffffffffffff,-0x28(%rbp)
ff
lea    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int is_hex(char c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'); }


x86 assembly (clang, -O0):
<is_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <is_hex+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    114e <is_hex+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <is_hex+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_hex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
add    $0x9f,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_hex(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 i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 102
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @is_hex(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = add i8 %0, -97
%5 = icmp ult i8 %4, 6
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int lucas(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  scanf("%d", &number);
  printf("The Lucas number at position %d is %d", number, lucas(number));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <lucas@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1050 <lucas@plt>
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [38 x i8] c"The Lucas number at position %d is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @lucas(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [38 x i8] c"The Lucas number at position %d is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @lucas(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage:\n"
         "  penlogd [options] port\n"
         "\n"
         "  -d        debugging on\n"
         "  -f        stay in foreground\n"
         "  -j dir    run in chroot\n"
         "  -l file   write log to file\n"
         "  -b        unbuffer output (Testing Only!)\n"
         "  -n N      number of pen log entries to cache [1000]\n"
         "  -p file   write pid to file\n"
         "  -u user   run as alternative user\n");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [310 x i8] c"Usage:\0A penlogd [options] port\0A\0A -d debugging on\0A -f stay in foreground\0A -j dir run in chroot\0A -l file write log to file\0A -b unbuffer output (Testing Only!)\0A -n N number of pen log entries to cache [1000]\0A -p file write pid to file\0A -u user run as alternative user\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([310 x i8], [310 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [309 x i8] c"Usage:\0A penlogd [options] port\0A\0A -d debugging on\0A -f stay in foreground\0A -j dir run in chroot\0A -l file write log to file\0A -b unbuffer output (Testing Only!)\0A -n N number of pen log entries to cache [1000]\0A -p file write pid to file\0A -u user run as alternative user\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([309 x i8], [309 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}