xunge/DecIR huggingface dataset:
void f1(int pa, int pb) {
  int x, y;
  printf("\nAddress of all the local and parameter variables of f1\n");
  printf("Address of parameter variable\n pa = %x\n,  pb = %x\n", &pa, &pb);
  printf("Address of local variables \n x = %x\n,  y = %x\n", &x, &y);
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf23(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
sub    $0x18,%rsp
mov    %edi,0xc(%rsp)
mov    %esi,0x8(%rsp)
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"\0AAddress of all the local and parameter variables of f1\0A\00"
@.str.1 = [51 x i8] c"Address of parameter variable\0A pa = %x\0A, pb = %x\0A\00"
@.str.2 = [47 x i8] c"Address of local variables \0A x = %x\0A, y = %x\0A\00"
define void @f1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
ret void
}

LLVM IR (-O2):
@.str.1 = [51 x i8] c"Address of parameter variable\0A pa = %x\0A, pb = %x\0A\00"
@.str.2 = [47 x i8] c"Address of local variables \0A x = %x\0A, y = %x\0A\00"
@str = [56 x i8] c"\0AAddress of all the local and parameter variables of f1\00"
define void @f1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = bitcast i32* %5 to i8*
%8 = bitcast i32* %6 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
ret void
}
int mg_if_create_conn(struct mg_connection *nc) {
  (void)nc;
  return 1;
}


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

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

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

LLVM IR (-O2):
%struct.mg_connection = type opaque
define i32 @mg_if_create_conn(%struct.mg_connection* nocapture readnone %0) {
ret i32 1
}
int security_file_fcntl(struct file *file, unsigned int cmd,
                        unsigned long arg) {
  return 0;
}


x86 assembly (clang, -O0):
<security_file_fcntl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.file = type opaque
define i32 @security_file_fcntl(%struct.file* %0, i32 %1, i64 %2) {
%4 = alloca %struct.file*
%5 = alloca i32
%6 = alloca i64
store %struct.file* %0, %struct.file** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
ret i32 0
}

LLVM IR (-O2):
%struct.file = type opaque
define i32 @security_file_fcntl(%struct.file* nocapture readnone %0, i32 %1, i64 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main() {
  fprintf(stderr, "[CRASH_TEST] Causing crash in untrusted code...\n");
  *(int *)0 = 0;
  fprintf(stderr, "[CRASH_TEST] FAIL: Survived crash attempt\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
movl   $0x0,(%rax)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xee5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [49 x i8] c"[CRASH_TEST] Causing crash in untrusted code...\0A\00"
@.str.1 = [43 x i8] c"[CRASH_TEST] FAIL: Survived crash attempt\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* null
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"[CRASH_TEST] Causing crash in untrusted code...\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
unreachable
}
int SDL_imageFilterMultByByteMMX(unsigned char *Src1, unsigned char *Dest,
                                 int length, unsigned char C) {
  return (0);
}


x86 assembly (clang, -O0):
<SDL_imageFilterMultByByteMMX>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SDL_imageFilterMultByByteMMX(i8* %0, i8* %1, i32 %2, i8 zeroext %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8 %3, i8* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @SDL_imageFilterMultByByteMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i8 zeroext %3) {
ret i32 0
}
/* Variables and functions */
char *to_unix_path(char *p) {
  if (p != NULL) {
    char *pp = p;
    while (*pp != 0) {
      if (*pp == '\\') {
        *pp = '/';
      }
      ++pp;
    }
  }
  return p;
}


x86 assembly (clang, -O0):
<to_unix_path>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1158 <to_unix_path+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1153 <to_unix_path+0x53>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1142 <to_unix_path+0x42>
mov    -0x10(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111b <to_unix_path+0x1b>
jmp    1158 <to_unix_path+0x58>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_unix_path>:
mov    %rdi,%rax
test   %rdi,%rdi
je     1123 <to_unix_path+0x23>
mov    %rax,%rcx
jmp    1117 <to_unix_path+0x17>
nopl   (%rax)
movb   $0x2f,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x5c,%dl
je     1110 <to_unix_path+0x10>
test   %dl,%dl
jne    1113 <to_unix_path+0x13>
ret

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

LLVM IR (-O2):
define i8* @to_unix_path(i8* returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %7
%4 = phi i8* [ %8, %7 ], [ %0, %1 ]
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %9
i8 92, label %6
]
6: ; preds = %3
store i8 47, i8* %4
br label %7
7: ; preds = %3, %6
%8 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
9: ; preds = %3, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, ...);
int set_nonblock(int sock) {
  return fcntl(sock, F_SETFL, O_NONBLOCK | fcntl(sock, F_GETFL));
}


x86 assembly (clang, -O0):
<set_nonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
or     %eax,%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_nonblock>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ebb(%rip),%rax
mov    (%rax),%r14d
mov    0x2ec1(%rip),%rax
mov    (%rax),%ebp
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1030 <fcntl@plt>
or     %eax,%ebp
mov    %ebx,%edi
mov    %r14d,%esi
mov    %ebp,%edx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_GETFL = global i32 0
define i32 @set_nonblock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* @O_NONBLOCK
%6 = load i32, i32* %2
%7 = load i32, i32* @F_GETFL
%8 = call i32 (i32, i32, ...) @fcntl(i32 %6, i32 %7)
%9 = or i32 %5, %8
%10 = call i32 (i32, i32, ...) @fcntl(i32 %3, i32 %4, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_GETFL = global i32 0
define i32 @set_nonblock(i32 %0) {
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @O_NONBLOCK
%4 = load i32, i32* @F_GETFL
%5 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %4)
%6 = or i32 %5, %3
%7 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %2, i32 %6)
ret i32 %7
}
int __index_to_bit(int index, int order) {
  int out;
  out = (1 << (1 << 3)) - (1 << ((1 << 3) - order));
  return out + (index >> order);
}


x86 assembly (clang, -O0):
<__index_to_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x8,%ecx
sub    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x100,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__index_to_bit>:
mov    $0x8,%cl
sub    %sil,%cl
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %esi,%ecx
sar    %cl,%edi
add    %edi,%eax
add    $0x100,%eax
ret

LLVM IR (-O0):
define i32 @__index_to_bit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sub nsw i32 8, %6
%8 = shl i32 1, %7
%9 = sub nsw i32 256, %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = ashr i32 %11, %12
%14 = add nsw i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @__index_to_bit(i32 %0, i32 %1) {
%3 = sub nsw i32 8, %1
%4 = shl nsw i32 -1, %3
%5 = ashr i32 %0, %1
%6 = add i32 %5, 256
%7 = add i32 %6, %4
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void _print_longint(void *d) {
  if (d == NULL)
    printf("0");
  else
    printf("%ld", *(long int *)d);
}


x86 assembly (clang, -O0):
<_print_longint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113a <_print_longint+0x2a>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114f <_print_longint+0x3f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_print_longint>:
test   %rdi,%rdi
je     1136 <_print_longint+0x16>
mov    (%rdi),%rsi
lea    0xed1(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
mov    $0x30,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%ld\00"
define void @_print_longint(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @putchar(i32 48)
br label %9
5: ; preds = %1
%6 = bitcast i8* %0 to i64*
%7 = load i64, i64* %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %7)
br label %9
9: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct ip {
  int ip_hl;
  int /*<<< orphan*/ ip_sum;
};

/* Variables and functions */
int /*<<< orphan*/ checksum(int /*<<< orphan*/ *, int);
void set_ip_check(struct ip *self) {
  self->ip_sum = checksum((uint16_t *)self, self->ip_hl * 4);
}


x86 assembly (clang, -O0):
<set_ip_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
shl    $0x2,%esi
call   1030 <checksum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ip_check>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
shl    $0x2,%esi
call   1030 <checksum@plt>
mov    %eax,0x4(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.ip = type { i32, i32 }
define void @set_ip_check(%struct.ip* %0) {
%2 = alloca %struct.ip*
store %struct.ip* %0, %struct.ip** %2
%3 = load %struct.ip*, %struct.ip** %2
%4 = bitcast %struct.ip* %3 to i32*
%5 = load %struct.ip*, %struct.ip** %2
%6 = getelementptr inbounds %struct.ip, %struct.ip* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 4
%9 = call i32 @checksum(i32* %4, i32 %8)
%10 = load %struct.ip*, %struct.ip** %2
%11 = getelementptr inbounds %struct.ip, %struct.ip* %10, i32 0, i32 1
store i32 %9, i32* %11
ret void
}

LLVM IR (-O2):
%struct.ip = type { i32, i32 }
define void @set_ip_check(%struct.ip* %0) {
%2 = getelementptr %struct.ip, %struct.ip* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = shl nsw i32 %3, 2
%5 = tail call i32 @checksum(i32* %2, i32 %4)
%6 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 1
store i32 %5, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
void ft_putstr_fd(char const *s, int fd) {
  if (s)
    write(fd, s, ft_strlen(s));
}


x86 assembly (clang, -O0):
<ft_putstr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115f <ft_putstr_fd+0x3f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr_fd>:
test   %rdi,%rdi
je     1144 <ft_putstr_fd+0x24>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>
ret

LLVM IR (-O0):
define void @ft_putstr_fd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %4
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @ft_strlen(i8* %10)
%12 = call i32 @write(i32 %8, i8* %9, i32 %11)
br label %13
13: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @ft_putstr_fd(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @ft_strlen(i8* %0)
%6 = tail call i32 @write(i32 %1, i8* %0, i32 %5)
br label %7
7: ; preds = %4, %2
ret void
}
int is_alpha(char c) {
  return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
}


x86 assembly (clang, -O0):
<is_alpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1129 <is_alpha+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <is_alpha+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <is_alpha+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alpha>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_alpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 122
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @is_alpha(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int foo(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int a = 1;
  int b = 2;
  int c = foo(a, b);
  a += 2;
  b = c * a;
  printf("foo(%d, %d) = %d", a, b, c);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <foo@plt>
lea    (%rax,%rax,2),%edx
lea    0xec6(%rip),%rdi
mov    $0x3,%esi
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"foo(%d, %d) = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @foo(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 2
store i32 %9, i32* %2
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = mul nsw i32 %10, %11
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"foo(%d, %d) = %d\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 1, i32 2)
%2 = mul nsw i32 %1, 3
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 3, i32 %2, i32 %1)
ret i32 0
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_border_set(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_border_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_border_set+0x2a>
jmp    1170 <cmd_border_set+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_border_set>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_border_set+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_border_set(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 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_border_set(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
void RTVfsObjFromVfs(void) {}


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

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

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

LLVM IR (-O2):
define void @RTVfsObjFromVfs() {
ret void
}
/* Variables and functions */
int getint(int *);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a;
  int i = getint(&a);
  printf("%i %i\n", i, a);
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%i %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @getint(i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}
int foo(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @foo() {
ret i32 0
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void main() { f(4); }


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

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

LLVM IR (-O0):
define void @main() {
%1 = call i32 @f(i32 4)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @f(i32 4)
ret void
}
void ami_context_menu_free(void) {}


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

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

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

LLVM IR (-O2):
define void @ami_context_menu_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
scalar_t__ f(int);
int /*<<< orphan*/ g(int);
scalar_t__ h(int /*<<< orphan*/);
int main() {
  if (f(65536) != h(g(65536)))
    _exit(-1);
  _exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x10000,%edi
call   1050 <f@plt>
mov    %rax,-0x10(%rbp)
mov    $0x10000,%edi
call   1060 <g@plt>
mov    %eax,%edi
call   1040 <h@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     1188 <main+0x48>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x10000,%edi
call   1050 <f@plt>
mov    %rax,%rbx
mov    $0x10000,%edi
call   1060 <g@plt>
mov    %eax,%edi
call   1040 <h@plt>
cmp    %rax,%rbx
jne    116b <main+0x2b>
xor    %edi,%edi
call   1030 <_exit@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @f(i32 65536)
%3 = call i32 @g(i32 65536)
%4 = call i64 @h(i32 %3)
%5 = icmp ne i64 %2, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @_exit(i32 -1)
unreachable
8: ; preds = %0
%9 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @f(i32 65536)
%2 = tail call i32 @g(i32 65536)
%3 = tail call i64 @h(i32 %2)
%4 = icmp eq i64 %1, %3
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @_exit(i32 -1)
unreachable
7: ; preds = %0
%8 = tail call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
int check_name(char **);
int main(int argc, char **argv) {
  if (argc < 2)
    return 0;
  return check_name(&argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    113c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    114c <main+0x3c>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
call   1030 <check_name@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jge    1118 <main+0x8>
xor    %eax,%eax
ret
add    $0x8,%rsi
mov    %rsi,%rdi
jmp    1030 <check_name@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = call i32 @check_name(i8** %11)
store i32 %12, i32* %3
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = tail call i32 @check_name(i8** %5)
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ 0, %2 ]
ret i32 %8
}
int fits_bits(int x, unsigned n) {
  unsigned count = (sizeof(int) << 3) - n;
  int leftright = (x << count) >> count;
  return x == leftright;
}


x86 assembly (clang, -O0):
<fits_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    $0x20,%eax
sub    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fits_bits>:
mov    %esi,%ecx
neg    %cl
mov    %edi,%edx
shl    %cl,%edx
sar    %cl,%edx
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @fits_bits(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = sub i64 32, %8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = shl i32 %11, %12
%14 = load i32, i32* %5
%15 = ashr i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %3
%17 = load i32, i32* %6
%18 = icmp eq i32 %16, %17
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @fits_bits(i32 %0, i32 %1) {
%3 = sub i32 32, %1
%4 = shl i32 %0, %3
%5 = ashr i32 %4, %3
%6 = icmp eq i32 %5, %0
%7 = zext i1 %6 to i32
ret i32 %7
}
int test_llist_get_ith() { return 0; }


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

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

LLVM IR (-O0):
define i32 @test_llist_get_ith() {
ret i32 0
}

LLVM IR (-O2):
define i32 @test_llist_get_ith() {
ret i32 0
}
int isspace(int c) {
  return ((unsigned)((c) - ('\0')) <= (unsigned)((' ') - ('\0'))) && c != '\n';
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
sub    $0x0,%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x5(%rbp)
ja     1125 <isspace+0x25>
cmpl   $0xa,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
cmp    $0x21,%edi
setb   %al
cmp    $0xa,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 0
%5 = icmp ule i32 %4, 32
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 10
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = icmp ult i32 %0, 33
%3 = icmp ne i32 %0, 10
%4 = and i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fact(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int (*)(), int *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main() {
  int a = 0;
  fprintf(stderr, " *** Main func: %p sp: %p\n", main, &a);
  printf("Result is %lld\n", fact(10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
mov    0x2e8b(%rip),%rdx
lea    -0x8(%rbp),%rcx
call   1040 <fprintf@plt>
mov    $0xa,%edi
call   1050 <fact@plt>
mov    %eax,%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    0x2e98(%rip),%rdx
lea    0x4(%rsp),%rcx
call   1040 <fprintf@plt>
mov    $0xa,%edi
call   1050 <fact@plt>
lea    0xeb0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c" *** Main func: %p sp: %p\0A\00"
@.str.1 = [16 x i8] c"Result is %lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 (...)* bitcast (i32 ()* @main to i32 (...)*), i32* %2)
%5 = call i32 @fact(i32 10)
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c" *** Main func: %p sp: %p\0A\00"
@.str.1 = [16 x i8] c"Result is %lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 (...)* bitcast (i32 ()* @main to i32 (...)*), i32* %1)
%5 = call i32 @fact(i32 10)
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int test_imm_C2int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xC2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C2int64_midword_mem>:
testb  $0xc2,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C2int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12713984
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool ts_get_transportpriority(const uint8_t *p_ts) {
  return !!(p_ts[1] & 0x20);
}


x86 assembly (clang, -O0):
<ts_get_transportpriority>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_get_transportpriority>:
mov    0x4(%rdi),%eax
shr    $0x5,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ts_get_transportpriority(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, 32
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ts_get_transportpriority(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = lshr i32 %3, 5
%5 = and i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int LZ4_freeMC(void *LZ4MC_Data) {
  free(LZ4MC_Data);
  return (0);
}


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

x86 assembly (clang, -O2):
<LZ4_freeMC>:
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @LZ4_freeMC(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 0
}
int acpi_ioapic_add(struct acpi_pci_root *root) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.acpi_pci_root = type opaque
define i32 @acpi_ioapic_add(%struct.acpi_pci_root* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int f(int);
int main(void) { return f(7) + 2; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7,%edi
call   1030 <f@plt>
add    $0x2,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7,%edi
call   1030 <f@plt>
add    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 7)
%3 = add nsw i32 %2, 2
ret i32 %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 7)
%2 = add nsw i32 %1, 2
ret i32 %2
}
__attribute__((always_)) int func7b(int x) { return x < 23 ? 1 : 4; }


x86 assembly (clang, -O0):
<func7b>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x4,%eax
mov    $0x1,%ecx
cmp    $0x17,%edx
cmovl  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func7b>:
xor    %eax,%eax
cmp    $0x17,%edi
setge  %al
lea    (%rax,%rax,2),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @func7b(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 23
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 4
ret i32 %6
}

LLVM IR (-O2):
define i32 @func7b(i32 %0) {
%2 = icmp slt i32 %0, 23
%3 = select i1 %2, i32 1, i32 4
ret i32 %3
}
void *ax(q) {
  void *s = malloc(q);
  return s;
}


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

x86 assembly (clang, -O2):
<ax>:
movslq %edi,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @ax(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @ax(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
ret i8* %3
}
int testReturn() { return 10, 20, 30; }


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

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

LLVM IR (-O0):
define i32 @testReturn() {
ret i32 30
}

LLVM IR (-O2):
define i32 @testReturn() {
ret i32 30
}
/* Type definitions */
struct S {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ transfer(int *, struct S *);
void transfer2(struct S *s, int *x) { transfer(x, s); }


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

x86 assembly (clang, -O2):
<transfer2>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <transfer@plt>

LLVM IR (-O0):
%struct.S = type { i32 }
define void @transfer2(%struct.S* %0, i32* %1) {
%3 = alloca %struct.S*
%4 = alloca i32*
store %struct.S* %0, %struct.S** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load %struct.S*, %struct.S** %3
%7 = call i32 @transfer(i32* %5, %struct.S* %6)
ret void
}

LLVM IR (-O2):
%struct.S = type { i32 }
define void @transfer2(%struct.S* %0, i32* %1) {
%3 = tail call i32 @transfer(i32* %1, %struct.S* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int);
scalar_t__ time(int /*<<< orphan*/ *);
const char *duration(time_t start) {
  static char buf[16];
  int t = (int)(time(NULL) - start);
  sprintf(buf, "%2d:%02d", t / 60, t % 60);
  return buf;
}


x86 assembly (clang, -O0):
<duration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
sub    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x10(%rbp),%edx
lea    0x2edf(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2ecc(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<duration>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <time@plt>
sub    %rbx,%rax
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x5,%edx
add    %eax,%edx
imul   $0x3c,%edx,%eax
sub    %eax,%ecx
lea    0x2eec(%rip),%rbx
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@duration.buf = internal global [16 x i8] zeroinitializer
@.str = [9 x i8] c"%2d:%02d\00"
define i8* @duration(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = call i64 @time(i32* null)
%5 = load i64, i64* %2
%6 = sub nsw i64 %4, %5
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sdiv i32 %8, 60
%10 = load i32, i32* %3
%11 = srem i32 %10, 60
%12 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @duration.buf, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @duration.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@duration.buf = internal global [16 x i8] zeroinitializer
@.str = [9 x i8] c"%2d:%02d\00"
define i8* @duration(i64 %0) {
%2 = tail call i64 @time(i32* null)
%3 = sub nsw i64 %2, %0
%4 = trunc i64 %3 to i32
%5 = sdiv i32 %4, 60
%6 = srem i32 %4, 60
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @duration.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @duration.buf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ OpenSSL_add_ssl_algorithms();
int /*<<< orphan*/ SSL_load_error_strings();
int /*<<< orphan*/ printf(char *);
void init_openssl() {
  printf("2\n");
  SSL_load_error_strings();
  OpenSSL_add_ssl_algorithms();
}


x86 assembly (clang, -O0):
<init_openssl>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <SSL_load_error_strings@plt>
mov    $0x0,%al
call   1050 <OpenSSL_add_ssl_algorithms@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_openssl>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <SSL_load_error_strings@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <OpenSSL_add_ssl_algorithms@plt>

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

LLVM IR (-O2):
@str = [2 x i8] c"2\00"
define void @init_openssl() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @SSL_load_error_strings()
%3 = tail call i32 (...) @OpenSSL_add_ssl_algorithms()
ret void
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_textgenfunc(void) { return GppcFinfoV1(); }


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

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

LLVM IR (-O0):
define i8* @pg_finfo_textgenfunc() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_textgenfunc() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
XChangeGC() {}


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

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

LLVM IR (-O0):
define i32 @XChangeGC() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XChangeGC() {
ret i32 undef
}
void test_38_1(short *mem) { __atomic_fetch_nand(mem, 1, 4); }


x86 assembly (clang, -O0):
<test_38_1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movw   $0x1,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    %cx,-0x10(%rbp)
mov    (%rax),%ax
mov    %ax,-0xe(%rbp)
mov    -0xe(%rbp),%ax
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%dx
mov    %dx,%si
mov    %ax,%dx
mov    %edx,-0x28(%rbp)
and    %esi,%edx
mov    %edx,-0x24(%rbp)
not    %edx
mov    %edx,-0x20(%rbp)
lock cmpxchg %dx,(%rcx)
sete   %cl
mov    %ax,-0x1a(%rbp)
test   $0x1,%cl
mov    %ax,-0xe(%rbp)
jne    1162 <test_38_1+0x62>
jmp    1125 <test_38_1+0x25>
mov    -0x1a(%rbp),%ax
mov    %ax,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_38_1>:
movzwl (%rdi),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
not    %ecx
or     $0xfffe,%ecx
lock cmpxchg %cx,(%rdi)
jne    1110 <test_38_1+0x10>
ret

LLVM IR (-O0):
define void @test_38_1(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
store i16 1, i16* %3
%6 = load i16, i16* %3
%7 = atomicrmw nand i16* %5, i16 %6 acq_rel
store i16 %7, i16* %4
%8 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @test_38_1(i16* nocapture %0) {
%2 = atomicrmw nand i16* %0, i16 1 acq_rel
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t max(uint32_t a, uint32_t b) { return a > b ? a : b; }


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

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

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

LLVM IR (-O2):
define i64 @max(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}