xunge/DecIR huggingface dataset:
void HashList_Proceed(struct HashList *hl) {
  {}
}


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

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

LLVM IR (-O0):
%struct.HashList = type opaque
define void @HashList_Proceed(%struct.HashList* %0) {
%2 = alloca %struct.HashList*
store %struct.HashList* %0, %struct.HashList** %2
ret void
}

LLVM IR (-O2):
%struct.HashList = type opaque
define void @HashList_Proceed(%struct.HashList* nocapture %0) {
ret void
}
int foo(int x) { return x + 7; }


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

x86 assembly (clang, -O2):
<foo>:
lea    0x7(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 7
ret i32 %2
}
int hash_name(const char *name) {
  int i = 0;
  while (*name)
    i = (i << 1) ^ *name++;
  if (i < 0)
    i = -i;
  return i;
}


x86 assembly (clang, -O0):
<hash_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113e <hash_name+0x3e>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash_name+0xf>
cmpl   $0x0,-0xc(%rbp)
jge    1150 <hash_name+0x50>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_name>:
mov    (%rdi),%al
test   %al,%al
je     1124 <hash_name+0x24>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
add    %ecx,%ecx
movsbl %al,%eax
xor    %eax,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash_name+0x10>
jmp    1126 <hash_name+0x26>
xor    %ecx,%ecx
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_name(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = shl i32 %6, 1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = xor i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
%16 = tail call i32 @llvm.abs.i32(i32 %15, i1 true)
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void err_sys(const char *err, ...) { printf("Fatal error : %s\n", err); }


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

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"Fatal error : %s\0A\00"
define void @err_sys(i8* %0, ...) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned int leverage(unsigned int *selekta, int i, int startpos,
                      int sizeofmassive) {
  int x = 0;
  if (startpos - i > 0)
    x = selekta[startpos - i - 1];
  else
    x = selekta[sizeofmassive + (startpos - i) - 1];
  return x;
}


x86 assembly (clang, -O0):
<leverage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x0,%eax
jle    1142 <leverage+0x42>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
jmp    115d <leverage+0x5d>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    -0xc(%rbp),%edx
add    %edx,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leverage>:
sub    %esi,%edx
lea    -0x1(%rdx),%eax
test   %edx,%edx
lea    -0x1(%rdx,%rcx,1),%ecx
movslq %ecx,%rcx
cmovg  %rax,%rcx
mov    (%rdi,%rcx,4),%eax
ret

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

LLVM IR (-O2):
define i32 @leverage(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %2, %1
%6 = icmp sgt i32 %5, 0
%7 = add i32 %5, -1
%8 = zext i32 %7 to i64
%9 = add i32 %7, %3
%10 = sext i32 %9 to i64
%11 = select i1 %6, i64 %8, i64 %10
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
ret i32 %13
}
int DecSort(void *x, void *y) {
  int a = *((int *)x);
  int b = *((int *)y);
  if (a > b)
    return -1;
  else if (a < b)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<DecSort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <DecSort+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <DecSort+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    114e <DecSort+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1155 <DecSort+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DecSort>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setl   %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @DecSort(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_testcancel();
int /*<<< orphan*/ sleep(int);
void *threadfunc(void *parm) {
  printf("Entered secondary thread\n");
  while (1) {
    printf("Secondary thread is looping\n");
    pthread_testcancel();
    sleep(1);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<threadfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pthread_testcancel@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1148 <threadfunc+0x18>

x86 assembly (clang, -O2):
<threadfunc>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <pthread_testcancel@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1150 <threadfunc+0x20>

LLVM IR (-O0):
@.str = [26 x i8] c"Entered secondary thread\0A\00"
@.str.1 = [29 x i8] c"Secondary thread is looping\0A\00"
define i8* @threadfunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %1, %4
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @pthread_testcancel()
%7 = call i32 @sleep(i32 1)
br label %4
}

LLVM IR (-O2):
@str = [25 x i8] c"Entered secondary thread\00"
@str.2 = [28 x i8] c"Secondary thread is looping\00"
define noalias i8* @threadfunc(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 (...) @pthread_testcancel()
%6 = tail call i32 @sleep(i32 1)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fun1(int);
int open(char *, int /*<<< orphan*/);
int main() {
  int fd = open("/dev/chardev", O_RDONLY);
  fun1(fd);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fun1@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <fun1@plt>
mov    %ebx,%edi
call   1030 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/chardev\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @fun1(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @close(i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/chardev\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @fun1(i32 %2)
%4 = tail call i32 @close(i32 %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ syscall_cp(int, void *, size_t, unsigned int);
ssize_t getrandom(void *buf, size_t buflen, unsigned flags) {
  return syscall_cp(384, buf, buflen, flags);
}


x86 assembly (clang, -O0):
<getrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x180,%edi
call   1030 <syscall_cp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrandom>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x180,%edi
jmp    1030 <syscall_cp@plt>

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

LLVM IR (-O2):
define i32 @getrandom(i8* %0, i64 %1, i32 %2) {
%4 = tail call i32 @syscall_cp(i32 384, i8* %0, i64 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char **argv) {
  printf("Usage: %s [OPTIONS]\n\n"
         "Options:\n"
         "       -f <VNC passwd file> = use VNC passwd file\n"
         "       -s <VNC Encrypted Password in HEX> = use encrypted password "
         "hex string\n",
         argv[0]);
}


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

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

LLVM IR (-O0):
@.str = [159 x i8] c"Usage: %s [OPTIONS]\0A\0AOptions:\0A -f <VNC passwd file> = use VNC passwd file\0A -s <VNC Encrypted Password in HEX> = use encrypted password hex string\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [159 x i8] c"Usage: %s [OPTIONS]\0A\0AOptions:\0A -f <VNC passwd file> = use VNC passwd file\0A -s <VNC Encrypted Password in HEX> = use encrypted password hex string\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
void removeChar(char str[], char ch) {
  char *pr = str, *pw = str;
  while (*pr) {
    *pw = *pr++;
    pw += (*pw != ch);
  }
  *pw = '\0';
}


x86 assembly (clang, -O0):
<removeChar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     116a <removeChar+0x6a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    111e <removeChar+0x1e>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeChar>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <removeChar+0x28>
lea    0x1(%rdi),%rax
nopw   0x0(%rax,%rax,1)
mov    %cl,(%rdi)
xor    %edx,%edx
cmp    %sil,%cl
setne  %dl
add    %rdx,%rdi
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <removeChar+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @removeChar(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%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 i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %7
%10 = icmp ne i8 %6, %1
%11 = zext i1 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i8* [ %0, %2 ], [ %12, %5 ]
store i8 0, i8* %16
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) { printf("Handling signal %d\n", sig); }


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

x86 assembly (clang, -O2):
<handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [20 x i8] c"Handling signal %d\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int is_valid_solution(int *E, int max_colors) {
  int i;
  for (i = 1; i < max_colors + 1; i++) {
    if (E[i] != 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_valid_solution>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1154 <is_valid_solution+0x54>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1141 <is_valid_solution+0x41>
movl   $0x0,-0x4(%rbp)
jmp    115b <is_valid_solution+0x5b>
jmp    1146 <is_valid_solution+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <is_valid_solution+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_solution>:
mov    $0x1,%eax
test   %esi,%esi
jle    112f <is_valid_solution+0x2f>
add    $0x1,%esi
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,(%rdi,%rcx,4)
jne    1130 <is_valid_solution+0x30>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1120 <is_valid_solution+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_valid_solution(i32* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = add nuw i32 %1, 1
%6 = zext i32 %5 to i64
br label %10
7: ; preds = %10
%8 = add nuw nsw i64 %11, 1
%9 = icmp eq i64 %8, %6
br i1 %9, label %15, label %10
10: ; preds = %4, %7
%11 = phi i64 [ 1, %4 ], [ %8, %7 ]
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %7, label %15
15: ; preds = %10, %7, %2
%16 = phi i32 [ 1, %2 ], [ 1, %7 ], [ 0, %10 ]
ret i32 %16
}
void ARGBToRGB565Row_C() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToRGB565Row_C() {
ret void
}
/* Type definitions */
typedef scalar_t__ time_t;
struct timeval {
  scalar_t__ tv_sec;
};

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
time_t time(time_t *t) {
  struct timeval tt;
  if (gettimeofday(&tt, NULL) == -1)
    return (time_t)-1;
  if (t != NULL)
    *t = (time_t)tt.tv_sec;
  return (time_t)tt.tv_sec;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    113f <time+0x2f>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    115d <time+0x4d>
cmpq   $0x0,-0x10(%rbp)
je     1155 <time+0x45>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
je     1138 <time+0x28>
mov    0x8(%rsp),%rax
test   %rbx,%rbx
je     113f <time+0x2f>
mov    %rax,(%rbx)
jmp    113f <time+0x2f>
mov    $0xffffffffffffffff,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
define i64 @time(i64* %0) {
%2 = alloca i64
%3 = alloca i64*
%4 = alloca %struct.timeval
store i64* %0, i64** %3
%5 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %1
store i64 -1, i64* %2
br label %18
8: ; preds = %1
%9 = load i64*, i64** %3
%10 = icmp ne i64* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%13 = load i64, i64* %12
%14 = load i64*, i64** %3
store i64 %13, i64* %14
br label %15
15: ; preds = %11, %8
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%17 = load i64, i64* %16
store i64 %17, i64* %2
br label %18
18: ; preds = %15, %7
%19 = load i64, i64* %2
ret i64 %19
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
define i64 @time(i64* writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp eq i32 %4, -1
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = icmp eq i64* %0, null
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%9 = load i64, i64* %8
br i1 %7, label %11, label %10
10: ; preds = %6
store i64 %9, i64* %0
br label %11
11: ; preds = %6, %10, %1
%12 = phi i64 [ -1, %1 ], [ %9, %10 ], [ %9, %6 ]
ret i64 %12
}
int humming(int A, int B) {
  int i, tmp;
  int p = 0;
  tmp = xor(A, B);
  while (tmp > 0) {
    if (tmp & 1)
      p++;
    tmp = tmp << 1;
  }
  return p;
}


x86 assembly (clang, -O0):
<humming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <xor@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1165 <humming+0x55>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1157 <humming+0x47>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <humming+0x25>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<humming>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <xor@plt>
test   %eax,%eax
jle    112d <humming+0x1d>
xor    %ebx,%ebx
mov    %eax,%ecx
and    $0x1,%ecx
add    %ecx,%ebx
add    %eax,%eax
test   %eax,%eax
jg     1120 <humming+0x10>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @humming(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @xor to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 0, %2 ]
%7 = phi i32 [ %10, %5 ], [ %3, %2 ]
%8 = and i32 %7, 1
%9 = add nuw nsw i32 %6, %8
%10 = shl nuw i32 %7, 1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %9, %5 ]
ret i32 %13
}
int syscall(int function, int param1, int param2, int param3) {
  int ret;
  asm volatile("int $0x80"
               : "=a"(ret)
               : "0"(function), "b"(param1), "c"(param2), "d"(param3));
  return ret;
}


x86 assembly (clang, -O0):
<syscall>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ebx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%edx
int    $0x80
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall>:
push   %rbx
mov    %ecx,%eax
mov    %edx,%ecx
mov    %esi,%ebx
mov    %eax,%edx
mov    %edi,%eax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define i32 @syscall(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 asm sideeffect "int $$0x80", "={ax},0,{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %10, i32 %11, i32 %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
define i32 @syscall(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 asm sideeffect "int $$0x80", "={ax},0,{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
void mockup_void(void *user_data) {
  if (user_data != NULL) {
    *((int *)user_data) = 6;
  }
}


x86 assembly (clang, -O0):
<mockup_void>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     111d <mockup_void+0x1d>
mov    -0x8(%rbp),%rax
movl   $0x6,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mockup_void>:
test   %rdi,%rdi
je     110b <mockup_void+0xb>
movl   $0x6,(%rdi)
ret

LLVM IR (-O0):
define void @mockup_void(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to i32*
store i32 6, i32* %7
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @mockup_void(i8* writeonly %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = bitcast i8* %0 to i32*
store i32 6, i32* %4
br label %5
5: ; preds = %3, %1
ret void
}
unsigned long bit_clear(register unsigned long value,
                        register unsigned long pos) {
  return (value &= ~(1 << (pos)));
}


x86 assembly (clang, -O0):
<bit_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
cltq
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_clear>:
mov    %rsi,%rcx
mov    $0xfffffffe,%eax
rol    %cl,%eax
cltq
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @bit_clear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = sext i32 %8 to i64
%10 = load i64, i64* %3
%11 = and i64 %10, %9
store i64 %11, i64* %3
ret i64 %11
}

LLVM IR (-O2):
define i64 @bit_clear(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl nuw i32 1, %3
%5 = xor i32 %4, -1
%6 = sext i32 %5 to i64
%7 = and i64 %6, %0
ret i64 %7
}
void GotPromptStart(struct connection *c, char *d) {}


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

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

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

LLVM IR (-O2):
%struct.connection = type opaque
define void @GotPromptStart(%struct.connection* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ nrerror(char *);
unsigned long *nr_lvector(long nl, long nh) {
  unsigned long *v;
  v = (unsigned long *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(long)));
  if (!v)
    nrerror("allocation failure in lvector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<nr_lvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1164 <nr_lvector+0x44>
lea    0xea1(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0x8,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nr_lvector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %rdi,%rsi
lea    0x10(,%rsi,8),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <nr_lvector+0x2b>
lea    0xeba(%rip),%rdi
call   1030 <nrerror@plt>
shl    $0x3,%r14
sub    %r14,%rbx
add    $0x8,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in lvector()\00"
define i64* @nr_lvector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 8
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i64*
store i64* %13, i64** %5
%14 = load i64*, i64** %5
%15 = icmp ne i64* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load i64*, i64** %5
%20 = load i64, i64* %3
%21 = sub i64 0, %20
%22 = getelementptr inbounds i64, i64* %19, i64 %21
%23 = getelementptr inbounds i64, i64* %22, i64 1
ret i64* %23
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in lvector()\00"
define i64* @nr_lvector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 3
%5 = add i64 %4, 16
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to i64*
%12 = sub i64 0, %0
%13 = getelementptr inbounds i64, i64* %11, i64 %12
%14 = getelementptr inbounds i64, i64* %13, i64 1
ret i64* %14
}
/* Type definitions */
struct tdb_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ F_RDLCK;
int /*<<< orphan*/ F_SETLK;
int _tdb_lockall(struct tdb_context *, int /*<<< orphan*/, int /*<<< orphan*/);
int ext2fs_tdb_lockall_read_nonblock(struct tdb_context *tdb) {
  return _tdb_lockall(tdb, F_RDLCK, F_SETLK);
}


x86 assembly (clang, -O0):
<ext2fs_tdb_lockall_read_nonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    0x2eb8(%rip),%rax
mov    (%rax),%edx
call   1030 <_tdb_lockall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ext2fs_tdb_lockall_read_nonblock>:
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
mov    0x2ec8(%rip),%rax
mov    (%rax),%edx
jmp    1030 <_tdb_lockall@plt>

LLVM IR (-O0):
%struct.tdb_context = type { i32 }
@F_RDLCK = global i32 0
@F_SETLK = global i32 0
define i32 @ext2fs_tdb_lockall_read_nonblock(%struct.tdb_context* %0) {
%2 = alloca %struct.tdb_context*
store %struct.tdb_context* %0, %struct.tdb_context** %2
%3 = load %struct.tdb_context*, %struct.tdb_context** %2
%4 = load i32, i32* @F_RDLCK
%5 = load i32, i32* @F_SETLK
%6 = call i32 @_tdb_lockall(%struct.tdb_context* %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.tdb_context = type { i32 }
@F_RDLCK = global i32 0
@F_SETLK = global i32 0
define i32 @ext2fs_tdb_lockall_read_nonblock(%struct.tdb_context* %0) {
%2 = load i32, i32* @F_RDLCK
%3 = load i32, i32* @F_SETLK
%4 = tail call i32 @_tdb_lockall(%struct.tdb_context* %0, i32 %2, i32 %3)
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint16_t st103_get_tx_addr(uint8_t ep_num) {
  uint16_t *reg_p = (uint16_t *)((0x40006000UL) + (ep_num * 8 + 0) * 2);
  return *reg_p;
}


x86 assembly (clang, -O0):
<st103_get_tx_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
add    $0x0,%eax
shl    $0x1,%eax
cltq
add    $0x40006000,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st103_get_tx_addr>:
movslq %edi,%rax
shl    $0x4,%rax
mov    0x40006000(%rax),%eax
ret

LLVM IR (-O0):
define i32 @st103_get_tx_addr(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 8
%6 = add nsw i32 %5, 0
%7 = mul nsw i32 %6, 2
%8 = sext i32 %7 to i64
%9 = add i64 1073766400, %8
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @st103_get_tx_addr(i32 %0) {
%2 = shl nsw i32 %0, 4
%3 = sext i32 %2 to i64
%4 = add nsw i64 %3, 1073766400
%5 = inttoptr i64 %4 to i32*
%6 = load i32, i32* %5
ret i32 %6
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dmeankbn(int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dmeankbn(N, x, stride);
  printf("mean: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
call   1040 <stdlib_strided_dmeankbn@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dmeankbn@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x double]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dmeankbn(i32 %6, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dmeankbn(i32 4, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
long __float2ll_rn(float);
long lrintf(float __a) { return __float2ll_rn(__a); }


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

x86 assembly (clang, -O2):
<lrintf>:
jmp    1030 <__float2ll_rn@plt>

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

LLVM IR (-O2):
define i64 @lrintf(float %0) {
%2 = tail call i64 @__float2ll_rn(float %0)
ret i64 %2
}
float do_math(float arg1, int arg2) { return arg2 / arg1; }


x86 assembly (clang, -O0):
<do_math>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_math>:
cvtsi2ss %edi,%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @do_math(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to float
%7 = load float, float* %3
%8 = fdiv float %6, %7
ret float %8
}

LLVM IR (-O2):
define float @do_math(float %0, i32 %1) {
%3 = sitofp i32 %1 to float
%4 = fdiv float %3, %0
ret float %4
}
/* Variables and functions */
char *strdup(char const *);
char *gnu_strdup(const char *str) { return strdup(str); }


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

x86 assembly (clang, -O2):
<gnu_strdup>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @gnu_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
void gtk_menu_item_toggle_size_allocate() {}


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

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

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

LLVM IR (-O2):
define void @gtk_menu_item_toggle_size_allocate() {
ret void
}
/* Variables and functions */
void *wrapper();
void test_wrapper() {
  void *buf = wrapper();
  (void)buf;
}


x86 assembly (clang, -O0):
<test_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <wrapper@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_wrapper() {
%1 = alloca i8*
%2 = call i8* (...) @wrapper()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
define void @test_wrapper() {
%1 = tail call i8* (...) @wrapper()
ret void
}
char *strchr(char *s, int c) {
  do
    if (*s == c)
      return s;
  while (*s++);
  return ((void *)0);
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114d <strchr+0x4d>
jmp    112d <strchr+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rax),%ecx
cmp    %esi,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %3
11: ; preds = %8, %3
%12 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %12
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  int i;
  for (i = 0; i < 10; i++) {
    puts("Hello, World!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114a <main+0x3a>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, World!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}