xunge/DecIR huggingface dataset:
int str_isnumber(p) const char *p;
{
  char *q = (char *)p;
  while (*q) {
    if (!isdigit(*q))
      return 0;
    q++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<str_isnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <str_isnumber+0x53>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1152 <str_isnumber+0x42>
movl   $0x0,-0x4(%rbp)
jmp    116a <str_isnumber+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <str_isnumber+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_isnumber>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1126 <str_isnumber+0x26>
add    $0x1,%rdi
nop
movsbl %cl,%ecx
add    $0xffffffd0,%ecx
cmp    $0xa,%ecx
jae    1127 <str_isnumber+0x27>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str_isnumber+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @str_isnumber(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %7
4: ; preds = %7
%5 = load i8, i8* %13
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %13, %4 ], [ %0, %1 ]
%10 = sext i8 %8 to i32
%11 = add nsw i32 %10, -48
%12 = icmp ult i32 %11, 10
%13 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %12, label %4, label %14
14: ; preds = %7, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %15
}
int foo(int a) {
  if (a > 3)
    return a;
  return a + foo(a + 1);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    1130 <foo+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <foo+0x3b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <foo@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cmp    $0x3,%edi
jg     112b <foo+0x2b>
mov    $0x3,%ecx
sub    %edi,%ecx
lea    0x1(%rdi),%eax
imul   %ecx,%eax
mov    $0x2,%edx
sub    %edi,%edx
imul   %rcx,%rdx
shr    %rdx
add    %edi,%eax
add    %edx,%eax
mov    $0x4,%edi
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp sgt i32 %0, 3
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = sub i32 3, %0
%5 = add nsw i32 %0, 1
%6 = mul i32 %4, %5
%7 = zext i32 %4 to i33
%8 = sub i32 2, %0
%9 = zext i32 %8 to i33
%10 = mul i33 %7, %9
%11 = lshr i33 %10, 1
%12 = trunc i33 %11 to i32
%13 = add i32 %6, %0
%14 = add i32 %13, %12
br label %15
15: ; preds = %3, %1
%16 = phi i32 [ 0, %1 ], [ %14, %3 ]
%17 = phi i32 [ %0, %1 ], [ 4, %3 ]
%18 = add nsw i32 %17, %16
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ f(double);
void should_fail() { f(2.1); }


x86 assembly (clang, -O0):
<should_fail>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
call   1030 <f@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<should_fail>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @should_fail() {
%1 = call i32 @f(double 2.100000e+00)
ret void
}

LLVM IR (-O2):
define void @should_fail() {
%1 = tail call i32 @f(double 2.100000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  scanf("%d", &x);
  printf("O numero sorteado foi: %d\n", x);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [27 x i8] c"O numero sorteado foi: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ readC(char *, int);
char getchar() {
  char *buffer = malloc(1);
  *buffer = 0;
  while (*buffer == 0) {
    readC(buffer, 1);
  }
  return *buffer;
}


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1160 <getchar+0x40>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <readC@plt>
jmp    113d <getchar+0x1d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
push   %rbx
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <readC@plt>
movzbl (%rbx),%eax
test   %al,%al
je     1140 <getchar+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @getchar() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 1)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
store i8 0, i8* %3
br label %4
4: ; preds = %9, %0
%5 = load i8*, i8** %1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i8*, i8** %1
%11 = call i32 @readC(i8* %10, i32 1)
br label %4
12: ; preds = %4
%13 = load i8*, i8** %1
%14 = load i8, i8* %13
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @getchar() {
%1 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
store i8 0, i8* %1
br label %2
2: ; preds = %0, %2
%3 = tail call i32 @readC(i8* %1, i32 1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("\navailable commands: ");
  printf("\n\t0|hi - say hi to the world");
  printf("\n\t1|bye - say bye to the world");
  printf("\n\t255|shutdown - shutdown machine");
}


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

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"\0Aavailable commands: \00"
@.str.1 = [29 x i8] c"\0A\090|hi - say hi to the world\00"
@.str.2 = [31 x i8] c"\0A\091|bye - say bye to the world\00"
@.str.3 = [34 x i8] c"\0A\09255|shutdown - shutdown machine\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"\0Aavailable commands: \00"
@.str.1 = [29 x i8] c"\0A\090|hi - say hi to the world\00"
@.str.2 = [31 x i8] c"\0A\091|bye - say bye to the world\00"
@.str.3 = [34 x i8] c"\0A\09255|shutdown - shutdown machine\00"
define void @help() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Type definitions */
struct crypt_data {
  int dummy;
};

/* Variables and functions */
char *__crypt_r(char const *, char const *, struct crypt_data *);
char *crypt(const char *key, const char *salt) {
  static char buf[64];
  return __crypt_r(key, salt, (struct crypt_data *)buf);
}


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

x86 assembly (clang, -O2):
<crypt>:
lea    0x2f29(%rip),%rdx
jmp    1030 <__crypt_r@plt>

LLVM IR (-O0):
%struct.crypt_data = type { i32 }
@crypt.buf = internal global [64 x i8] zeroinitializer
define i8* @crypt(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 i8* @__crypt_r(i8* %5, i8* %6, %struct.crypt_data* bitcast ([64 x i8]* @crypt.buf to %struct.crypt_data*))
ret i8* %7
}

LLVM IR (-O2):
%struct.crypt_data = type { i32 }
@crypt.buf = internal global [64 x i8] zeroinitializer
define i8* @crypt(i8* %0, i8* %1) {
%3 = tail call i8* @__crypt_r(i8* %0, i8* %1, %struct.crypt_data* bitcast ([64 x i8]* @crypt.buf to %struct.crypt_data*))
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ fputc(unsigned int, int /*<<< orphan*/);
int fputs(unsigned int channel, char *str) {
  int written = 0;
  while (*str) {
    fputc(channel, *str++);
    written++;
  }
  return written;
}


x86 assembly (clang, -O0):
<fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <fputs+0x4b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
call   1030 <fputc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <fputs+0x16>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputs>:
push   %rbp
push   %r14
push   %rbx
mov    (%rsi),%al
test   %al,%al
je     114a <fputs+0x3a>
mov    %rsi,%r14
mov    %edi,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %ebp,%edi
call   1030 <fputc@plt>
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <fputs+0x20>
jmp    114c <fputs+0x3c>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fputs(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = sext i8 %6 to i32
%11 = tail call i32 @fputc(i32 %0, i32 %10)
%12 = add nuw nsw i32 %7, 1
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ url_init_tree();
void child_SIGUSR2(int sig) {
  if (url_init_tree() != 0) {
    printf("[URL filter]:\t? "
           "URL: not update URL hash tree from signal -> %d"
           "\n",
           sig);
  }
}


x86 assembly (clang, -O0):
<child_SIGUSR2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <url_init_tree@plt>
cmp    $0x0,%rax
je     114b <child_SIGUSR2+0x2b>
mov    -0x4(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_SIGUSR2>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <url_init_tree@plt>
test   %rax,%rax
je     113e <child_SIGUSR2+0x1e>
lea    0xeca(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [65 x i8] c"[URL filter]:\09? URL: not update URL hash tree from signal -> %d\0A\00"
define void @child_SIGUSR2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @url_init_tree()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [65 x i8] c"[URL filter]:\09? URL: not update URL hash tree from signal -> %d\0A\00"
define void @child_SIGUSR2(i32 %0) {
%2 = tail call i64 (...) @url_init_tree()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int);
double libt_now(void) {
  struct timespec t;
  if (clock_gettime(CLOCK_MONOTONIC, &t) < 0)
    exit(1);
  return t.tv_sec + (t.tv_nsec / 1e9);
}


x86 assembly (clang, -O0):
<libt_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0x0,%rax
jge    114e <libt_now+0x2e>
mov    $0x1,%edi
call   1040 <exit@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xea0(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libt_now>:
sub    $0x18,%rsp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
test   %rax,%rax
js     1155 <libt_now+0x35>
cvtsi2sdl 0x10(%rsp),%xmm0
divsd  0xeb6(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { double, i32 }
@CLOCK_MONOTONIC = global i32 0
define double @libt_now() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i64 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%9 = load double, double* %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%11 = load i32, i32* %10
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 1.000000e+09
%14 = fadd double %9, %13
ret double %14
}

LLVM IR (-O2):
%struct.timespec = type { double, i32 }
@CLOCK_MONOTONIC = global i32 0
define double @libt_now() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i64 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load double, double* %9
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 1.000000e+09
%15 = fadd double %10, %14
ret double %15
}
/* Variables and functions */
char *epr_create_string(int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
void epr_cut_string(char **sub_str, const char *str, int start, int length) {
  *sub_str = epr_create_string(length);
  strncpy(*sub_str, str + start, length);
  *sub_str[length] = '\0';
}


x86 assembly (clang, -O0):
<epr_cut_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <epr_create_string@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    -0x18(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epr_cut_string>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%r15
mov    %ecx,%edi
call   1040 <epr_create_string@plt>
mov    %rax,(%r15)
movslq %r14d,%rcx
add    %rcx,%rbp
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
mov    (%r15,%rax,8),%rax
movb   $0x0,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @epr_cut_string(i8** nocapture %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i8* @epr_create_string(i32 %3)
store i8* %5, i8** %0
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = tail call i32 @strncpy(i8* %5, i8* %7, i32 %3)
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
store i8 0, i8* %11
ret void
}
/* Variables and functions */
scalar_t__ hits(char *, char *, int);
int pseudo(char *, char *, int);
int test_no_hits_all_pseudo() {
  char actual[] = {'R', 'G', 'B', 'Y'};
  char guess[] = {'G', 'B', 'Y', 'R'};
  return 0 == hits(actual, guess, 4) && 4 == pseudo(actual, guess, 4);
}


x86 assembly (clang, -O0):
<test_no_hits_all_pseudo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xecd(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1040 <hits@plt>
mov    %rax,%rdx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %rdx,%rcx
mov    %al,-0x9(%rbp)
jne    1180 <test_no_hits_all_pseudo+0x60>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <pseudo@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_no_hits_all_pseudo>:
push   %rax
movl   $0x59424752,0x4(%rsp)
59
movl   $0x52594247,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1040 <hits@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     114e <test_no_hits_all_pseudo+0x2e>
pop    %rcx
ret
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1030 <pseudo@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
@__const.test_no_hits_all_pseudo.actual = [4 x i8] c"RGBY"
@__const.test_no_hits_all_pseudo.guess = [4 x i8] c"GBYR"
define i32 @test_no_hits_all_pseudo() {
%1 = alloca [4 x i8]
%2 = alloca [4 x i8]
%3 = bitcast [4 x i8]* %1 to i8*
%4 = bitcast [4 x i8]* %2 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = call i64 @hits(i8* %5, i8* %6, i32 4)
%8 = icmp eq i64 0, %7
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%12 = call i32 @pseudo(i8* %10, i8* %11, i32 4)
%13 = icmp eq i32 4, %12
br label %14
14: ; preds = %9, %0
%15 = phi i1 [ false, %0 ], [ %13, %9 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @test_no_hits_all_pseudo() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1497515858, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 1381581383, i32* %2
%5 = call i64 @hits(i8* %3, i8* %4, i32 4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 @pseudo(i8* %3, i8* %4, i32 4)
%9 = icmp eq i32 %8, 4
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %0
%12 = phi i32 [ 0, %0 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int ioctl(int, int, void *);
int tcc_v4l2_ioctl(int fd, int request, void *arg) {
  int ret;
  ret = ioctl(fd, request, arg);
  return ret;
}


x86 assembly (clang, -O0):
<tcc_v4l2_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcc_v4l2_ioctl>:
jmp    1030 <ioctl@plt>

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

LLVM IR (-O2):
define i32 @tcc_v4l2_ioctl(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @ioctl(i32 %0, i32 %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ soar_ecExplainChunkConditionList(char *);
void explain_cond_list(char *name) { soar_ecExplainChunkConditionList(name); }


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

x86 assembly (clang, -O2):
<explain_cond_list>:
jmp    1030 <soar_ecExplainChunkConditionList@plt>

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

LLVM IR (-O2):
define void @explain_cond_list(i8* %0) {
%2 = tail call i32 @soar_ecExplainChunkConditionList(i8* %0)
ret void
}
/* Variables and functions */
int increment(int);
int callee4(int n) {
  register int l1 = increment(n);
  register int l2 = increment(l1);
  register int l3 = increment(l2);
  register int l4 = increment(l3);
  return l1 + l2 + l3 + l4;
}


x86 assembly (clang, -O0):
<callee4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <increment@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callee4>:
push   %rbp
push   %r14
push   %rbx
call   1030 <increment@plt>
mov    %eax,%r14d
mov    %eax,%edi
call   1030 <increment@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <increment@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <increment@plt>
add    %r14d,%ebp
add    %ebx,%ebp
add    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @callee4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @increment(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @increment(i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @increment(i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @increment(i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %5
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %6
%21 = add nsw i32 %19, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @callee4(i32 %0) {
%2 = tail call i32 @increment(i32 %0)
%3 = tail call i32 @increment(i32 %2)
%4 = tail call i32 @increment(i32 %3)
%5 = tail call i32 @increment(i32 %4)
%6 = add nsw i32 %3, %2
%7 = add nsw i32 %6, %4
%8 = add nsw i32 %7, %5
ret i32 %8
}
void org_apache_harmony_luni_platform_OSFileSystem_oneTimeInitializationImpl__() {
}


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

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

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

LLVM IR (-O2):
define void @org_apache_harmony_luni_platform_OSFileSystem_oneTimeInitializationImpl__() {
ret void
}
double double_max2(double a, double b) { return ((a) >= (b) ? (a) : (b)); }


x86 assembly (clang, -O0):
<double_max2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     112d <double_max2+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <double_max2+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_max2>:
movapd %xmm1,%xmm2
cmplesd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @double_max2(double %0, double %1) {
%3 = fcmp oge double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int msm8976_unclamp_secondary_arm_cpu(unsigned int cpu) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @msm8976_unclamp_secondary_arm_cpu(i32 %0) {
ret i32 0
}
void mp_hal_set_interrupt_char(char c) {}


x86 assembly (clang, -O0):
<mp_hal_set_interrupt_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @mp_hal_set_interrupt_char(i8 signext %0) {
ret void
}
int scale(int x, int a, int b, int c, int d) {
  return c + (x - a) * (d - c) / (b - a);
}


x86 assembly (clang, -O0):
<scale>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x10(%rbp),%ecx
imul   %ecx,%eax
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale>:
mov    %r8d,%eax
mov    %edx,%r8d
sub    %esi,%edi
sub    %ecx,%eax
imul   %edi,%eax
sub    %esi,%r8d
cltd
idiv   %r8d
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @scale(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = sub nsw i32 %12, %13
%15 = load i32, i32* %10
%16 = load i32, i32* %9
%17 = sub nsw i32 %15, %16
%18 = mul nsw i32 %14, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = sub nsw i32 %19, %20
%22 = sdiv i32 %18, %21
%23 = add nsw i32 %11, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @scale(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = sub nsw i32 %0, %1
%7 = sub nsw i32 %4, %3
%8 = mul nsw i32 %7, %6
%9 = sub nsw i32 %2, %1
%10 = sdiv i32 %8, %9
%11 = add nsw i32 %10, %3
ret i32 %11
}
int os2_netxin(int n, char *buf) { return (-1); }


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

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

LLVM IR (-O0):
define i32 @os2_netxin(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i32 -1
}

LLVM IR (-O2):
define i32 @os2_netxin(i32 %0, i8* nocapture readnone %1) {
ret i32 -1
}
void long_int_to_ascii_convertor(unsigned long int n, unsigned char hex[]) {
  hex[0] = n >> 24;
  hex[1] = n >> 16;
  hex[2] = n >> 8;
  hex[3] = n;
}


x86 assembly (clang, -O0):
<long_int_to_ascii_convertor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_int_to_ascii_convertor>:
bswap  %edi
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @long_int_to_ascii_convertor(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i64, i64* %3
%6 = lshr i64 %5, 24
%7 = trunc i64 %6 to i8
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i64, i64* %3
%11 = lshr i64 %10, 16
%12 = trunc i64 %11 to i8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %14
%15 = load i64, i64* %3
%16 = lshr i64 %15, 8
%17 = trunc i64 %16 to i8
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 2
store i8 %17, i8* %19
%20 = load i64, i64* %3
%21 = trunc i64 %20 to i8
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 3
store i8 %21, i8* %23
ret void
}

LLVM IR (-O2):
define void @long_int_to_ascii_convertor(i64 %0, i8* nocapture writeonly %1) {
%3 = lshr i64 %0, 24
%4 = trunc i64 %3 to i8
store i8 %4, i8* %1
%5 = lshr i64 %0, 16
%6 = trunc i64 %5 to i8
%7 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %6, i8* %7
%8 = lshr i64 %0, 8
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %9, i8* %10
%11 = trunc i64 %0 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ldexp(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(int /*<<< orphan*/);
void math_ldexp(void) {
  lua_pushnumber(ldexp(luaL_check_number(1), luaL_check_number(2)));
}


x86 assembly (clang, -O0):
<math_ldexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <luaL_check_number@plt>
mov    %eax,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <luaL_check_number@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1030 <ldexp@plt>
mov    %eax,%edi
call   1050 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_ldexp>:
push   %rbx
mov    $0x1,%edi
call   1040 <luaL_check_number@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1040 <luaL_check_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <ldexp@plt>
mov    %eax,%edi
pop    %rbx
jmp    1050 <lua_pushnumber@plt>

LLVM IR (-O0):
define void @math_ldexp() {
%1 = call i32 @luaL_check_number(i32 1)
%2 = call i32 @luaL_check_number(i32 2)
%3 = call i32 @ldexp(i32 %1, i32 %2)
%4 = call i32 @lua_pushnumber(i32 %3)
ret void
}

LLVM IR (-O2):
define void @math_ldexp() {
%1 = tail call i32 @luaL_check_number(i32 1)
%2 = tail call i32 @luaL_check_number(i32 2)
%3 = tail call i32 @ldexp(i32 %1, i32 %2)
%4 = tail call i32 @lua_pushnumber(i32 %3)
ret void
}
int a(int a) { return __builtin_ctz(a) + __builtin_clz(a); }


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
bsf    %eax,%eax
mov    -0x4(%rbp),%ecx
bsr    %ecx,%ecx
xor    $0x1f,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
bsf    %edi,%ecx
bsr    %edi,%eax
xor    $0x1f,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.cttz.i32(i32 %3, i1 true)
%5 = load i32, i32* %2
%6 = call i32 @llvm.ctlz.i32(i32 %5, i1 true)
%7 = add nsw i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @a(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 true)
%4 = add nuw nsw i32 %2, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ True;
int /*<<< orphan*/ glFinish();
int /*<<< orphan*/ glXCreateContext(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ glXGetCurrentDisplay();
int /*<<< orphan*/ glXGetProcAddressARB(char *);
int /*<<< orphan*/ glXQueryExtensionsString(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  glXCreateContext(NULL, NULL, NULL, True);
  glXQueryExtensionsString(NULL, 0);
  glXGetProcAddressARB("");
  glXGetCurrentDisplay();
  glFinish();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7b(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
mov    %rdx,%rsi
call   1060 <glXCreateContext@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1030 <glXQueryExtensionsString@plt>
lea    0xe70(%rip),%rdi
call   1070 <glXGetProcAddressARB@plt>
mov    $0x0,%al
call   1050 <glXGetCurrentDisplay@plt>
mov    $0x0,%al
call   1040 <glFinish@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e90(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <glXCreateContext@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <glXQueryExtensionsString@plt>
lea    0xe8b(%rip),%rdi
call   1070 <glXGetProcAddressARB@plt>
xor    %eax,%eax
call   1050 <glXGetCurrentDisplay@plt>
xor    %eax,%eax
call   1040 <glFinish@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@True = global i32 0
@.str = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @True
%7 = call i32 @glXCreateContext(i32* null, i32* null, i32* null, i32 %6)
%8 = call i32 @glXQueryExtensionsString(i32* null, i32 0)
%9 = call i32 @glXGetProcAddressARB(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @glXGetCurrentDisplay()
%11 = call i32 (...) @glFinish()
ret i32 0
}

LLVM IR (-O2):
@True = global i32 0
@.str = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @True
%4 = tail call i32 @glXCreateContext(i32* null, i32* null, i32* null, i32 %3)
%5 = tail call i32 @glXQueryExtensionsString(i32* null, i32 0)
%6 = tail call i32 @glXGetProcAddressARB(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @glXGetCurrentDisplay()
%8 = tail call i32 (...) @glFinish()
ret i32 0
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t ROL64_59(uint64_t x) {
  __asm__("rolq $59, %0" : "=r"(x) : "0"(x));
  return x;
}


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

x86 assembly (clang, -O2):
<ROL64_59>:
mov    %rdi,%rax
rol    $0x3b,%rax
ret

LLVM IR (-O0):
define i8* @ROL64_59(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* asm "rolq $$59, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @ROL64_59(i8* readnone %0) {
%2 = tail call i8* asm "rolq $$59, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
__attribute__((always_)) long max_long(long a, long b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<max_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <max_long+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <max_long+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_long>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @max_long(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int bi_mon(int, int *, int, int *, int, int *, int *);
int do_rsa(int *n, int *key, int klen, int *input, int inlen, int *output) {
  int i = 0;
  int r = bi_mon(inlen, input, klen, key, klen, n, output);
  return 0;
}


x86 assembly (clang, -O0):
<do_rsa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x8(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <bi_mon@plt>
mov    %eax,-0x38(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_rsa>:
push   %rax
mov    %rsi,%rax
mov    %rdi,%r10
mov    %r9,(%rsp)
mov    %r8d,%edi
mov    %rcx,%rsi
mov    %rax,%rcx
mov    %edx,%r8d
mov    %r10,%r9
call   1030 <bi_mon@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_rsa(i32* %0, i32* %1, i32 %2, i32* %3, i32 %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32* %5, i32** %12
store i32 0, i32* %13
%15 = load i32, i32* %11
%16 = load i32*, i32** %10
%17 = load i32, i32* %9
%18 = load i32*, i32** %8
%19 = load i32, i32* %9
%20 = load i32*, i32** %7
%21 = load i32*, i32** %12
%22 = call i32 @bi_mon(i32 %15, i32* %16, i32 %17, i32* %18, i32 %19, i32* %20, i32* %21)
store i32 %22, i32* %14
ret i32 0
}

LLVM IR (-O2):
define i32 @do_rsa(i32* %0, i32* %1, i32 %2, i32* %3, i32 %4, i32* %5) {
%7 = tail call i32 @bi_mon(i32 %4, i32* %3, i32 %2, i32* %1, i32 %2, i32* %0, i32* %5)
ret i32 0
}
/* Variables and functions */
char *malloc(int /*<<< orphan*/);
void pr2899() {
  char *foo = malloc(0);
  for (unsigned i = 0; i < 100; i++) {
    foo[i] = 0;
  }
}


x86 assembly (clang, -O0):
<pr2899>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jae    114d <pr2899+0x3d>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <pr2899+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @pr2899() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i8* @malloc(i32 0)
store i8* %3, i8** %1
store i32 0, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp ult i32 %5, 100
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i8*, i8** %1
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = add i32 %13, 1
store i32 %14, i32* %2
br label %4
15: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @pr2899() {
ret void
}
int special(int ch) {
  switch (ch) {
  case 0x22:
  case 0x2E:
  case 0x3B:
  case 0x5C:
  case 0x28:
  case 0x29:
  case 0x40:
  case 0x24:
    return (1);
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<special>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x22,%eax
je     1184 <special+0x84>
jmp    111b <special+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x24,%eax
je     1184 <special+0x84>
jmp    112c <special+0x2c>
mov    -0xc(%rbp),%eax
add    $0xffffffd8,%eax
sub    $0x2,%eax
jb     1184 <special+0x84>
jmp    1140 <special+0x40>
mov    -0xc(%rbp),%eax
sub    $0x2e,%eax
je     1184 <special+0x84>
jmp    1151 <special+0x51>
mov    -0xc(%rbp),%eax
sub    $0x3b,%eax
je     1184 <special+0x84>
jmp    1162 <special+0x62>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     1184 <special+0x84>
jmp    1173 <special+0x73>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
jne    1190 <special+0x90>
jmp    1184 <special+0x84>
movl   $0x1,-0x4(%rbp)
jmp    1197 <special+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<special>:
add    $0xffffffde,%edi
cmp    $0x3a,%edi
ja     111e <special+0x1e>
mov    $0x1,%eax
movabs $0x4000000420010c5,%rcx
bt     %rdi,%rcx
jae    111e <special+0x1e>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @special(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 34, label %5
i32 46, label %5
i32 59, label %5
i32 92, label %5
i32 40, label %5
i32 41, label %5
i32 64, label %5
i32 36, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @special(i32 %0) {
switch i32 %0, label %2 [
i32 34, label %3
i32 46, label %3
i32 59, label %3
i32 92, label %3
i32 40, label %3
i32 41, label %3
i32 64, label %3
i32 36, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
int fullChunks(int size, int chunkSize) {
  return (size + (chunkSize - 1)) / chunkSize;
}


x86 assembly (clang, -O0):
<fullChunks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fullChunks>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @fullChunks(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 = sub nsw i32 %6, 1
%8 = add nsw i32 %5, %7
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @fullChunks(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sdiv i32 %4, %1
ret i32 %5
}
/* Type definitions */
struct nlattr {
  int dummy;
};

/* Variables and functions */
int NLA_HDRLEN;
struct nlattr *nla_data(struct nlattr *nla) {
  return (struct nlattr *)((char *)nla + NLA_HDRLEN);
}


x86 assembly (clang, -O0):
<nla_data>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ecd(%rip),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nla_data>:
mov    0x2ed9(%rip),%rax
movslq (%rax),%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
%struct.nlattr = type { i32 }
@NLA_HDRLEN = global i32 0
define %struct.nlattr* @nla_data(%struct.nlattr* %0) {
%2 = alloca %struct.nlattr*
store %struct.nlattr* %0, %struct.nlattr** %2
%3 = load %struct.nlattr*, %struct.nlattr** %2
%4 = bitcast %struct.nlattr* %3 to i8*
%5 = load i32, i32* @NLA_HDRLEN
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
%8 = bitcast i8* %7 to %struct.nlattr*
ret %struct.nlattr* %8
}

LLVM IR (-O2):
%struct.nlattr = type { i32 }
@NLA_HDRLEN = global i32 0
define %struct.nlattr* @nla_data(%struct.nlattr* readnone %0) {
%2 = bitcast %struct.nlattr* %0 to i8*
%3 = load i32, i32* @NLA_HDRLEN
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %2, i64 %4
%6 = bitcast i8* %5 to %struct.nlattr*
ret %struct.nlattr* %6
}