xunge/DecIR huggingface dataset:
int main() {
  int a = 3;
  do {
    a--;
  } while (a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
br label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %3, label %9
9: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ casize();
bool caempty(void) { return (casize() == 0); }


x86 assembly (clang, -O0):
<caempty>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <casize@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<caempty>:
push   %rax
xor    %eax,%eax
call   1030 <casize@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @caempty() {
%1 = call i64 (...) @casize()
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @caempty() {
%1 = tail call i64 (...) @casize()
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
void ez_ptr_swap(void **_a, void **_b) {
  int *tmp = (int *)*_a;
  *_a = *_b;
  *_b = (void *)tmp;
}


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

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

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

LLVM IR (-O2):
define void @ez_ptr_swap(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
double elapsed_time() {
  double elapsed = 0.0;
  return elapsed;
}


x86 assembly (clang, -O0):
<elapsed_time>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<elapsed_time>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @elapsed_time() {
%1 = alloca double
store double 0.000000e+00, double* %1
%2 = load double, double* %1
ret double %2
}

LLVM IR (-O2):
define double @elapsed_time() {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_clear_cache_inv(void) { printf("\nOpenSHMEM Analyzer\n"); }


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

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

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

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_clear_cache_inv() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
int delayacct_is_task_waiting_on_io(struct task_struct *p) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define i32 @delayacct_is_task_waiting_on_io(%struct.task_struct* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t eeprom_read_byte(const uint8_t *addr) {
  uint32_t offset = (uint32_t)addr;
  if (offset >= 2048)
    return 0;
  return ((uint8_t *)0x14000000)[offset];
}


x86 assembly (clang, -O0):
<eeprom_read_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x800,-0x14(%rbp)
jl     1128 <eeprom_read_byte+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1137 <eeprom_read_byte+0x37>
movslq -0x14(%rbp),%rcx
mov    $0x14000000,%eax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eeprom_read_byte>:
xor    %eax,%eax
cmp    $0x7ff,%edi
jg     1114 <eeprom_read_byte+0x14>
movslq %edi,%rax
mov    0x14000000(,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @eeprom_read_byte(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = ptrtoint i32* %5 to i32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 2048
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %15
10: ; preds = %1
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* inttoptr (i64 335544320 to i32*), i64 %12
%14 = load i32, i32* %13
store i32 %14, i32* %2
br label %15
15: ; preds = %10, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @eeprom_read_byte(i32* %0) {
%2 = ptrtoint i32* %0 to i64
%3 = trunc i64 %2 to i32
%4 = icmp sgt i32 %3, 2047
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = shl i64 %2, 32
%7 = ashr exact i64 %6, 32
%8 = getelementptr inbounds i32, i32* inttoptr (i64 335544320 to i32*), i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %1, %5
%11 = phi i32 [ %9, %5 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void DoSomething(void) { printf("External library is doing something.\n"); }


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"External library is doing something.\0A\00"
define void @DoSomething() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [37 x i8] c"External library is doing something.\00"
define void @DoSomething() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strcmp(void const *, void const *);
int itemcmp(const void *a, const void *b) { return strcmp(a, b); }


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

x86 assembly (clang, -O2):
<itemcmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @itemcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void S_AddLoopSounds(void) {}


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

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

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

LLVM IR (-O2):
define void @S_AddLoopSounds() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int usage(const char *argv0) {
  fprintf(stderr, "usage: %s fileout width height dim look\n", argv0);
  return 1;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"usage: %s fileout width height dim look\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"usage: %s fileout width height dim look\0A\00"
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char *);
int route_check(const char *name, const char *mode) {
  return !strcmp(name, "/proc/net/route");
}


x86 assembly (clang, -O0):
<route_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<route_check>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"/proc/net/route\00"
define i32 @route_check(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @strcmp(i8* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@.str = [16 x i8] c"/proc/net/route\00"
define i32 @route_check(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
int fun900() { return 900; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x384,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x384,%eax
ret

LLVM IR (-O0):
define i32 @fun900() {
ret i32 900
}

LLVM IR (-O2):
define i32 @fun900() {
ret i32 900
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ notify_server();
int /*<<< orphan*/ setup_client_signals(struct sigaction *);
int /*<<< orphan*/ wait_for_signal(struct sigaction *);
void client_once(int operation) {
  struct sigaction signal_action;
  setup_client_signals(&signal_action);
  if (operation == 0x0) {
    wait_for_signal(&signal_action);
  } else {
    notify_server();
  }
}


x86 assembly (clang, -O0):
<client_once>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <setup_client_signals@plt>
cmpl   $0x0,-0x4(%rbp)
jne    115c <client_once+0x2c>
lea    -0x8(%rbp),%rdi
call   1050 <wait_for_signal@plt>
jmp    1163 <client_once+0x33>
mov    $0x0,%al
call   1040 <notify_server@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_once>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%rdi
call   1030 <setup_client_signals@plt>
test   %ebx,%ebx
je     114e <client_once+0x1e>
xor    %eax,%eax
call   1040 <notify_server@plt>
jmp    1158 <client_once+0x28>
lea    0x8(%rsp),%rdi
call   1050 <wait_for_signal@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigaction = type { i32 }
define void @client_once(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sigaction
store i32 %0, i32* %2
%4 = call i32 @setup_client_signals(%struct.sigaction* %3)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @wait_for_signal(%struct.sigaction* %3)
br label %11
9: ; preds = %1
%10 = call i32 (...) @notify_server()
br label %11
11: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
define void @client_once(i32 %0) {
%2 = alloca %struct.sigaction
%3 = bitcast %struct.sigaction* %2 to i8*
%4 = call i32 @setup_client_signals(%struct.sigaction* %2)
%5 = icmp eq i32 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @wait_for_signal(%struct.sigaction* %2)
br label %10
8: ; preds = %1
%9 = call i32 (...) @notify_server()
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  ((void)argc);
  ((void)argv);
  printf("POLARSSL_ENTROPY_C and/or "
         "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
         "POLARSSL_NET_C and/or POLARSSL_CTR_DRBG_C not defined.\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [134 x i8] c"POLARSSL_ENTROPY_C and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or POLARSSL_CTR_DRBG_C not defined.\0A\00"
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 = load i8**, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [133 x i8] c"POLARSSL_ENTROPY_C and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or POLARSSL_CTR_DRBG_C not defined.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([133 x i8], [133 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ INT_MIN;
unsigned int test4u(unsigned int x) {
  unsigned int y = (unsigned int)INT_MIN;
  return ~(x ^ y);
}


x86 assembly (clang, -O0):
<test4u>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4u>:
mov    %edi,%eax
mov    0x2edf(%rip),%rcx
xor    (%rcx),%eax
not    %eax
ret

LLVM IR (-O0):
@INT_MIN = global i64 0
define i32 @test4u(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i64, i64* @INT_MIN
%5 = trunc i64 %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = xor i32 %6, %7
%9 = xor i32 %8, -1
ret i32 %9
}

LLVM IR (-O2):
@INT_MIN = global i64 0
define i32 @test4u(i32 %0) {
%2 = load i64, i64* @INT_MIN
%3 = trunc i64 %2 to i32
%4 = xor i32 %3, %0
%5 = xor i32 %4, -1
ret i32 %5
}
/* Variables and functions */
int power_of_two(int);
int extend(int value, int category) {
  if (category == 0)
    return value;
  if (value < power_of_two(category - 1))
    return value + (1 - power_of_two(category));
  else
    return value;
}


x86 assembly (clang, -O0):
<extend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <extend+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <extend+0x6b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <power_of_two@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    1175 <extend+0x65>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <power_of_two@plt>
mov    %eax,%edx
mov    -0x14(%rbp),%eax
mov    $0x1,%ecx
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    117b <extend+0x6b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extend>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
test   %esi,%esi
je     1133 <extend+0x23>
mov    %esi,%ebx
lea    -0x1(%rbx),%edi
call   1030 <power_of_two@plt>
cmp    %ebp,%eax
jle    1133 <extend+0x23>
mov    %ebx,%edi
call   1030 <power_of_two@plt>
sub    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @extend(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = tail call i32 @power_of_two(i32 %5)
%7 = icmp sgt i32 %6, %0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 @power_of_two(i32 %1)
%10 = add nsw i32 %0, 1
%11 = sub i32 %10, %9
br label %12
12: ; preds = %4, %2, %8
%13 = phi i32 [ %11, %8 ], [ %0, %2 ], [ %0, %4 ]
ret i32 %13
}
/* Type definitions */
struct __test_metadata {
  int dummy;
};
struct __fixture_variant_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ epoll44(struct __test_metadata *);
void wrapper_epoll44(struct __test_metadata *_metadata,
                     struct __fixture_variant_metadata *variant) {
  epoll44(_metadata);
}


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

x86 assembly (clang, -O2):
<wrapper_epoll44>:
jmp    1030 <epoll44@plt>

LLVM IR (-O0):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll44(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* %1) {
%3 = alloca %struct.__test_metadata*
%4 = alloca %struct.__fixture_variant_metadata*
store %struct.__test_metadata* %0, %struct.__test_metadata** %3
store %struct.__fixture_variant_metadata* %1, %struct.__fixture_variant_metadata** %4
%5 = load %struct.__test_metadata*, %struct.__test_metadata** %3
%6 = call i32 @epoll44(%struct.__test_metadata* %5)
ret void
}

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll44(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* nocapture readnone %1) {
%3 = tail call i32 @epoll44(%struct.__test_metadata* %0)
ret void
}
/* Variables and functions */
int read(int, unsigned short *, int);
int readVBM(int fd, unsigned short *keys) {
  if (read(fd, keys, 2) < 2) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<readVBM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1030 <read@plt>
cmp    $0x2,%eax
jge    1145 <readVBM+0x35>
movl   $0x0,-0x4(%rbp)
jmp    114c <readVBM+0x3c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readVBM>:
push   %rax
mov    $0x2,%edx
call   1030 <read@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
setge  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @readVBM(i32 %0, i16* nocapture %1) {
%3 = tail call i32 @read(i32 %0, i16* %1, i32 2)
%4 = icmp sgt i32 %3, 1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
double fac(int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  scanf("%d", &num);
  printf("%.f\n", fac(num));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%.f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call double @fac(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ func4();
int /*<<< orphan*/ printf(char *);
void func3() {
  printf("This is func3\n");
  func4();
}


x86 assembly (clang, -O0):
<func3>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <func4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func3>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <func4@plt>

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

LLVM IR (-O2):
@str = [14 x i8] c"This is func3\00"
define void @func3() {
%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 (...) @func4()
ret void
}
unsigned f1(unsigned x, int y) { return x << (y & 31); }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
and    $0x1f,%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @f1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = and i32 %6, 31
%8 = shl i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @f1(i32 %0, i32 %1) {
%3 = and i32 %1, 31
%4 = shl i32 %0, %3
ret i32 %4
}
void XLookupKeysym() {}


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

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

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

LLVM IR (-O2):
define void @XLookupKeysym() {
ret void
}
int includekanji(str)
unsigned char *str;
{
  while (*str) {
    if (str[0] >= 0xb0)
      return 1;
    str += 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<includekanji>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1144 <includekanji+0x44>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xb0,%eax
jl     1133 <includekanji+0x33>
movl   $0x1,-0x4(%rbp)
jmp    114b <includekanji+0x4b>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <includekanji+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<includekanji>:
mov    (%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <includekanji+0x20>
add    $0x2,%rdi
nopl   0x0(%rax)
cmp    $0xb0,%cl
jae    1121 <includekanji+0x21>
movzbl (%rdi),%ecx
add    $0x2,%rdi
test   %cl,%cl
jne    1110 <includekanji+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @includekanji(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %7
4: ; preds = %7
%5 = load i8, i8* %11
%6 = icmp eq i8 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %11, %4 ], [ %0, %1 ]
%10 = icmp ugt i8 %8, -81
%11 = getelementptr inbounds i8, i8* %9, i64 2
br i1 %10, label %12, label %4
12: ; preds = %7, %4, %1
%13 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %7 ]
ret i32 %13
}
char **backtrace_symbols(void *const *buffer, int size) { return 0; }


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

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

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

LLVM IR (-O2):
define noalias i8** @backtrace_symbols(i8** nocapture readnone %0, i32 %1) {
ret i8** null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_array_int(int *array, char *fmt_str, int size) {
  int i = 0;
  for (i = 0; i < size; i++) {
    printf(fmt_str, array[i]);
  }
}


x86 assembly (clang, -O0):
<print_array_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115f <print_array_int+0x4f>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1131 <print_array_int+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array_int>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1145 <print_array_int+0x35>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_array_int+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @print_array_int(i32* nocapture %0, i8* %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* %1, i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compareData(const void *first, const void *second) {
  return strcmp((char *)first, (char *)second);
}


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

x86 assembly (clang, -O2):
<compareData>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compareData(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
double fabs(double);
int AproxEqualTol(double a, double b, double tol) {
  if (fabs(a - b) < tol)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<AproxEqualTol>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xedc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1143 <AproxEqualTol+0x43>
movl   $0x1,-0x4(%rbp)
jmp    114a <AproxEqualTol+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AproxEqualTol>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm2
seta   %al
ret

LLVM IR (-O0):
define i32 @AproxEqualTol(double %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fsub double %8, %9
%11 = call double @llvm.fabs.f64(double %10)
%12 = load double, double* %7
%13 = fcmp olt double %11, %12
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 1, i32* %4
br label %16
15: ; preds = %3
store i32 0, i32* %4
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
define i32 @AproxEqualTol(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
char *disemvowel(char *str) { return (char *)""; }


x86 assembly (clang, -O0):
<disemvowel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @disemvowel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @disemvowel(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Content-type: text/html\n\n");
  printf("NONOON!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Content-type: text/html\0A\0A\00"
@.str.1 = [9 x i8] c"NONOON!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"Content-type: text/html\0A\00"
@str.2 = [8 x i8] c"NONOON!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void close_file(void *stream) { close(*((int *)stream)); }


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

x86 assembly (clang, -O2):
<close_file>:
mov    (%rdi),%edi
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @close_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = call i32 @close(i32 %5)
ret void
}

LLVM IR (-O2):
define void @close_file(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @close(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void f11(void) {
  int m;
  int *g = &m;
  int **array[3];
  typedef int **arr[3];
  arr *b;
  b = &array;
  (*b)[0] = &g;
  *(*((*b)[0])) = 'd';
  putchar(*(*((*b)[0])));
}


x86 assembly (clang, -O0):
<f11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x10(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
movl   $0x64,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1030 <putchar@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f11>:
mov    $0x64,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @f11() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [3 x i32**]
%4 = alloca [3 x i32**]*
store i32* %1, i32** %2
store [3 x i32**]* %3, [3 x i32**]** %4
%5 = load [3 x i32**]*, [3 x i32**]** %4
%6 = getelementptr inbounds [3 x i32**], [3 x i32**]* %5, i64 0, i64 0
store i32** %2, i32*** %6
%7 = load [3 x i32**]*, [3 x i32**]** %4
%8 = getelementptr inbounds [3 x i32**], [3 x i32**]* %7, i64 0, i64 0
%9 = load i32**, i32*** %8
%10 = load i32*, i32** %9
store i32 100, i32* %10
%11 = load [3 x i32**]*, [3 x i32**]** %4
%12 = getelementptr inbounds [3 x i32**], [3 x i32**]* %11, i64 0, i64 0
%13 = load i32**, i32*** %12
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = call i32 @putchar(i32 %15)
ret void
}

LLVM IR (-O2):
define void @f11() {
%1 = tail call i32 @putchar(i32 100)
ret void
}
int BPQSerialGetData(struct TNCDATA *TNC, unsigned char *Message,
                     unsigned int BufLen, unsigned long *MsgLen) {
  return 0;
}


x86 assembly (clang, -O0):
<BPQSerialGetData>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TNCDATA = type opaque
define i32 @BPQSerialGetData(%struct.TNCDATA* %0, i8* %1, i32 %2, i64* %3) {
%5 = alloca %struct.TNCDATA*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64*
store %struct.TNCDATA* %0, %struct.TNCDATA** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i64* %3, i64** %8
ret i32 0
}

LLVM IR (-O2):
%struct.TNCDATA = type opaque
define i32 @BPQSerialGetData(%struct.TNCDATA* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i64* nocapture readnone %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_once();
int /*<<< orphan*/ test_random();
void main() {
  test_random();
  test_once();
}


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

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

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @test_random()
%2 = call i32 (...) @test_once()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @test_random()
%2 = tail call i32 (...) @test_once()
ret void
}
int test_imm_6Bint32_reg(int val) { return ((val) & (0x6B << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_6Bint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x6b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_6Bint32_reg(i32 %0) {
%2 = and i32 %0, 107
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ CU_ASSERT(int);
scalar_t__ tirer_carte(int /*<<< orphan*/);
void test_tirer_carte() { CU_ASSERT(tirer_carte(0) > 0 && tirer_carte(0)); }


x86 assembly (clang, -O0):
<test_tirer_carte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <tirer_carte@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jle    1152 <test_tirer_carte+0x32>
xor    %edi,%edi
call   1030 <tirer_carte@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <CU_ASSERT@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_tirer_carte>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <tirer_carte@plt>
test   %rax,%rax
jle    113e <test_tirer_carte+0x1e>
xor    %edi,%edi
call   1030 <tirer_carte@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%edi
pop    %rbx
jmp    1040 <CU_ASSERT@plt>

LLVM IR (-O0):
define void @test_tirer_carte() {
%1 = call i64 @tirer_carte(i32 0)
%2 = icmp sgt i64 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = call i64 @tirer_carte(i32 0)
%5 = icmp ne i64 %4, 0
br label %6
6: ; preds = %3, %0
%7 = phi i1 [ false, %0 ], [ %5, %3 ]
%8 = zext i1 %7 to i32
%9 = call i32 @CU_ASSERT(i32 %8)
ret void
}

LLVM IR (-O2):
define void @test_tirer_carte() {
%1 = tail call i64 @tirer_carte(i32 0)
%2 = icmp sgt i64 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i64 @tirer_carte(i32 0)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 0, %0 ], [ %6, %3 ]
%9 = tail call i32 @CU_ASSERT(i32 %8)
ret void
}
char *basename(const char *path) {
  register const char *s;
  register const char *p;
  p = s = path;
  while (*s) {
    if (*s++ == '/') {
      p = s;
    }
  }
  return (char *)p;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1149 <basename+0x49>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1144 <basename+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <basename+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1122 <basename+0x22>
lea    0x1(%rax),%rdx
nopl   (%rax)
cmp    $0x2f,%cl
cmove  %rdx,%rax
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <basename+0x10>
ret

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

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ %0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = icmp eq i8 %5, 47
%10 = select i1 %9, i8* %8, i8* %6
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i8* [ %0, %1 ], [ %10, %4 ]
ret i8* %14
}
/* Variables and functions */
double kth_element(int, int, double *);
double median(int n, double *arr) { return kth_element(n, n / 2, arr); }


x86 assembly (clang, -O0):
<median>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1030 <kth_element@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<median>:
mov    %rsi,%rdx
mov    %edi,%esi
shr    $0x1f,%esi
add    %edi,%esi
sar    %esi
jmp    1030 <kth_element@plt>

LLVM IR (-O0):
define double @median(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
store i32 %0, i32* %3
store double* %1, double** %4
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 2
%8 = load double*, double** %4
%9 = call double @kth_element(i32 %5, i32 %7, double* %8)
ret double %9
}

LLVM IR (-O2):
define double @median(i32 %0, double* %1) {
%3 = sdiv i32 %0, 2
%4 = tail call double @kth_element(i32 %0, i32 %3, double* %1)
ret double %4
}
/* Variables and functions */
float modff(float, float *);
float modone(float value) {
  float int_part;
  return modff(value, &int_part);
}


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

x86 assembly (clang, -O2):
<modone>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <modff@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define float @modone(float %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call float @modff(float %0, float* %2)
ret float %4
}
int SetEvent(HANDLE) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @SetEvent(i32 %0) {
ret i32 0
}
char *c_hello() {
  char *hello = "Hello I'm pure c function";
  return hello;
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Hello I'm pure c function\00"
define i8* @c_hello() {
%1 = alloca i8*
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
@.str = [26 x i8] c"Hello I'm pure c function\00"
define i8* @c_hello() {
ret i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0)
}