xunge/DecIR huggingface dataset:
/* Variables and functions */
void append_hexdigit(char *valbuf, size_t sizeof_valbuf, size_t *r_vallen,
                     unsigned n) {
  if (n && *r_vallen + 1 < sizeof_valbuf)
    valbuf[(*r_vallen)++] = "0123456789ABCDEF"[n];
}


x86 assembly (clang, -O0):
<append_hexdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1159 <append_hexdigit+0x59>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
cmp    -0x10(%rbp),%rax
jae    1159 <append_hexdigit+0x59>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
lea    0xec2(%rip),%rax
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rsi
mov    (%rsi),%rcx
mov    %rcx,%rdi
add    $0x1,%rdi
mov    %rdi,(%rsi)
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_hexdigit>:
test   %ecx,%ecx
je     1123 <append_hexdigit+0x23>
mov    (%rdx),%r8
lea    0x1(%r8),%rax
cmp    %rsi,%rax
jae    1123 <append_hexdigit+0x23>
mov    %ecx,%ecx
lea    0xee7(%rip),%rsi
mov    (%rcx,%rsi,1),%cl
mov    %rax,(%rdx)
mov    %cl,(%rdi,%r8,1)
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define void @append_hexdigit(i8* %0, i64 %1, i64* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64* %2, i64** %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %4
%12 = load i64*, i64** %7
%13 = load i64, i64* %12
%14 = add i64 %13, 1
%15 = load i64, i64* %6
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load i32, i32* %8
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = load i8*, i8** %5
%23 = load i64*, i64** %7
%24 = load i64, i64* %23
%25 = add i64 %24, 1
store i64 %25, i64* %23
%26 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 %21, i8* %26
br label %27
27: ; preds = %17, %11, %4
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define void @append_hexdigit(i8* nocapture writeonly %0, i64 %1, i64* nocapture %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = load i64, i64* %2
%8 = add i64 %7, 1
%9 = icmp ult i64 %8, %1
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = zext i32 %3 to i64
%12 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %11
%13 = load i8, i8* %12
store i64 %8, i64* %2
%14 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 %13, i8* %14
br label %15
15: ; preds = %10, %6, %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int AF_INET;
int AF_LOCAL;
int AF_UNIX;
int SOCK_DGRAM;
int SOCK_RAW;
int SOCK_RDM;
int SOCK_SEQPACKET;
int SOCK_STREAM;
int /*<<< orphan*/ socket(int, int, int);
ssize_t test(void) {
  int domain;
  int type;
  int protocol = 1;
  domain = AF_UNIX;
  domain = AF_LOCAL;
  domain = AF_INET;
  type = SOCK_STREAM;
  type = SOCK_DGRAM;
  type = SOCK_SEQPACKET;
  type = SOCK_RAW;
  type = SOCK_RDM;
  return socket(domain, type, protocol);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0xc(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <socket@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edx
jmp    1030 <socket@plt>

LLVM IR (-O0):
@AF_UNIX = global i32 0
@AF_LOCAL = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SOCK_DGRAM = global i32 0
@SOCK_SEQPACKET = global i32 0
@SOCK_RAW = global i32 0
@SOCK_RDM = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %3
%4 = load i32, i32* @AF_UNIX
store i32 %4, i32* %1
%5 = load i32, i32* @AF_LOCAL
store i32 %5, i32* %1
%6 = load i32, i32* @AF_INET
store i32 %6, i32* %1
%7 = load i32, i32* @SOCK_STREAM
store i32 %7, i32* %2
%8 = load i32, i32* @SOCK_DGRAM
store i32 %8, i32* %2
%9 = load i32, i32* @SOCK_SEQPACKET
store i32 %9, i32* %2
%10 = load i32, i32* @SOCK_RAW
store i32 %10, i32* %2
%11 = load i32, i32* @SOCK_RDM
store i32 %11, i32* %2
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @socket(i32 %12, i32 %13, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
@AF_UNIX = global i32 0
@AF_LOCAL = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SOCK_DGRAM = global i32 0
@SOCK_SEQPACKET = global i32 0
@SOCK_RAW = global i32 0
@SOCK_RDM = global i32 0
define i32 @test() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_RDM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 1)
ret i32 %3
}
unsigned long GetMaxUnsignedLong(void) { return ((unsigned long)-1); }


x86 assembly (clang, -O0):
<GetMaxUnsignedLong>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMaxUnsignedLong>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @GetMaxUnsignedLong() {
ret i64 -1
}

LLVM IR (-O2):
define i64 @GetMaxUnsignedLong() {
ret i64 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void WhatWeapon(int weapon) {
  if (weapon == 1)
    printf("Rock");
  if (weapon == 2)
    printf("Scissor");
  if (weapon == 3)
    printf("Papper");
  return;
}


x86 assembly (clang, -O0):
<WhatWeapon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1131 <WhatWeapon+0x21>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    1147 <WhatWeapon+0x37>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
jne    115d <WhatWeapon+0x4d>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WhatWeapon>:
add    $0xffffffff,%edi
cmp    $0x2,%edi
ja     112e <WhatWeapon+0x1e>
movslq %edi,%rax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1030 <printf@plt>
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"Rock\00"
@.str.1 = [8 x i8] c"Scissor\00"
@.str.2 = [7 x i8] c"Papper\00"
@reltable.WhatWeapon = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.WhatWeapon to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.WhatWeapon to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.WhatWeapon to i64)) to i32)]
define void @WhatWeapon(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.WhatWeapon to i8*), i64 %6)
%8 = tail call i32 @printf(i8* dereferenceable(1) %7)
br label %9
9: ; preds = %1, %4
ret void
}
int maximo(int a, int b) { return (a > b) ? a : b; }


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

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

LLVM IR (-O0):
define i32 @maximo(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 @maximo(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int round_up(int remainder, int width, int multiple) {
  if (multiple > remainder || width <= multiple)
    return width;
  width = (width + multiple - 1) / multiple;
  width = width * multiple;
  return width;
}


x86 assembly (clang, -O0):
<round_up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1125 <round_up+0x25>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1130 <round_up+0x30>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <round_up+0x50>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up>:
cmp    %edi,%edx
jg     1116 <round_up+0x16>
mov    %edx,%ecx
cmp    %edx,%esi
jle    1116 <round_up+0x16>
add    %ecx,%esi
add    $0xffffffff,%esi
mov    %esi,%eax
cltd
idiv   %ecx
sub    %edx,%esi
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @round_up(i32 %0, i32 %1, i32 %2) {
%4 = icmp sle i32 %2, %0
%5 = icmp sgt i32 %1, %2
%6 = and i1 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = add nsw i32 %1, -1
%9 = add i32 %8, %2
%10 = srem i32 %9, %2
%11 = sub i32 %9, %10
br label %12
12: ; preds = %3, %7
%13 = phi i32 [ %11, %7 ], [ %1, %3 ]
ret i32 %13
}
void INI_Rename_SocketClientCtx() { ; }


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

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

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

LLVM IR (-O2):
define void @INI_Rename_SocketClientCtx() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(size_t);
int wcslen(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *wmemcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                            size_t);
wchar_t *wcsdup(const wchar_t *str) {
  wchar_t *copy;
  size_t len;
  ;
  len = wcslen(str) + 1;
  copy = malloc(len * sizeof(wchar_t));
  if (!copy) {
    return NULL;
  }
  return wmemcpy(copy, str, len);
}


x86 assembly (clang, -O0):
<wcsdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <wcslen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1177 <wcsdup+0x47>
movq   $0x0,-0x8(%rbp)
jmp    118c <wcsdup+0x5c>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <wmemcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <wcslen@plt>
movslq %eax,%rbx
lea    0x4(,%rbx,4),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     116a <wcsdup+0x3a>
add    $0x1,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <wmemcpy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32* @wcsdup(i32* %0) {
%2 = tail call i32 @wcslen(i32* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = shl nsw i64 %4, 2
%6 = tail call i32* @malloc(i64 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32* @wmemcpy(i32* %6, i32* %0, i64 %4)
br label %10
10: ; preds = %1, %8
%11 = phi i32* [ %9, %8 ], [ null, %1 ]
ret i32* %11
}
/* Variables and functions */
scalar_t__ Grab_Message_8qm5();
int /*<<< orphan*/ Tiff_Error_String();
int /*<<< orphan*/ sprintf(int /*<<< orphan*/, char *, char *);
int error(char *message) {
  if (Grab_Message_8qm5())
    sprintf(Tiff_Error_String(), "%s", message);
  return (1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <Grab_Message_8qm5@plt>
cmp    $0x0,%rax
je     1166 <error+0x36>
mov    $0x0,%al
call   1030 <Tiff_Error_String@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1040 <sprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <Grab_Message_8qm5@plt>
test   %rax,%rax
je     1158 <error+0x28>
xor    %eax,%eax
call   1030 <Tiff_Error_String@plt>
lea    0xeb2(%rip),%rsi
mov    %eax,%edi
mov    %rbx,%rdx
call   1040 <sprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @Grab_Message_8qm5()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 (...) @Tiff_Error_String()
%7 = load i8*, i8** %2
%8 = call i32 @sprintf(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %5, %1
ret i32 1
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @error(i8* %0) {
%2 = tail call i64 (...) @Grab_Message_8qm5()
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 (...) @Tiff_Error_String()
%6 = tail call i32 @sprintf(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %4, %1
ret i32 1
}
/* Variables and functions */
size_t strlen(const char *str) {
  const char *begin = str;
  while (*str++)
    ;
  return str - begin - 1;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     112d <strlen+0x2d>
jmp    1110 <strlen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = xor i64 %9, -1
%11 = add i64 %8, %10
ret i64 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ const *);
int strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, int);
void timestamp(int fd) {
  time_t now;
  struct tm *time_struct;
  int length;
  char time_buffer[40];
  time(&now);
  time_struct = localtime((const time_t *)&now);
  length = strftime(time_buffer, 40, "%m/%d/%Y %H:%M:%S> ", time_struct);
  write(fd, time_buffer, length);
}


x86 assembly (clang, -O0):
<timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <time@plt>
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x28,%esi
lea    0xe8b(%rip),%rdx
call   1060 <strftime@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <write@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestamp>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %edi,%ebp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe9c(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%m/%d/%Y %H:%M:%S> \00"
define void @timestamp(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = alloca i32
%6 = alloca [40 x i8]
store i32 %0, i32* %2
%7 = call i32 @time(i32* %3)
%8 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %8, %struct.tm** %4
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %6, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %4
%11 = call i32 @strftime(i8* %9, i32 40, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = getelementptr inbounds [40 x i8], [40 x i8]* %6, i64 0, i64 0
%14 = load i32, i32* %5
%15 = call i32 @write(i32 %12, i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%m/%d/%Y %H:%M:%S> \00"
define void @timestamp(i32 %0) {
%2 = alloca i32
%3 = alloca [40 x i8]
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%6 = call i32 @time(i32* %2)
%7 = call %struct.tm* @localtime(i32* %2)
%8 = call i32 @strftime(i8* %5, i32 40, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
%9 = call i32 @write(i32 %0, i8* %5, i32 %8)
ret void
}
/* Variables and functions */
int *malloc(int);
int *calls_malloc(void) { return malloc(sizeof(int)); }


x86 assembly (clang, -O0):
<calls_malloc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <malloc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<calls_malloc>:
mov    $0x4,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @calls_malloc() {
%1 = call i32* @malloc(i32 4)
ret i32* %1
}

LLVM IR (-O2):
define noalias i32* @calls_malloc() {
%1 = tail call i32* @malloc(i32 4)
ret i32* %1
}
long _atomic_lock_stub(volatile long *lck) { return (0L); }


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

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

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

LLVM IR (-O2):
define i64 @_atomic_lock_stub(i64* nocapture readnone %0) {
ret i64 0
}
int main(void) {
  int a = 5;
  int b = 6;
  int c = 20;
  while (a <= 100) {
    int i;
    a = b;
    for (i = 0; i <= 12; i++) {
      a++;
    }
    b = b + c;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
movl   $0x14,-0x10(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1166 <main+0x66>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jg     1158 <main+0x58>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <main+0x37>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1120 <main+0x20>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
double test_log10(double x) { return __builtin_log10(x); }


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

x86 assembly (clang, -O2):
<test_log10>:
jmp    1030 <log10@plt>

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

LLVM IR (-O2):
define double @test_log10(double %0) {
%2 = tail call double @log10(double %0)
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ by_ptr_mm(int /*<<< orphan*/);
int /*<<< orphan*/ sub();
void sub_by_ptr_mm(uint32_t x) {
  by_ptr_mm(x);
  sub();
}


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

x86 assembly (clang, -O2):
<sub_by_ptr_mm>:
push   %rax
call   1030 <by_ptr_mm@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <sub@plt>

LLVM IR (-O0):
define void @sub_by_ptr_mm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @by_ptr_mm(i32 %3)
%5 = call i32 (...) @sub()
ret void
}

LLVM IR (-O2):
define void @sub_by_ptr_mm(i32 %0) {
%2 = tail call i32 @by_ptr_mm(i32 %0)
%3 = tail call i32 (...) @sub()
ret void
}
/* Variables and functions */
int syscall(int, int);
int sleep(int seconds) {
  struct {
    unsigned int tv_sec;
    unsigned int tv_usec;
  } ts;
  ts.tv_sec = seconds;
  ts.tv_usec = 0;
  return syscall(162, (int)&ts);
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x10(%rbp),%rax
mov    %eax,%esi
mov    $0xa2,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep>:
push   %rax
mov    %edi,(%rsp)
movl   $0x0,0x4(%rsp)
mov    %rsp,%rsi
mov    $0xa2,%edi
call   1030 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32 }
define i32 @sleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 1
store i32 0, i32* %6
%7 = ptrtoint %struct.anon* %3 to i32
%8 = call i32 @syscall(i32 162, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.anon = type { i32, i32 }
define i32 @sleep(i32 %0) {
%2 = alloca %struct.anon
%3 = bitcast %struct.anon* %2 to i8*
%4 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 0
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 1
store i32 0, i32* %5
%6 = ptrtoint %struct.anon* %2 to i64
%7 = trunc i64 %6 to i32
%8 = call i32 @syscall(i32 162, i32 %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_read_error(void) {
  fprintf(stderr, ("End of data collecting unexpected\n"));
  exit(3);
}


x86 assembly (clang, -O0):
<print_read_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_read_error>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"End of data collecting unexpected\0A\00"
define void @print_read_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"End of data collecting unexpected\0A\00"
define void @print_read_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *argv0) { printf("Usage: %s <process id>\n", argv0); }


x86 assembly (clang, -O0):
<usage>:
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):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: %s <process id>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: %s <process id>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
double square(double i) { return i * i; }


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @square(double %0) {
%2 = fmul double %0, %0
ret double %2
}
long double ldexpl(long double x, int n) { return __builtin_ldexpl(x, n); }


x86 assembly (clang, -O0):
<ldexpl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %edi,-0x14(%rbp)
fldt   -0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ldexpl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define x86_fp80 @ldexpl(x86_fp80 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
/* Type definitions */
struct terminal {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ move_cursor(struct terminal *, int, int /*<<< orphan*/);
void reverse_nl(struct terminal *term) { move_cursor(term, -1, 0); }


x86 assembly (clang, -O0):
<reverse_nl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1030 <move_cursor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_nl>:
mov    $0xffffffff,%esi
xor    %edx,%edx
jmp    1030 <move_cursor@plt>

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

LLVM IR (-O2):
%struct.terminal = type { i32 }
define void @reverse_nl(%struct.terminal* %0) {
%2 = tail call i32 @move_cursor(%struct.terminal* %0, i32 -1, i32 0)
ret void
}
/* Variables and functions */
int cut_rod(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int p[] = {0, 1, 5, 8, 9, 10, 17, 17, 20, 24, 30};
  int max;
  max = cut_rod(p, 12);
  printf("the max:%d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xc,%esi
call   1050 <cut_rod@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movups 0xef1(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xc,%esi
call   1040 <cut_rod@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.p = [11 x i32] [i32 0, i32 1, i32 5, i32 8, i32 9, i32 10, i32 17, i32 17, i32 20, i32 24, i32 30]
@.str = [12 x i8] c"the max:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [11 x i32]* %2 to i8*
%5 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%6 = call i32 @cut_rod(i32* %5, i32 12)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.p = [11 x i32] [i32 0, i32 1, i32 5, i32 8, i32 9, i32 10, i32 17, i32 17, i32 20, i32 24, i32 30]
@.str = [12 x i8] c"the max:%d\0A\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @cut_rod(i32* %3, i32 12)
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int mystery() {
  srand(time(NULL));
  return rand();
}


x86 assembly (clang, -O0):
<mystery>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystery>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <rand@plt>

LLVM IR (-O0):
define i32 @mystery() {
%1 = call i32 @time(i32* null)
%2 = call i32 @srand(i32 %1)
%3 = call i32 (...) @rand()
ret i32 %3
}

LLVM IR (-O2):
define i32 @mystery() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
ret i32 %3
}
void foo384() {}


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

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

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

LLVM IR (-O2):
define void @foo384() {
ret void
}
float obdConvert_1F(unsigned int A, unsigned int B, unsigned int C,
                    unsigned int D) {
  return (float)A * 256.0f + (float)B;
}


x86 assembly (clang, -O0):
<obdConvert_1F>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2ss %rax,%xmm0
mov    -0x8(%rbp),%eax
cvtsi2ss %rax,%xmm1
movss  0xed8(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obdConvert_1F>:
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
mov    %esi,%eax
cvtsi2ss %rax,%xmm1
mulss  0xeea(%rip),%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @obdConvert_1F(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = uitofp i32 %9 to float
%11 = load i32, i32* %6
%12 = uitofp i32 %11 to float
%13 = call float @llvm.fmuladd.f32(float %10, float 2.560000e+02, float %12)
ret float %13
}

LLVM IR (-O2):
define float @obdConvert_1F(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = uitofp i32 %0 to float
%6 = uitofp i32 %1 to float
%7 = tail call float @llvm.fmuladd.f32(float %5, float 2.560000e+02, float %6)
ret float %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *);
void usage(const char *arg, FILE *stream) {
  const char *usage_string =
      "--ip IPv6 --iface IFACE --server-id SERVER_ID --client-id CLIENT_ID "
      "--iaid IAID [--dry-run] | --help";
  fprintf(stream, "Usage: %s %s\n", arg, usage_string);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xf27(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rsi,%rax
mov    %rdi,%rdx
lea    0xf48(%rip),%rsi
lea    0xedc(%rip),%rcx
mov    %rax,%rdi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [101 x i8] c"--ip IPv6 --iface IFACE --server-id SERVER_ID --client-id CLIENT_ID --iaid IAID [--dry-run] | --help\00"
@.str.1 = [14 x i8] c"Usage: %s %s\0A\00"
define void @usage(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
store i8* %0, i8** %3
store i32* %1, i32** %4
store i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i32*, i32** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %5
%9 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [101 x i8] c"--ip IPv6 --iface IFACE --server-id SERVER_ID --client-id CLIENT_ID --iaid IAID [--dry-run] | --help\00"
@.str.1 = [14 x i8] c"Usage: %s %s\0A\00"
define void @usage(i8* %0, i32* nocapture %1) {
%3 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SN_close_env(struct SN_env *);
extern void porter_close_env(struct SN_env *z) { SN_close_env(z); }


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

x86 assembly (clang, -O2):
<porter_close_env>:
jmp    1030 <SN_close_env@plt>

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

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define void @porter_close_env(%struct.SN_env* %0) {
%2 = tail call i32 @SN_close_env(%struct.SN_env* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void program_death() { printf("0"); }


x86 assembly (clang, -O0):
<program_death>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<program_death>:
mov    $0x30,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
define void @program_death() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @program_death() {
%1 = tail call i32 @putchar(i32 48)
ret void
}
long GPU_getScreenPic(unsigned char *pMem) { return -1; }


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

x86 assembly (clang, -O2):
<GPU_getScreenPic>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @GPU_getScreenPic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i64 -1
}

LLVM IR (-O2):
define i64 @GPU_getScreenPic(i8* nocapture readnone %0) {
ret i64 -1
}
/* Variables and functions */
size_t __GetStructureFieldIndex(const char *structure_name,
                                const char *field_name) {
  (void)structure_name;
  (void)field_name;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i64 @__GetStructureFieldIndex(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ free1(float *);
void free1float(float *p) { free1(p); }


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

x86 assembly (clang, -O2):
<free1float>:
jmp    1030 <free1@plt>

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

LLVM IR (-O2):
define void @free1float(float* %0) {
%2 = tail call i32 @free1(float* %0)
ret void
}
void I422ToARGBRow_AVX2() {}


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

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

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

LLVM IR (-O2):
define void @I422ToARGBRow_AVX2() {
ret void
}
int strcmp(const char *__s1, const char *__s2) {
  while (*__s1 && *__s1 == *__s2) {
    __s1++;
    __s2++;
  }
  return (*__s1 - *__s2);
  ;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strcmp+0x47>
jmp    1164 <strcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <strcmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <strcmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <strcmp+0x10>
xor    %eax,%eax
movsbl %al,%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = sext i8 %18 to i32
%20 = load i8, i8* %17
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
float f_to_c(float value) { return (value - 32) * 0.555555556f; }


x86 assembly (clang, -O0):
<f_to_c>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeee(%rip),%xmm1
subss  %xmm1,%xmm0
movss  0xede(%rip),%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_to_c>:
addss  0xef8(%rip),%xmm0
mulss  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define float @f_to_c(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fsub float %3, 3.200000e+01
%5 = fmul float %4, 0x3FE1C71C80000000
ret float %5
}

LLVM IR (-O2):
define float @f_to_c(float %0) {
%2 = fadd float %0, -3.200000e+01
%3 = fmul float %2, 0x3FE1C71C80000000
ret float %3
}
/* Variables and functions */
int rom_present(char *);
int cpqega_standalone_available(void) {
  return rom_present(L"roms/video/ega/108281-001.bin");
}


x86 assembly (clang, -O0):
<cpqega_standalone_available>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <rom_present@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpqega_standalone_available>:
lea    0xee9(%rip),%rdi
jmp    1030 <rom_present@plt>

LLVM IR (-O0):
@.str = [30 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 101, i32 103, i32 97, i32 47, i32 49, i32 48, i32 56, i32 50, i32 56, i32 49, i32 45, i32 48, i32 48, i32 49, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @cpqega_standalone_available() {
%1 = call i32 @rom_present(i8* bitcast ([30 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [30 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 101, i32 103, i32 97, i32 47, i32 49, i32 48, i32 56, i32 50, i32 56, i32 49, i32 45, i32 48, i32 48, i32 49, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @cpqega_standalone_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([30 x i32]* @.str to i8*))
ret i32 %1
}
/* Type definitions */
struct tbst_table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *tbst_delete(struct tbst_table *, void *);
void *(tbst_assert_delete)(struct tbst_table *table, void *item) {
  void *p = tbst_delete(table, item);
  assert(p != NULL);
  return p;
}


x86 assembly (clang, -O0):
<tbst_assert_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <tbst_delete@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tbst_assert_delete>:
push   %rbx
call   1030 <tbst_delete@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tbst_table = type { i32 }
define i8* @tbst_assert_delete(%struct.tbst_table* %0, i8* %1) {
%3 = alloca %struct.tbst_table*
%4 = alloca i8*
%5 = alloca i8*
store %struct.tbst_table* %0, %struct.tbst_table** %3
store i8* %1, i8** %4
%6 = load %struct.tbst_table*, %struct.tbst_table** %3
%7 = load i8*, i8** %4
%8 = call i8* @tbst_delete(%struct.tbst_table* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
%struct.tbst_table = type { i32 }
define i8* @tbst_assert_delete(%struct.tbst_table* %0, i8* %1) {
%3 = tail call i8* @tbst_delete(%struct.tbst_table* %0, i8* %1)
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret i8* %3
}