xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ warnx(char *, char const *);
void usage(const char *cp) {
  if (cp != NULL)
    warnx("%s", cp);
  (void)fprintf(stderr, "usage: shutdown [-] [-h | -p | -r | -k] [-o [-n]] "
                        "time [warning-message ...]\n"
                        "       poweroff\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1157 <usage+0x27>
mov    -0x8(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <warnx@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
test   %rdi,%rdi
je     1145 <usage+0x15>
mov    %rdi,%rsi
lea    0xec0(%rip),%rdi
call   1030 <warnx@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@stderr = global i32 0
@.str.1 = [94 x i8] c"usage: shutdown [-] [-h | -p | -r | -k] [-o [-n]] time [warning-message ...]\0A poweroff\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @warnx(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@stderr = global i32 0
@.str.1 = [94 x i8] c"usage: shutdown [-] [-h | -p | -r | -k] [-o [-n]] time [warning-message ...]\0A poweroff\0A\00"
define void @usage(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @warnx(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %3, %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ rm(char *);
int /*<<< orphan*/ sm(char *);
void deccolm(int flag) {
  if (flag)
    sm("?3");
  else
    rm("?3");
}


x86 assembly (clang, -O0):
<deccolm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1146 <deccolm+0x26>
lea    0xec4(%rip),%rdi
call   1040 <sm@plt>
jmp    1152 <deccolm+0x32>
lea    0xeb3(%rip),%rdi
call   1030 <rm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deccolm>:
test   %edi,%edi
je     1130 <deccolm+0x10>
lea    0xed5(%rip),%rdi
jmp    1040 <sm@plt>
lea    0xec9(%rip),%rdi
jmp    1030 <rm@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"?3\00"
define void @deccolm(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @sm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 @rm(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
char *realloc(char *, int);
int strlen(char *);
void concat_char(char **dst, char c) {
  int len = strlen(*dst);
  *dst = realloc(*dst, len + 2);
  (*dst)[len] = c;
  (*dst)[len + 1] = '\0';
}


x86 assembly (clang, -O0):
<concat_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%esi
add    $0x2,%esi
call   1040 <realloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat_char>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    (%rbx),%rdi
lea    0x2(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,(%rbx)
movslq %ebp,%rcx
mov    %r14b,(%rax,%rcx,1)
mov    (%rbx),%rax
movb   $0x0,0x1(%rcx,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @concat_char(i8** nocapture %0, i8 signext %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strlen(i8* %3)
%5 = load i8*, i8** %0
%6 = add nsw i32 %4, 2
%7 = tail call i8* @realloc(i8* %5, i32 %6)
store i8* %7, i8** %0
%8 = sext i32 %4 to i64
%9 = getelementptr inbounds i8, i8* %7, i64 %8
store i8 %1, i8* %9
%10 = load i8*, i8** %0
%11 = add nsw i32 %4, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
store i8 0, i8* %13
ret void
}
unsigned short fold_short(unsigned long sum) {
  sum = (sum >> 16) + (sum & 0xffff);
  sum += (sum >> 16);
  return (unsigned short)(sum & 0xffff);
}


x86 assembly (clang, -O0):
<fold_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    -0x8(%rbp),%rcx
and    $0xffff,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fold_short>:
movzwl %di,%eax
shr    $0x10,%rdi
add    %eax,%edi
mov    %edi,%eax
shr    $0x10,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @fold_short(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = load i64, i64* %2
%6 = and i64 %5, 65535
%7 = add i64 %4, %6
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = lshr i64 %8, 16
%10 = load i64, i64* %2
%11 = add i64 %10, %9
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = and i64 %12, 65535
%14 = trunc i64 %13 to i16
ret i16 %14
}

LLVM IR (-O2):
define zeroext i16 @fold_short(i64 %0) {
%2 = lshr i64 %0, 16
%3 = and i64 %0, 65535
%4 = add nuw nsw i64 %2, %3
%5 = lshr i64 %4, 16
%6 = add nuw nsw i64 %5, %4
%7 = trunc i64 %6 to i16
ret i16 %7
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sigchild_handler(int sig) {
  while (waitpid(-1, NULL, WNOHANG))
    ;
}


x86 assembly (clang, -O0):
<sigchild_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
je     1141 <sigchild_handler+0x31>
jmp    111b <sigchild_handler+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchild_handler>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jne    1120 <sigchild_handler+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @sigchild_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* @WNOHANG
%5 = call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sigchild_handler(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load i32, i32* @WNOHANG
%4 = tail call i64 @waitpid(i32 -1, i32* null, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("This is apue project");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"This is apue project\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"This is apue project\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_check_in_group() {
  printf("NOT IMPLEMENTED:"
         "pa_check_in_group"
         "\n");
}


x86 assembly (clang, -O0):
<pa_check_in_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"NOT IMPLEMENTED:pa_check_in_group\0A\00"
define i32 @pa_check_in_group() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [34 x i8] c"NOT IMPLEMENTED:pa_check_in_group\00"
define i32 @pa_check_in_group() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void swap(long double *a, long double *b) {
  long double temp;
  temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
fstpt  -0x20(%rbp)
mov    -0x10(%rbp),%rax
fldt   (%rax)
mov    -0x8(%rbp),%rax
fstpt  (%rax)
fldt   -0x20(%rbp)
mov    -0x10(%rbp),%rax
fstpt  (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
fldt   (%rdi)
fldt   (%rsi)
fstpt  (%rdi)
fstpt  (%rsi)
ret

LLVM IR (-O0):
define void @swap(x86_fp80* %0, x86_fp80* %1) {
%3 = alloca x86_fp80*
%4 = alloca x86_fp80*
%5 = alloca x86_fp80
store x86_fp80* %0, x86_fp80** %3
store x86_fp80* %1, x86_fp80** %4
%6 = load x86_fp80*, x86_fp80** %3
%7 = load x86_fp80, x86_fp80* %6
store x86_fp80 %7, x86_fp80* %5
%8 = load x86_fp80*, x86_fp80** %4
%9 = load x86_fp80, x86_fp80* %8
%10 = load x86_fp80*, x86_fp80** %3
store x86_fp80 %9, x86_fp80* %10
%11 = load x86_fp80, x86_fp80* %5
%12 = load x86_fp80*, x86_fp80** %4
store x86_fp80 %11, x86_fp80* %12
ret void
}

LLVM IR (-O2):
define void @swap(x86_fp80* nocapture %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = load x86_fp80, x86_fp80* %1
store x86_fp80 %4, x86_fp80* %0
store x86_fp80 %3, x86_fp80* %1
ret void
}
int atoi(const char *nptr) {
  unsigned char base;
  int res;
  base = 10;
  res = 0;
  while (*nptr) {
    if ((nptr[0] >= '0') && (nptr[0] <= '9')) {
      res = res * base + (nptr[0] - '0');
      nptr++;
      continue;
    }
    break;
  }
  return res;
}


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0xa,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     116f <atoi+0x6f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     116a <atoi+0x6a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     116a <atoi+0x6a>
mov    -0x10(%rbp),%eax
movzbl -0x9(%rbp),%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <atoi+0x13>
jmp    116f <atoi+0x6f>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi>:
mov    (%rdi),%cl
lea    -0x30(%rcx),%edx
xor    %eax,%eax
cmp    $0x9,%dl
ja     113b <atoi+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rdi
cmp    $0xa,%dl
jb     1120 <atoi+0x20>
ret

LLVM IR (-O0):
define i32 @atoi(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
store i8* %0, i8** %2
store i8 10, i8* %3
store i32 0, i32* %4
br label %5
5: ; preds = %21, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %35
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 48
br i1 %14, label %15, label %34
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 57
br i1 %20, label %21, label %34
21: ; preds = %15
%22 = load i32, i32* %4
%23 = load i8, i8* %3
%24 = zext i8 %23 to i32
%25 = mul nsw i32 %22, %24
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = sub nsw i32 %29, 48
%31 = add nsw i32 %25, %30
store i32 %31, i32* %4
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %2
br label %5
34: ; preds = %15, %9
br label %35
35: ; preds = %34, %5
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
define i32 @atoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i32 [ %12, %5 ], [ 0, %1 ]
%8 = phi i8* [ %13, %5 ], [ %0, %1 ]
%9 = zext i8 %6 to i32
%10 = mul nsw i32 %7, 10
%11 = add i32 %10, -48
%12 = add i32 %11, %9
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = add i8 %14, -48
%16 = icmp ult i8 %15, 10
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %12, %5 ]
ret i32 %18
}
unsigned long long bitRotLeft(unsigned long long x, unsigned long long y) {
  unsigned long long result;
  result = (x << y) | (x >> (64 - y));
  return result;
}


x86 assembly (clang, -O0):
<bitRotLeft>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    %cl,%rax
mov    -0x8(%rbp),%rdx
mov    $0x40,%ecx
sub    -0x10(%rbp),%rcx
shr    %cl,%rdx
mov    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitRotLeft>:
mov    %rsi,%rcx
mov    %rdi,%rax
rol    %cl,%rax
ret

LLVM IR (-O0):
define i64 @bitRotLeft(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = shl i64 %6, %7
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = sub i64 64, %10
%12 = lshr i64 %9, %11
%13 = or i64 %8, %12
store i64 %13, i64* %5
%14 = load i64, i64* %5
ret i64 %14
}

LLVM IR (-O2):
define i64 @bitRotLeft(i64 %0, i64 %1) {
%3 = shl i64 %0, %1
%4 = sub i64 64, %1
%5 = lshr i64 %0, %4
%6 = or i64 %5, %3
ret i64 %6
}
/* Variables and functions */
int lckpwdf();
int lock_shadow_file() { return lckpwdf(); }


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

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

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

LLVM IR (-O2):
define i32 @lock_shadow_file() {
%1 = tail call i32 (...) @lckpwdf()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("3dsp - 3D Synchronization Profile testing\n"
         "Usage:\n");
  printf("\t3dsp [options]\n");
  printf("options:\n"
         "\t-D, --display          Use display role\n"
         "\t-G, --glasses          Use glasses role\n"
         "\t-i, --index <num>      Use specified controller\n"
         "\t-h, --help             Show help options\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"3dsp - 3D Synchronization Profile testing\0AUsage:\0A\00"
@.str.1 = [17 x i8] c"\093dsp [options]\0A\00"
@.str.2 = [183 x i8] c"options:\0A\09-D, --display Use display role\0A\09-G, --glasses Use glasses role\0A\09-i, --index <num> Use specified controller\0A\09-h, --help Show help options\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [49 x i8] c"3dsp - 3D Synchronization Profile testing\0AUsage:\00"
@str.3 = [16 x i8] c"\093dsp [options]\00"
@str.4 = [182 x i8] c"options:\0A\09-D, --display Use display role\0A\09-G, --glasses Use glasses role\0A\09-i, --index <num> Use specified controller\0A\09-h, --help Show help options\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([182 x i8], [182 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long htonl(unsigned long);
unsigned long host_long_to_network(unsigned long x) { return htonl(x); }


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

x86 assembly (clang, -O2):
<host_long_to_network>:
jmp    1030 <htonl@plt>

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

LLVM IR (-O2):
define i64 @host_long_to_network(i64 %0) {
%2 = tail call i64 @htonl(i64 %0)
ret i64 %2
}
void i2d_ASN1_TIME(void) {}


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

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

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

LLVM IR (-O2):
define void @i2d_ASN1_TIME() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, char const *, int);
int /*<<< orphan*/ stderr;
void __assert_fail(const char *expr, const char *file, int line,
                   const char *func) {
  fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func,
          line);
  fflush(NULL);
  abort();
}


x86 assembly (clang, -O0):
<__assert_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x14(%rbp),%r9d
lea    0xe99(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <fflush@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<__assert_fail>:
push   %rax
mov    %rcx,%r8
mov    %edx,%r9d
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Assertion failed: %s (%s: %s: %d)\0A\00"
define void @__assert_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %8
%13 = load i32, i32* %7
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12, i32 %13)
%15 = call i32 @fflush(i32* null)
%16 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Assertion failed: %s (%s: %s: %d)\0A\00"
define void @__assert_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %3, i32 %2)
%7 = tail call i32 @fflush(i32* null)
%8 = tail call i32 (...) @abort()
unreachable
}
int sys_exit(struct syscall_exit_args *args) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.syscall_exit_args = type opaque
define i32 @sys_exit(%struct.syscall_exit_args* nocapture readnone %0) {
ret i32 1
}
void nn_xpull_out(__attribute__((unused)) struct nn_sockbase *self,
                  __attribute__((unused)) struct nn_pipe *pipe) {}


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

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

LLVM IR (-O0):
%struct.nn_sockbase = type opaque
%struct.nn_pipe = type opaque
define void @nn_xpull_out(%struct.nn_sockbase* %0, %struct.nn_pipe* %1) {
%3 = alloca %struct.nn_sockbase*
%4 = alloca %struct.nn_pipe*
store %struct.nn_sockbase* %0, %struct.nn_sockbase** %3
store %struct.nn_pipe* %1, %struct.nn_pipe** %4
ret void
}

LLVM IR (-O2):
%struct.nn_sockbase = type opaque
%struct.nn_pipe = type opaque
define void @nn_xpull_out(%struct.nn_sockbase* nocapture %0, %struct.nn_pipe* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int fchownat(int, char const *, int /*<<< orphan*/, int /*<<< orphan*/, int);
__attribute__((__weak__, __always___)) int
softboundmpx_fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group,
                      int flags) {
  return fchownat(dirfd, pathname, owner, group, flags);
}


x86 assembly (clang, -O0):
<softboundmpx_fchownat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
call   1030 <fchownat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_fchownat>:
jmp    1030 <fchownat@plt>

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

LLVM IR (-O2):
define weak i32 @softboundmpx_fchownat(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @fchownat(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverseWords(char *);
int main(int argc, char **argv) {
  char s[] = "   a   b  c d   e  ";
  reverseWords(s);
  printf("%s/\n", s);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x202065,0x10(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <reverseWords@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [20 x i8] c" a b c d e \00"
@.str = [5 x i8] c"%s/\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [20 x i8]* %6 to i8*
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%9 = call i32 @reverseWords(i8* %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [20 x i8] c" a b c d e \00"
@.str = [5 x i8] c"%s/\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @reverseWords(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
g(a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @g(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int INT_MAX;
int _drawtext(int, int, int, char const *, int);
void drawtextrange(int x, int xmax, int y, const char *str, uint16_t length) {
  x = _drawtext(x, xmax, y, str, length);
  if (x < 0) {
    _drawtext(-x, INT_MAX, y, (char *)"...", 3);
  }
}


x86 assembly (clang, -O0):
<drawtextrange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <_drawtext@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    116f <drawtextrange+0x5f>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
lea    0xe9c(%rip),%rcx
mov    $0x3,%r8d
call   1030 <_drawtext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawtextrange>:
push   %rbx
mov    %edx,%ebx
call   1030 <_drawtext@plt>
test   %eax,%eax
js     111e <drawtextrange+0xe>
pop    %rbx
ret
neg    %eax
mov    0x2ec1(%rip),%rcx
mov    (%rcx),%esi
lea    0xed0(%rip),%rcx
mov    %eax,%edi
mov    %ebx,%edx
mov    $0x3,%r8d
pop    %rbx
jmp    1030 <_drawtext@plt>

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

LLVM IR (-O2):
@INT_MAX = global i32 0
@.str = [4 x i8] c"...\00"
define void @drawtextrange(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32 @_drawtext(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = sub nsw i32 0, %6
%10 = load i32, i32* @INT_MAX
%11 = tail call i32 @_drawtext(i32 %9, i32 %10, i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
br label %12
12: ; preds = %8, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int open_oom_adj(void) { return open("/proc/self/oom_adj", O_RDWR); }


x86 assembly (clang, -O0):
<open_oom_adj>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <open@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_oom_adj>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <open@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"/proc/self/oom_adj\00"
@O_RDWR = global i32 0
define i32 @open_oom_adj() {
%1 = load i32, i32* @O_RDWR
%2 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [19 x i8] c"/proc/self/oom_adj\00"
@O_RDWR = global i32 0
define i32 @open_oom_adj() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
int tl_calc_nnodes(const int ntaxa) { return 2 * ntaxa - 1; }


x86 assembly (clang, -O0):
<tl_calc_nnodes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tl_calc_nnodes>:
lea    (%rdi,%rdi,1),%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @tl_calc_nnodes(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void check(int okay, char *message) {
  if (!okay) {
    printf("\n\nError. %s.\n", message);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1157 <check+0x37>
mov    -0x10(%rbp),%rsi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
test   %edi,%edi
je     1125 <check+0x5>
ret
push   %rax
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\0A\0AError. %s.\0A\00"
@EXIT_FAILURE = global i32 0
define void @check(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0A\0AError. %s.\0A\00"
@EXIT_FAILURE = global i32 0
define void @check(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
ret void
}
void to_my_2(int value, char *m) {
  m[1] = value >> 8;
  m[0] = value;
}


x86 assembly (clang, -O0):
<to_my_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_my_2>:
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @to_my_2(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 8
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %7, i8* %9
%10 = load i32, i32* %3
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
ret void
}

LLVM IR (-O2):
define void @to_my_2(i32 %0, i8* nocapture writeonly %1) {
%3 = lshr i32 %0, 8
%4 = trunc i32 %3 to i8
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %4, i8* %5
%6 = trunc i32 %0 to i8
store i8 %6, i8* %1
ret void
}
/* Variables and functions */
int sleep(unsigned int);
int /*<<< orphan*/ unix_error(char *);
unsigned int Sleep(unsigned int secs) {
  int rc;
  if ((rc = sleep(secs)) < 0)
    unix_error("Sleep error");
  return rc;
}


x86 assembly (clang, -O0):
<Sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sleep@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    114b <Sleep+0x2b>
lea    0xeba(%rip),%rdi
call   1030 <unix_error@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sleep>:
push   %rbx
call   1040 <sleep@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Sleep+0x18>
lea    0xecd(%rip),%rdi
call   1030 <unix_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Sleep error\00"
define i32 @Sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
int test_imm_68int16_reg(short val) {
  return ((val) & (-0x68 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_68int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff98,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_68int16_reg>:
test   $0xff98,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_68int16_reg(i16 signext %0) {
%2 = and i16 %0, -104
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ log_write(char *, char *, int, int);
int log_info(char *msg, char *sensor) { log_write(msg, sensor, 1, 1); }


x86 assembly (clang, -O0):
<log_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1030 <log_write@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_info>:
mov    $0x1,%edx
mov    $0x1,%ecx
jmp    1030 <log_write@plt>

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

LLVM IR (-O2):
define i32 @log_info(i8* %0, i8* %1) {
%3 = tail call i32 @log_write(i8* %0, i8* %1, i32 1, i32 1)
ret i32 undef
}
/* Type definitions */
struct timeval {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, struct timeval *);
void wait_timeval(struct timeval *towait) {
  select(1, (fd_set *)0, (fd_set *)0, (fd_set *)0, (towait));
}


x86 assembly (clang, -O0):
<wait_timeval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%r8
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_timeval>:
mov    %rdi,%r8
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <select@plt>

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @wait_timeval(%struct.timeval* %0) {
%2 = tail call i32 @select(i32 1, i32* null, i32* null, i32* null, %struct.timeval* %0)
ret void
}
void AbortHandler() {
  for (;;) {
  }
}


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

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

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

LLVM IR (-O2):
define void @AbortHandler() {
br label %1
1: ; preds = %1, %0
br label %1
}
char *hash_plugin_detailed(void) {
  return ("androidpin - Android PIN lock plugin\n"
          "-------------------------------\n"
          "Use this module to crack Android PINs\n"
          "Input should be in form: \'hash:salt\'\n"
          "Hash is usually located in the /data/system/password.key file\n"
          "Salt can be found in the locksettings.db sqlite database and should "
          "be an integer\n"
          "Known software that uses this password hashing method:\n"
          "Android OS\n"
          "\nAuthor: Milen Rangelov <gat3way@gat3way.eu>\n");
}


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

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

LLVM IR (-O0):
@.str = [400 x i8] c"androidpin - Android PIN lock plugin\0A-------------------------------\0AUse this module to crack Android PINs\0AInput should be in form: 'hash:salt'\0AHash is usually located in the /data/system/password.key file\0ASalt can be found in the locksettings.db sqlite database and should be an integer\0AKnown software that uses this password hashing method:\0AAndroid OS\0A\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([400 x i8], [400 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [400 x i8] c"androidpin - Android PIN lock plugin\0A-------------------------------\0AUse this module to crack Android PINs\0AInput should be in form: 'hash:salt'\0AHash is usually located in the /data/system/password.key file\0ASalt can be found in the locksettings.db sqlite database and should be an integer\0AKnown software that uses this password hashing method:\0AAndroid OS\0A\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([400 x i8], [400 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int indexOf_offset(char *, char *, int /*<<< orphan*/);
int indexOf(char *base, char *str) { return indexOf_offset(base, str, 0); }


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

x86 assembly (clang, -O2):
<indexOf>:
xor    %edx,%edx
jmp    1030 <indexOf_offset@plt>

LLVM IR (-O0):
define i32 @indexOf(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
%7 = call i32 @indexOf_offset(i8* %5, i8* %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @indexOf(i8* %0, i8* %1) {
%3 = tail call i32 @indexOf_offset(i8* %0, i8* %1, i32 0)
ret i32 %3
}
int exposed_function(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @exposed_function() {
ret i32 42
}

LLVM IR (-O2):
define i32 @exposed_function() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ aw_dict_test_int();
int /*<<< orphan*/ aw_dict_test_pointer();
void aw_dict_test() {
  aw_dict_test_int();
  aw_dict_test_pointer();
}


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

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

LLVM IR (-O0):
define void @aw_dict_test() {
%1 = call i32 (...) @aw_dict_test_int()
%2 = call i32 (...) @aw_dict_test_pointer()
ret void
}

LLVM IR (-O2):
define void @aw_dict_test() {
%1 = tail call i32 (...) @aw_dict_test_int()
%2 = tail call i32 (...) @aw_dict_test_pointer()
ret void
}
void recursiveFree(char **lines, unsigned int linesCount) {
  for (int i = 0; i < linesCount; i++) {
    free(lines[i]);
  }
  free(lines);
}


x86 assembly (clang, -O0):
<recursiveFree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1151 <recursiveFree+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <recursiveFree+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recursiveFree>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
je     1142 <recursiveFree+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <recursiveFree+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @recursiveFree(i8** nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast i8** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %12, %8 ]
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %8
}
int MinPlus(int x, int y) {
  int min;
  if (x < y) {
    min = x;
  } else {
    min = y;
  }
  return min + 1;
}


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

x86 assembly (clang, -O2):
<MinPlus>:
cmp    %esi,%edi
cmovl  %edi,%esi
lea    0x1(%rsi),%eax
ret

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

LLVM IR (-O2):
define i32 @MinPlus(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = add nsw i32 %4, 1
ret i32 %5
}