xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
int waitpid(int, int *, int /*<<< orphan*/);
void zombie_handler(int signo) {
  pid_t pid;
  int stat;
  while ((pid = waitpid(-1, &stat, WNOHANG)) > 0)
    printf("child %d terminated normaly\n", pid);
}


x86 assembly (clang, -O0):
<zombie_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0xc(%rbp),%rsi
call   1040 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1162 <zombie_handler+0x42>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    112b <zombie_handler+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zombie_handler>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2eb8(%rip),%r15
mov    (%r15),%edx
lea    0xc(%rsp),%rsi
mov    $0xffffffff,%edi
call   1040 <waitpid@plt>
test   %eax,%eax
jle    117e <zombie_handler+0x5e>
lea    0xeb3(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1040 <waitpid@plt>
test   %eax,%eax
jg     1160 <zombie_handler+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
@.str = [29 x i8] c"child %d terminated normaly\0A\00"
define void @zombie_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* @WNOHANG
%7 = call i32 @waitpid(i32 -1, i32* %4, i32 %6)
store i32 %7, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
@.str = [29 x i8] c"child %d terminated normaly\0A\00"
define void @zombie_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @WNOHANG
%5 = call i32 @waitpid(i32 -1, i32* %2, i32 %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = phi i32 [ %11, %7 ], [ %5, %1 ]
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @WNOHANG
%11 = call i32 @waitpid(i32 -1, i32* %2, i32 %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
void sprint_clr(char *str) { sprintf(str, "CLR   A                         "); }


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

x86 assembly (clang, -O2):
<sprint_clr>:
movups 0xf09(%rip),%xmm0
movups %xmm0,0x10(%rdi)
movups 0xeee(%rip),%xmm0
movups %xmm0,(%rdi)
movb   $0x0,0x20(%rdi)
ret

LLVM IR (-O0):
@.str = [33 x i8] c"CLR A \00"
define void @sprint_clr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"CLR A \00"
define void @sprint_clr(i8* nocapture writeonly %0) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(33) %0, i8* align 1 dereferenceable(33) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 33, i1 false)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void print_version() {
  printf("hx version %s (git: %s)\n", "1.0.0", "unknown");
}


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

x86 assembly (clang, -O2):
<print_version>:
lea    0xee9(%rip),%rdi
lea    0xefb(%rip),%rsi
lea    0xefa(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"hx version %s (git: %s)\0A\00"
@.str.1 = [6 x i8] c"1.0.0\00"
@.str.2 = [8 x i8] c"unknown\00"
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"hx version %s (git: %s)\0A\00"
@.str.1 = [6 x i8] c"1.0.0\00"
@.str.2 = [8 x i8] c"unknown\00"
define void @print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
struct dma_buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ kunmap_atomic(void *);
void mock_dmabuf_kunmap_atomic(struct dma_buf *dma_buf, unsigned long page_num,
                               void *addr) {
  kunmap_atomic(addr);
}


x86 assembly (clang, -O0):
<mock_dmabuf_kunmap_atomic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <kunmap_atomic@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mock_dmabuf_kunmap_atomic>:
mov    %rdx,%rdi
jmp    1030 <kunmap_atomic@plt>

LLVM IR (-O0):
%struct.dma_buf = type { i32 }
define void @mock_dmabuf_kunmap_atomic(%struct.dma_buf* %0, i64 %1, i8* %2) {
%4 = alloca %struct.dma_buf*
%5 = alloca i64
%6 = alloca i8*
store %struct.dma_buf* %0, %struct.dma_buf** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @kunmap_atomic(i8* %7)
ret void
}

LLVM IR (-O2):
%struct.dma_buf = type { i32 }
define void @mock_dmabuf_kunmap_atomic(%struct.dma_buf* nocapture readnone %0, i64 %1, i8* %2) {
%4 = tail call i32 @kunmap_atomic(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("ddprofile by Graham Houston, release date: "
         "2012.10.20"
         "\n"
         "\n"
         "Show the number of blank blocks in a checksum file\n"
         "\n"
         "	ddprofile	-c checksum [-v]\n"
         "\n"
         "Parameters\n"
         "	-c	checksum file\n"
         "	-v	verbose\n"
         "\n"
         "Exit codes:\n"
         "	0	successful\n"
         "	1	a runtime error code, unable to complete task "
         "(detailed perror\n"
         "		and logical error message are output via stderr)\n");
}


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

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

LLVM IR (-O0):
@.str = [322 x i8] c"ddprofile by Graham Houston, release date: 2012.10.20\0A\0AShow the number of blank blocks in a checksum file\0A\0A\09ddprofile\09-c checksum [-v]\0A\0AParameters\0A\09-c\09checksum file\0A\09-v\09verbose\0A\0AExit codes:\0A\090\09successful\0A\091\09a runtime error code, unable to complete task (detailed perror\0A\09\09and logical error message are output via stderr)\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([322 x i8], [322 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [321 x i8] c"ddprofile by Graham Houston, release date: 2012.10.20\0A\0AShow the number of blank blocks in a checksum file\0A\0A\09ddprofile\09-c checksum [-v]\0A\0AParameters\0A\09-c\09checksum file\0A\09-v\09verbose\0A\0AExit codes:\0A\090\09successful\0A\091\09a runtime error code, unable to complete task (detailed perror\0A\09\09and logical error message are output via stderr)\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([321 x i8], [321 x i8]* @str, i64 0, i64 0))
ret void
}
int getopt_long(argc, argv, optstring, long_options, opt_index)
int argc;
char *const *argv;
const char *optstring;
const struct option *long_options;
int *opt_index;
{ return _getopt_internal(argc, argv, optstring, long_options, opt_index, 0); }


x86 assembly (clang, -O0):
<getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
mov    $0x0,%al
call   1030 <_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long>:
xor    %r9d,%r9d
xor    %eax,%eax
jmp    1030 <_getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type opaque
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...) bitcast (i32 (...)* @_getopt_internal to i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...)*)(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type opaque
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...) bitcast (i32 (...)* @_getopt_internal to i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...)*)(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 0)
ret i32 %6
}
__attribute__((__always___)) void writel(unsigned int b, volatile void *addr) {
  *(volatile unsigned int *)addr = b;
}


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

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

LLVM IR (-O0):
define void @writel(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 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
store volatile i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @writel(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i32*
store volatile i32 %0, i32* %3
ret void
}
/* Variables and functions */
int dobro(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int x = 10;
  printf("Dobro de %d: %d\n", x, dobro(x));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <dobro@plt>
lea    0xece(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Dobro de %d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dobro(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Dobro de %d: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @dobro(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 10, i32 %1)
ret i32 0
}
letter(ch) {
  if (ch >= 'a' && ch <= 'z')
    return (1);
  if (ch >= 'A' && ch <= 'Z')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<letter>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     1127 <letter+0x27>
cmpl   $0x7a,-0x8(%rbp)
jg     1127 <letter+0x27>
movl   $0x1,-0x4(%rbp)
jmp    114e <letter+0x4e>
cmpl   $0x41,-0x8(%rbp)
jl     1147 <letter+0x47>
cmpl   $0x5a,-0x8(%rbp)
jg     1147 <letter+0x47>
movl   $0x1,-0x4(%rbp)
jmp    114e <letter+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<letter>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @letter(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 122
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %18
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 65
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 90
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %2
br label %18
17: ; preds = %13, %10
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16, %9
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @letter(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
void mp_load_0(int n, int radix, int out[]) {
  int j;
  short int *outdgt;
  outdgt = (short int *)&out[2];
  out[0] = 0;
  out[1] = 0;
  for (j = 0; j < n; j++) {
    outdgt[j] = 0;
  }
}


x86 assembly (clang, -O0):
<mp_load_0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115e <mp_load_0+0x5e>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movw   $0x0,(%rax,%rcx,2)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <mp_load_0+0x36>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_load_0>:
push   %rax
movq   $0x0,(%rdx)
test   %edi,%edi
jle    1132 <mp_load_0+0x22>
add    $0x8,%rdx
mov    %edi,%eax
add    %rax,%rax
mov    %rdx,%rdi
xor    %esi,%esi
mov    %rax,%rdx
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @mp_load_0(i32 %0, i32 %1, i32* nocapture writeonly %2) {
store i32 0, i32* %2
%4 = getelementptr inbounds i32, i32* %2, i64 1
store i32 0, i32* %4
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = getelementptr i32, i32* %2, i64 2
%8 = bitcast i32* %7 to i8*
%9 = zext i32 %0 to i64
%10 = shl nuw nsw i64 %9, 1
br label %11
11: ; preds = %6, %3
ret void
}
int is_left_breakable(int maze[25][25], int i, int j) {
  int check = 0;
  if (j == 0) {
    check = 0;
  } else if (maze[i][j] != maze[i][j - 1]) {
    check = 1;
  }
  return check;
}


x86 assembly (clang, -O0):
<is_left_breakable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    112b <is_left_breakable+0x2b>
movl   $0x0,-0x14(%rbp)
jmp    116e <is_left_breakable+0x6e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
imul   $0x64,%rdx,%rdx
add    %rdx,%rcx
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
je     1169 <is_left_breakable+0x69>
movl   $0x1,-0x14(%rbp)
jmp    116e <is_left_breakable+0x6e>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_left_breakable>:
test   %edx,%edx
je     111e <is_left_breakable+0x1e>
movslq %esi,%rax
movslq %edx,%rcx
imul   $0x64,%rax,%rax
add    %rax,%rdi
mov    (%rdi,%rcx,4),%edx
xor    %eax,%eax
cmp    -0x4(%rdi,%rcx,4),%edx
setne  %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_left_breakable([25 x i32]* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds [25 x i32], [25 x i32]* %0, i64 %6, i64 %7
%9 = load i32, i32* %8
%10 = add nsw i32 %2, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [25 x i32], [25 x i32]* %0, i64 %6, i64 %11
%13 = load i32, i32* %12
%14 = icmp ne i32 %9, %13
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %5, %3
%17 = phi i32 [ 0, %3 ], [ %15, %5 ]
ret i32 %17
}
/* Variables and functions */
float sinf(float);
void sin_ff(float *ret, float x) {
  float f;
  f = sinf(x);
  (*ret) = f;
}


x86 assembly (clang, -O0):
<sin_ff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin_ff>:
push   %rbx
mov    %rdi,%rbx
call   1030 <sinf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @sin_ff(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
%5 = alloca float
store float* %0, float** %3
store float %1, float* %4
%6 = load float, float* %4
%7 = call float @sinf(float %6)
store float %7, float* %5
%8 = load float, float* %5
%9 = load float*, float** %3
store float %8, float* %9
ret void
}

LLVM IR (-O2):
define void @sin_ff(float* nocapture writeonly %0, float %1) {
%3 = tail call float @sinf(float %1)
store float %3, float* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
scalar_t__ strncmp(char *, char *, int);
void strncmp_diff_length_5() {
  char *x = "012";
  char *y = "12345";
  clang_analyzer_eval(strncmp(x, y, 3) < 0);
}


x86 assembly (clang, -O0):
<strncmp_diff_length_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncmp_diff_length_5>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
shr    $0x3f,%rax
mov    %eax,%edi
pop    %rax
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"012\00"
@.str.1 = [6 x i8] c"12345\00"
define void @strncmp_diff_length_5() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i64 @strncmp(i8* %3, i8* %4, i32 3)
%6 = icmp slt i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @clang_analyzer_eval(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"012\00"
@.str.1 = [6 x i8] c"12345\00"
define void @strncmp_diff_length_5() {
%1 = tail call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 3)
%2 = lshr i64 %1, 63
%3 = trunc i64 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
ret void
}
/* Variables and functions */
char const *firetalk_nhtmlentities(char const *, int);
const char *firetalk_htmlentities(const char *str) {
  return (firetalk_nhtmlentities(str, -1));
}


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

x86 assembly (clang, -O2):
<firetalk_htmlentities>:
mov    $0xffffffff,%esi
jmp    1030 <firetalk_nhtmlentities@plt>

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

LLVM IR (-O2):
define i8* @firetalk_htmlentities(i8* %0) {
%2 = tail call i8* @firetalk_nhtmlentities(i8* %0, i32 -1)
ret i8* %2
}
void array_clear(int *arr, int n) {
  while (n) {
    n--;
    arr[n] = 0;
  }
}


x86 assembly (clang, -O0):
<array_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1132 <array_clear+0x32>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    110b <array_clear+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_clear>:
test   %esi,%esi
je     1133 <array_clear+0x23>
push   %rax
lea    -0x1(%rsi),%eax
movslq %eax,%rcx
sub    %rax,%rcx
lea    (%rdi,%rcx,4),%rdi
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @array_clear(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = add i32 %1, -1
%6 = sext i32 %5 to i64
%7 = zext i32 %5 to i64
%8 = sub nsw i64 %6, %7
%9 = getelementptr i32, i32* %0, i64 %8
%10 = bitcast i32* %9 to i8*
%11 = zext i32 %1 to i64
%12 = shl nuw nsw i64 %11, 2
br label %13
13: ; preds = %4, %2
ret void
}
/* Variables and functions */
unsigned int bar();
void foo(unsigned *p, unsigned n) {
  unsigned i;
  for (i = 0; i < n; i++)
    p[i] = bar();
}


x86 assembly (clang, -O0):
<foo>:
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    1153 <foo+0x43>
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <foo+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1144 <foo+0x34>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <bar@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <foo+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @foo(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %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 = call i32 (...) @bar()
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32 %11, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %5
%18 = add i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @foo(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = tail call i32 (...) @bar()
%9 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 %8, i32* %9
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
/* Type definitions */
struct rr {
  int dummy;
};

/* Variables and functions */
char *rrsig_human(struct rr *rrv) { return NULL; }


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

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

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

LLVM IR (-O2):
%struct.rr = type { i32 }
define noalias i8* @rrsig_human(%struct.rr* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int atoi(char const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test5(int);
int main(int argc, const char *argv[]) {
  if (argc < 2) {
    printf("usage: ./main <times>\n");
    exit(EXIT_FAILURE);
  }
  int times = atoi(argv[1]);
  test5(times);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1173 <main+0x33>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <test5@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jle    115a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <test5@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"usage: ./main <times>\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = call i32 @test5(i32 %17)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [22 x i8] c"usage: ./main <times>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i32 @test5(i32 %11)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int main() {
  FILE *a = fopen("good.c", "r");
  if (!a)
    return 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <main+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1154 <main+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"good.c\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void off_errs() {
  extern int ncopts;
  ncopts &= ~1;
  ncopts &= ~2;
}


x86 assembly (clang, -O0):
<off_errs>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    0x2ec9(%rip),%rax
mov    %ecx,(%rax)
mov    0x2ec0(%rip),%rax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    0x2eb4(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<off_errs>:
mov    0x2ed9(%rip),%rax
andb   $0xfc,(%rax)
ret

LLVM IR (-O0):
@ncopts = external global i32
define void @off_errs() {
%1 = load i32, i32* @ncopts
%2 = and i32 %1, -2
store i32 %2, i32* @ncopts
%3 = load i32, i32* @ncopts
%4 = and i32 %3, -3
store i32 %4, i32* @ncopts
ret void
}

LLVM IR (-O2):
@ncopts = external global i32
define void @off_errs() {
%1 = load i32, i32* @ncopts
%2 = and i32 %1, -4
store i32 %2, i32* @ncopts
ret void
}
int calc_offset(long long total, int part, int nthreads) {
  return (part * (total / nthreads));
}


x86 assembly (clang, -O0):
<calc_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_offset>:
mov    %edx,%ecx
mov    %rdi,%rax
movslq %edx,%rdi
mov    %rax,%rdx
or     %rdi,%rdx
shr    $0x20,%rdx
je     111d <calc_offset+0x1d>
cqto
idiv   %rdi
imul   %esi,%eax
ret
xor    %edx,%edx
div    %ecx
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @calc_offset(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = sext i32 %7 to i64
%9 = load i64, i64* %4
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = sdiv i64 %9, %11
%13 = mul nsw i64 %8, %12
%14 = trunc i64 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @calc_offset(i64 %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = sdiv i64 %0, %4
%6 = trunc i64 %5 to i32
%7 = mul i32 %6, %1
ret i32 %7
}
int test_imm_76int64_lowword_reg(long long val) {
  return ((val) & (0x76 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_76int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x76,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_76int64_lowword_reg>:
test   $0x76,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_76int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 118
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int lib1_function(void) { return 42; }


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

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

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

LLVM IR (-O2):
define i32 @lib1_function() {
ret i32 42
}
/* Variables and functions */
void booster_rewinddir(void *);
void rewinddir(void *dir) { return booster_rewinddir(dir); }


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

x86 assembly (clang, -O2):
<rewinddir>:
jmp    1030 <booster_rewinddir@plt>

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

LLVM IR (-O2):
define void @rewinddir(i8* %0) {
tail call void @booster_rewinddir(i8* %0)
ret void
}
/* Type definitions */
struct ibv_context {
  int dummy;
};
struct ibv_async_event {
  int dummy;
};

/* Variables and functions */
int ibv_get_async_event(struct ibv_context *, struct ibv_async_event *);
int mlx4_glue_get_async_event(struct ibv_context *context,
                              struct ibv_async_event *event) {
  return ibv_get_async_event(context, event);
}


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

x86 assembly (clang, -O2):
<mlx4_glue_get_async_event>:
jmp    1030 <ibv_get_async_event@plt>

LLVM IR (-O0):
%struct.ibv_context = type { i32 }
%struct.ibv_async_event = type { i32 }
define i32 @mlx4_glue_get_async_event(%struct.ibv_context* %0, %struct.ibv_async_event* %1) {
%3 = alloca %struct.ibv_context*
%4 = alloca %struct.ibv_async_event*
store %struct.ibv_context* %0, %struct.ibv_context** %3
store %struct.ibv_async_event* %1, %struct.ibv_async_event** %4
%5 = load %struct.ibv_context*, %struct.ibv_context** %3
%6 = load %struct.ibv_async_event*, %struct.ibv_async_event** %4
%7 = call i32 @ibv_get_async_event(%struct.ibv_context* %5, %struct.ibv_async_event* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.ibv_context = type { i32 }
%struct.ibv_async_event = type { i32 }
define i32 @mlx4_glue_get_async_event(%struct.ibv_context* %0, %struct.ibv_async_event* %1) {
%3 = tail call i32 @ibv_get_async_event(%struct.ibv_context* %0, %struct.ibv_async_event* %1)
ret i32 %3
}
tolower(int c) {
  if (c < 'A' || c > 'Z')
    return c;
  return (c - 'A' + 'a');
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     111b <tolower+0x1b>
cmpl   $0x5a,-0x8(%rbp)
jle    1126 <tolower+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <tolower+0x32>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
lea    -0x5b(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0xffffffe6,%ecx
cmovb  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = add i32 %0, -91
%3 = icmp ult i32 %2, -26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
scalar_t__ daemon(int /*<<< orphan*/, int /*<<< orphan*/);
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
char *strerror(int);
int main() {
  int errnum;
  if (daemon(0, 0) < 0) {
    errnum = errno;
    fprintf(stderr, "Daemonizing failed: %s\n", strerror(errnum));
    return -1;
  }
  while (1) {
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <daemon@plt>
cmp    $0x0,%rax
jge    119f <main+0x5f>
mov    0x2e6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xe71(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    11a4 <main+0x64>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    11a4 <main+0x64>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <daemon@plt>
test   %rax,%rax
js     115c <main+0x1c>
nop
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    1150 <main+0x10>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    0x2e74(%rip),%rax
mov    (%rax),%ebx
call   1050 <strerror@plt>
lea    0xe86(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"Daemonizing failed: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i64 @daemon(i32 0, i32 0)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = load i32, i32* @errno
store i32 %6, i32* %2
%7 = load i32, i32* @stderr
%8 = load i32, i32* %2
%9 = call i8* @strerror(i32 %8)
%10 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 -1
11: ; preds = %0
br label %12
12: ; preds = %11, %12
%13 = call i32 @sleep(i32 1)
br label %12
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"Daemonizing failed: %s\0A\00"
define i32 @main() {
%1 = tail call i64 @daemon(i32 0, i32 0)
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32, i32* @errno
%5 = load i32, i32* @stderr
%6 = tail call i8* @strerror(i32 %4)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 -1
8: ; preds = %0, %8
%9 = tail call i32 @sleep(i32 1)
br label %8
}
int nsock_printf_nul(int sd, const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define i32 @nsock_printf_nul(i32 %0, i8* nocapture readnone %1, ...) {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ usleep(int /*<<< orphan*/);
void adv_delayu(uint32_t interval) { usleep(interval); }


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

x86 assembly (clang, -O2):
<adv_delayu>:
jmp    1030 <usleep@plt>

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

LLVM IR (-O2):
define void @adv_delayu(i32 %0) {
%2 = tail call i32 @usleep(i32 %0)
ret void
}
/* Variables and functions */
int printf(char *);
int clear() { return printf("\033[2J\033[1;1H"); }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define i32 @clear() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
float logf(float);
float __ocl_log_float(float src) { return logf(src); }


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

x86 assembly (clang, -O2):
<__ocl_log_float>:
jmp    1030 <logf@plt>

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

LLVM IR (-O2):
define float @__ocl_log_float(float %0) {
%2 = tail call float @logf(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sortinvoke();
int main() {
  sortinvoke();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <sortinvoke@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <sortinvoke@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @sortinvoke()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sortinvoke()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void mergetSort_(int a[], int begin, int end) {
  if (begin < end) {
    int mid = (begin + end) / 2;
    mergetSort_(a, begin, mid);
    mergetSort_(a, mid + 1, end);
    merge(a, begin, mid, end);
  }
}


x86 assembly (clang, -O0):
<mergetSort_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <mergetSort_+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <mergetSort_@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <mergetSort_@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergetSort_>:
cmp    %edx,%esi
jge    1172 <mergetSort_+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1030 <mergetSort_@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <mergetSort_@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <merge@plt>
ret

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

LLVM IR (-O2):
define void @mergetSort_(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @mergetSort_(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @mergetSort_(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}