xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sendCommand(unsigned char, int, unsigned char, unsigned char,
                               unsigned char);
void LivingColors_turnLampOnHSV(unsigned char index, unsigned char h,
                                unsigned char s, unsigned char v) {
  sendCommand(index, 0x05, h, s, v);
}


x86 assembly (clang, -O0):
<LivingColors_turnLampOnHSV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %cl,-0x3(%rbp)
mov    %al,-0x4(%rbp)
mov    -0x1(%rbp),%dl
mov    -0x2(%rbp),%cl
mov    -0x3(%rbp),%al
mov    $0x5,%esi
movzbl %dl,%edi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x4(%rbp),%r8d
call   1030 <sendCommand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LivingColors_turnLampOnHSV>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x5,%esi
jmp    1030 <sendCommand@plt>

LLVM IR (-O0):
define void @LivingColors_turnLampOnHSV(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i8, i8* %5
%10 = load i8, i8* %6
%11 = load i8, i8* %7
%12 = load i8, i8* %8
%13 = call i32 @sendCommand(i8 zeroext %9, i32 5, i8 zeroext %10, i8 zeroext %11, i8 zeroext %12)
ret void
}

LLVM IR (-O2):
define void @LivingColors_turnLampOnHSV(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = tail call i32 @sendCommand(i8 zeroext %0, i32 5, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ UP3D_GetParameter(int);
int32_t UP3D_GetCheck24V() { return UP3D_GetParameter(0x32); }


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

x86 assembly (clang, -O2):
<UP3D_GetCheck24V>:
mov    $0x32,%edi
jmp    1030 <UP3D_GetParameter@plt>

LLVM IR (-O0):
define i32 @UP3D_GetCheck24V() {
%1 = call i32 @UP3D_GetParameter(i32 50)
ret i32 %1
}

LLVM IR (-O2):
define i32 @UP3D_GetCheck24V() {
%1 = tail call i32 @UP3D_GetParameter(i32 50)
ret i32 %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ print_str(char *);
int /*<<< orphan*/ usart_init();
void main(void) {
  usart_init();
  print_str("Hello world!\n");
  *((volatile uint32_t *)(((volatile uint32_t)0xE000E010) + 0x04)) = 7200000;
  *((volatile uint32_t *)(((volatile uint32_t)0xE000E010) + 0x08)) = 0;
  *((volatile uint32_t *)(((volatile uint32_t)0xE000E010) + 0x00)) = 0x07;
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <usart_init@plt>
lea    0xece(%rip),%rdi
call   1030 <print_str@plt>
mov    $0xffffffffe000e014,%rax
movl   $0x6ddd00,(%rax)
mov    $0xffffffffe000e018,%rax
movl   $0x0,(%rax)
mov    $0xffffffffe000e010,%rax
movl   $0x7,(%rax)
jmp    115e <main+0x3e>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <usart_init@plt>
lea    0xed1(%rip),%rdi
call   1030 <print_str@plt>
movl   $0x6ddd00,0xffffffffe000e014
movl   $0x0,0xffffffffe000e018
movl   $0x7,0xffffffffe000e010
cs nopw 0x0(%rax,%rax,1)
nop
jmp    1160 <main+0x40>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define void @main() {
%1 = call i32 (...) @usart_init()
%2 = call i32 @print_str(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store volatile i32 7200000, i32* inttoptr (i64 -536813548 to i32*)
store volatile i32 0, i32* inttoptr (i64 -536813544 to i32*)
store volatile i32 7, i32* inttoptr (i64 -536813552 to i32*)
br label %3
3: ; preds = %0, %3
br label %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
define void @main() {
%1 = tail call i32 (...) @usart_init()
%2 = tail call i32 @print_str(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store volatile i32 7200000, i32* inttoptr (i64 -536813548 to i32*)
store volatile i32 0, i32* inttoptr (i64 -536813544 to i32*)
store volatile i32 7, i32* inttoptr (i64 -536813552 to i32*)
br label %3
3: ; preds = %0, %3
br label %3
}
void f(const int *c) {}


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

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

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

LLVM IR (-O2):
define void @f(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int mutual_s1(int);
int mutual_s2(int bla) { return mutual_s1(bla - 1); }


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

x86 assembly (clang, -O2):
<mutual_s2>:
add    $0xffffffff,%edi
jmp    1030 <mutual_s1@plt>

LLVM IR (-O0):
define i32 @mutual_s2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = call i32 @mutual_s1(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @mutual_s2(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = tail call i32 @mutual_s1(i32 %2)
ret i32 %3
}
void XwcTextEscapement() {}


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

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

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

LLVM IR (-O2):
define void @XwcTextEscapement() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
extern void logger_close() { closelog(); }


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

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

LLVM IR (-O0):
define void @logger_close() {
%1 = call i32 (...) @closelog()
ret void
}

LLVM IR (-O2):
define void @logger_close() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ InitQueryModule();
int /*<<< orphan*/ RunTests(int);
int atoi(char *);
int main(int argc, char **argv) {
  InitQueryModule();
  int i = -1;
  if (argc > 1) {
    i = atoi(argv[1]);
  }
  RunTests(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <InitQueryModule@plt>
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    116e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <RunTests@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <InitQueryModule@plt>
mov    $0xffffffff,%edi
cmp    $0x2,%ebp
jl     1154 <main+0x24>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <RunTests@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @InitQueryModule()
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ %8, %5 ], [ -1, %2 ]
%11 = tail call i32 @RunTests(i32 %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int intE6_handler() {
  printf("intE6 not supported right now.\n");
  return 1;
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"intE6 not supported right now.\0A\00"
define i32 @intE6_handler() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [31 x i8] c"intE6 not supported right now.\00"
define i32 @intE6_handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ mempcpy(int *, int *, int);
void mempcpy8() {
  int a[4] = {0};
  mempcpy(a + 1, a + 2, 8);
}


x86 assembly (clang, -O0):
<mempcpy8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0x10(%rbp),%rdi
add    $0x4,%rdi
lea    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1040 <mempcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mempcpy8>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1030 <mempcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @mempcpy8() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds i32, i32* %5, i64 2
%7 = call i32 @mempcpy(i32* %4, i32* %6, i32 8)
ret void
}

LLVM IR (-O2):
define void @mempcpy8() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%5 = call i32 @mempcpy(i32* %3, i32* %4, i32 8)
ret void
}
void result_handler_end(void *data, const char *el) { return; }


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

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

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

LLVM IR (-O2):
define void @result_handler_end(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
union bpf_attr {
  int map_type;
  int key_size;
  int value_size;
  int max_entries;
  int map_flags;
};
typedef enum bpf_map_type { ____Placeholder_bpf_map_type } bpf_map_type;
typedef int /*<<< orphan*/ attr;

/* Variables and functions */
int /*<<< orphan*/ BPF_MAP_CREATE;
int /*<<< orphan*/ __NR_bpf;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, union bpf_attr *, int);
int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
                   int max_entries, int map_flags) {
  union bpf_attr attr = {
      .map_type = map_type,
      .key_size = key_size,
      .value_size = value_size,
      .max_entries = max_entries,
      .map_flags = map_flags,
  };
  return syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr));
}


x86 assembly (clang, -O0):
<bpf_create_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_create_map>:
push   %rax
mov    %r8d,(%rsp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    $0x4,%ecx
call   1030 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
%union.bpf_attr = type { i32 }
@__NR_bpf = global i32 0
@BPF_MAP_CREATE = global i32 0
define i32 @bpf_create_map(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %union.bpf_attr
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = bitcast %union.bpf_attr* %11 to i32*
%13 = load i32, i32* %10
store i32 %13, i32* %12
%14 = load i32, i32* @__NR_bpf
%15 = load i32, i32* @BPF_MAP_CREATE
%16 = call i32 @syscall(i32 %14, i32 %15, %union.bpf_attr* %11, i32 4)
ret i32 %16
}

LLVM IR (-O2):
%union.bpf_attr = type { i32 }
@__NR_bpf = global i32 0
@BPF_MAP_CREATE = global i32 0
define i32 @bpf_create_map(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %union.bpf_attr
%7 = bitcast %union.bpf_attr* %6 to i8*
%8 = getelementptr inbounds %union.bpf_attr, %union.bpf_attr* %6, i64 0, i32 0
store i32 %4, i32* %8
%9 = load i32, i32* @__NR_bpf
%10 = load i32, i32* @BPF_MAP_CREATE
%11 = call i32 @syscall(i32 %9, i32 %10, %union.bpf_attr* %6, i32 4)
ret i32 %11
}
/* Variables and functions */
int foo(int, int, int);
int main() {
  int a, b, c;
  a = 2;
  b = 1;
  c = 3;
  int d = 4;
  int *p = &d;
  int i;
  for (i = 0; i < 1234567; i++) {
    *p = foo(a, b, c);
  }
  return *p;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x12d687,-0x24(%rbp)
jge    117b <main+0x6b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <foo@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114a <main+0x3a>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x12d687,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <foo@plt>
add    $0xffffffff,%ebx
jne    1120 <main+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @foo(i32 2, i32 1, i32 3)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 1234567
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ foo(unsigned int);
void test(unsigned a) {
  switch (a) {
    a += 5;
  case 2:
    a *= 10;
  case 3:
    a %= 2;
  }
  foo(a);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x2,%eax
je     1140 <test+0x30>
jmp    112f <test+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     1147 <test+0x37>
jmp    1150 <test+0x40>
imul   $0xa,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
cmp    $0x3,%edi
je     1121 <test+0x11>
cmp    $0x2,%edi
jne    111c <test+0xc>
xor    %edi,%edi
jmp    1030 <foo@plt>
mov    $0x1,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 2, label %4
i32 3, label %7
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = mul i32 %5, 10
store i32 %6, i32* %2
br label %7
7: ; preds = %1, %4
%8 = load i32, i32* %2
%9 = urem i32 %8, 2
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
%12 = call i32 @foo(i32 %11)
ret void
}

LLVM IR (-O2):
define void @test(i32 %0) {
switch i32 %0, label %5 [
i32 2, label %2
i32 3, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 1, %1 ], [ 0, %2 ]
br label %5
5: ; preds = %3, %1
%6 = phi i32 [ %0, %1 ], [ %4, %3 ]
%7 = tail call i32 @foo(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void __attribute__((constructor)) __watermark_ctor() {
  fprintf(stderr, "coprthr-1.6-CURRENT (Freewill)"
                  "\n");
}


x86 assembly (clang, -O0):
<__watermark_ctor>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__watermark_ctor>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"coprthr-1.6-CURRENT (Freewill)\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__watermark_ctor, i8* null }]
define void @__watermark_ctor() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"coprthr-1.6-CURRENT (Freewill)\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__watermark_ctor, i8* null }]
define void @__watermark_ctor() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}
void initialise_syscalls() { ; }


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

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

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

LLVM IR (-O2):
define void @initialise_syscalls() {
ret void
}
void *test_anti_range_141(int n) {
  extern void *alloc_anti_range_141(int) __attribute__((alloc_size(1)));
  if (-1 <= n && n <= 2)
    n = -1 - 1;
  return alloc_anti_range_141(n);
}


x86 assembly (clang, -O0):
<test_anti_range_141>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xffffffff,%eax
cmp    -0x4(%rbp),%eax
jg     113a <test_anti_range_141+0x2a>
cmpl   $0x2,-0x4(%rbp)
jg     113a <test_anti_range_141+0x2a>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <alloc_anti_range_141@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_141>:
lea    0x1(%rdi),%eax
cmp    $0x4,%eax
mov    $0xfffffffe,%eax
cmovb  %eax,%edi
jmp    1030 <alloc_anti_range_141@plt>

LLVM IR (-O0):
define i8* @test_anti_range_141(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 -1, %3
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 -2, i32* %2
br label %9
9: ; preds = %8, %5, %1
%10 = load i32, i32* %2
%11 = call i8* @alloc_anti_range_141(i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @test_anti_range_141(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp ult i32 %2, 4
%4 = select i1 %3, i32 -2, i32 %0
%5 = tail call i8* @alloc_anti_range_141(i32 %4)
ret i8* %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *pixmap_format;
};
typedef TYPE_1__ XEDataObject;
typedef int /*<<< orphan*/ ScreenFormat;

/* Variables and functions */
void set_XEDataObject_pixmap_format(void *_p, void *_v) {
  ((XEDataObject *)_p)->pixmap_format = (ScreenFormat *)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32* }
define void @set_XEDataObject_pixmap_format(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32* %6, i32** %9
ret void
}

LLVM IR (-O2):
define void @set_XEDataObject_pixmap_format(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UI_DEV_DESTROY;
int close(int);
scalar_t__ ioctl(int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int uinput_close(int fd) {
  if (ioctl(fd, UI_DEV_DESTROY) < 0) {
    perror("UI_DEV_DESTROY");
  }
  return close(fd);
}


x86 assembly (clang, -O0):
<uinput_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1162 <uinput_close+0x32>
lea    0xea3(%rip),%rdi
call   1050 <perror@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uinput_close>:
push   %rbx
mov    %edi,%ebx
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
test   %rax,%rax
js     114e <uinput_close+0x1e>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>
lea    0xeab(%rip),%rdi
call   1050 <perror@plt>
jmp    1146 <uinput_close+0x16>

LLVM IR (-O0):
@UI_DEV_DESTROY = global i32 0
@.str = [15 x i8] c"UI_DEV_DESTROY\00"
define i32 @uinput_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @UI_DEV_DESTROY
%5 = call i64 @ioctl(i32 %3, i32 %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = call i32 @close(i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@UI_DEV_DESTROY = global i32 0
@.str = [15 x i8] c"UI_DEV_DESTROY\00"
define i32 @uinput_close(i32 %0) {
%2 = load i32, i32* @UI_DEV_DESTROY
%3 = tail call i64 @ioctl(i32 %0, i32 %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @close(i32 %0)
ret i32 %8
}
int rightmost_one(unsigned x) { return ~((~x + 1) | x) + 1; }


x86 assembly (clang, -O0):
<rightmost_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
or     -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rightmost_one>:
lea    -0x1(%rdi),%eax
not    %edi
and    %edi,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @rightmost_one(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = add i32 %4, 1
%6 = load i32, i32* %2
%7 = or i32 %5, %6
%8 = xor i32 %7, -1
%9 = add i32 %8, 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @rightmost_one(i32 %0) {
%2 = add i32 %0, -1
%3 = xor i32 %0, -1
%4 = and i32 %2, %3
%5 = add i32 %4, 1
ret i32 %5
}
int LeapCheck(year) {
  if ((year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<LeapCheck>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1143 <LeapCheck+0x43>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     114f <LeapCheck+0x4f>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <LeapCheck+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1156 <LeapCheck+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LeapCheck>:
imul   $0xc28f5c29,%edi,%eax
add    $0x51eb850,%eax
mov    %eax,%ecx
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
jb     1130 <LeapCheck+0x30>
ror    $0x2,%eax
cmp    $0x28f5c29,%eax
setae  %al
test   $0x3,%dil
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @LeapCheck(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 400
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = srem i32 %8, 100
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = srem i32 %12, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %1
store i32 1, i32* %2
br label %17
16: ; preds = %11, %7
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @LeapCheck(i32 %0) {
%2 = srem i32 %0, 400
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = srem i32 %0, 100
%6 = icmp ne i32 %5, 0
%7 = and i32 %0, 3
%8 = icmp eq i32 %7, 0
%9 = and i1 %6, %8
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %1
%12 = phi i32 [ 1, %1 ], [ %10, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ test_copyn();
int /*<<< orphan*/ test_equal();
int /*<<< orphan*/ test_equaln();
int /*<<< orphan*/ test_len();
int /*<<< orphan*/ test_start();
int main(void) {
  test_len();
  test_start();
  test_equal();
  test_equaln();
  test_copyn();
  _exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <test_len@plt>
mov    $0x0,%al
call   1070 <test_start@plt>
mov    $0x0,%al
call   1050 <test_equal@plt>
mov    $0x0,%al
call   1060 <test_equaln@plt>
mov    $0x0,%al
call   1040 <test_copyn@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <test_len@plt>
xor    %eax,%eax
call   1070 <test_start@plt>
xor    %eax,%eax
call   1050 <test_equal@plt>
xor    %eax,%eax
call   1060 <test_equaln@plt>
xor    %eax,%eax
call   1040 <test_copyn@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_len()
%3 = call i32 (...) @test_start()
%4 = call i32 (...) @test_equal()
%5 = call i32 (...) @test_equaln()
%6 = call i32 (...) @test_copyn()
%7 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_len()
%2 = tail call i32 (...) @test_start()
%3 = tail call i32 (...) @test_equal()
%4 = tail call i32 (...) @test_equaln()
%5 = tail call i32 (...) @test_copyn()
%6 = tail call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
scalar_t__ log(int);
double logDoubleFactorial(int n) {
  double logF = 0;
  for (int i = n; i > 1; i -= 2) {
    logF += log(i);
  }
  return logF;
}


x86 assembly (clang, -O0):
<logDoubleFactorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jle    1158 <logDoubleFactorial+0x48>
mov    -0x14(%rbp),%edi
call   1030 <log@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <logDoubleFactorial+0x19>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logDoubleFactorial>:
push   %rbx
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
cmp    $0x2,%edi
jl     1165 <logDoubleFactorial+0x55>
mov    %edi,%ebx
xorps  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
lea    -0x2(%rbx),%eax
cmp    $0x3,%ebx
mov    %eax,%ebx
ja     1130 <logDoubleFactorial+0x20>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @logDoubleFactorial(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
store i32 %0, i32* %2
store double 0.000000e+00, double* %3
%5 = load i32, i32* %2
store i32 %5, i32* %4
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %4
%11 = call i64 @log(i32 %10)
%12 = sitofp i64 %11 to double
%13 = load double, double* %3
%14 = fadd double %13, %12
store double %14, double* %3
br label %15
15: ; preds = %9
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 2
store i32 %17, i32* %4
br label %6
18: ; preds = %6
%19 = load double, double* %3
ret double %19
}

LLVM IR (-O2):
define double @logDoubleFactorial(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %5, %1
%4 = phi double [ 0.000000e+00, %1 ], [ %10, %5 ]
ret double %4
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ %0, %1 ]
%7 = phi double [ %10, %5 ], [ 0.000000e+00, %1 ]
%8 = tail call i64 @log(i32 %6)
%9 = sitofp i64 %8 to double
%10 = fadd double %7, %9
%11 = add nsw i32 %6, -2
%12 = icmp ugt i32 %6, 3
br i1 %12, label %5, label %3
}
int IDE1() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @IDE1() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("I am a typical host, unfortunatly...\n");
  printf("You see, I'm okay, don't you?\n");
  return 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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [38 x i8] c"I am a typical host, unfortunatly...\0A\00"
@.str.1 = [31 x i8] c"You see, I'm okay, don't you?\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 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [37 x i8] c"I am a typical host, unfortunatly...\00"
@str.2 = [30 x i8] c"You see, I'm okay, don't you?\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
ret i32 1
}
int b(int a, int b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @b(i32 %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int /*<<< orphan*/ SSL_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_shutdown(int /*<<< orphan*/ *);
void ssl_shutdown(void **ssl) {
  SSL *s = (SSL *)*ssl;
  if (!s)
    return;
  SSL_shutdown(s);
  SSL_free(s);
  *ssl = NULL;
}


x86 assembly (clang, -O0):
<ssl_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <ssl_shutdown+0x27>
jmp    1164 <ssl_shutdown+0x44>
mov    -0x10(%rbp),%rdi
call   1040 <SSL_shutdown@plt>
mov    -0x10(%rbp),%rdi
call   1030 <SSL_free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssl_shutdown>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rbx
test   %rbx,%rbx
je     1146 <ssl_shutdown+0x26>
mov    %rdi,%r14
mov    %rbx,%rdi
call   1040 <SSL_shutdown@plt>
mov    %rbx,%rdi
call   1030 <SSL_free@plt>
movq   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @ssl_shutdown(i8** nocapture %0) {
%2 = bitcast i8** %0 to i32**
%3 = load i32*, i32** %2
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @SSL_shutdown(i32* %3)
%7 = tail call i32 @SSL_free(i32* %3)
store i8* null, i8** %0
br label %8
8: ; preds = %1, %5
ret void
}
int left(int index) { return (index * 2 + 1); }


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

x86 assembly (clang, -O2):
<left>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @left(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int atoi(char *);
char *strchr(char *, char);
int /*<<< orphan*/ strncpy(char *, char *, int);
int get_content_length(char *buffer) {
  char tmp[32];
  char *colon = strchr(buffer, ':');
  strncpy(tmp, colon + 1, 32);
  return atoi(tmp);
}


x86 assembly (clang, -O0):
<get_content_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    $0x1,%rsi
mov    $0x20,%edx
call   1030 <strncpy@plt>
lea    -0x30(%rbp),%rdi
call   1050 <atoi@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_content_length>:
push   %rbx
sub    $0x20,%rsp
mov    $0x3a,%esi
call   1040 <strchr@plt>
lea    0x1(%rax),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_content_length(i8* %0) {
%2 = alloca i8*
%3 = alloca [32 x i8]
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strchr(i8* %5, i8 signext 58)
store i8* %6, i8** %4
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = call i32 @strncpy(i8* %7, i8* %9, i32 32)
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%12 = call i32 @atoi(i8* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @get_content_length(i8* %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = call i32 @strncpy(i8* %3, i8* %5, i32 32)
%7 = call i32 @atoi(i8* %3)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ test();
main() {
  test();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test()
ret i32 0
}
int mainHandle(char *message) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mainHandle(i8* nocapture readnone %0) {
ret i32 0
}
int do_335() { return 335; }


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

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

LLVM IR (-O0):
define i32 @do_335() {
ret i32 335
}

LLVM IR (-O2):
define i32 @do_335() {
ret i32 335
}
/* Type definitions */
struct pos {
  int dummy;
};

/* Variables and functions */
int probe_wdl(struct pos const *, int *);
unsigned tb_probe_wdl_impl(const struct pos *pos) {
  int success;
  int v = probe_wdl(pos, &success);
  if (success == 0)
    return 0xFFFFFFFF;
  return (unsigned)(v + 2);
}


x86 assembly (clang, -O0):
<tb_probe_wdl_impl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <probe_wdl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1142 <tb_probe_wdl_impl+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    114b <tb_probe_wdl_impl+0x3b>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tb_probe_wdl_impl>:
push   %rax
lea    0x4(%rsp),%rsi
call   1030 <probe_wdl@plt>
add    $0x2,%eax
cmpl   $0x1,0x4(%rsp)
sbb    %ecx,%ecx
or     %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.pos = type { i32 }
define i32 @tb_probe_wdl_impl(%struct.pos* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @probe_wdl(%struct.pos* %0, i32* %2)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
%7 = add nsw i32 %4, 2
%8 = select i1 %6, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
short strlen(char *);
void clean_text(char text[]) {
  short int i = 0;
  short int len = 0;
  len = strlen(text);
  for (i = 0; i < len; ++i) {
    text[i] = 0;
  }
}


x86 assembly (clang, -O0):
<clean_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %ax,-0xc(%rbp)
movw   $0x0,-0xa(%rbp)
movswl -0xa(%rbp),%eax
movswl -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    1169 <clean_text+0x59>
mov    -0x8(%rbp),%rax
movswq -0xa(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xa(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xa(%rbp)
jmp    113b <clean_text+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_text>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %ax,%ax
jle    113b <clean_text+0x1b>
movzwl %ax,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @clean_text(i8* %0) {
%2 = tail call signext i16 @strlen(i8* %0)
%3 = icmp sgt i16 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = zext i16 %2 to i64
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
int /*<<< orphan*/ printf(char *);
void *mem_stack_unit_constructor(void) {
  void *p = malloc(sizeof(uint64_t));
  if (p == NULL) {
    printf("mem.c, mem_stack_unit_constructor(), malloc()\n");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<mem_stack_unit_constructor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1167 <mem_stack_unit_constructor+0x37>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_stack_unit_constructor>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1142 <mem_stack_unit_constructor+0x12>
pop    %rcx
ret
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"mem.c, mem_stack_unit_constructor(), malloc()\0A\00"
define i8* @mem_stack_unit_constructor() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 4)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@str = [46 x i8] c"mem.c, mem_stack_unit_constructor(), malloc()\00"
define noalias i8* @mem_stack_unit_constructor() {
%1 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
ret i8* %1
}
long double fmaxd(long double x, long double y) { return (x > y ? x : y); }


x86 assembly (clang, -O0):
<fmaxd>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1132 <fmaxd+0x32>
jmp    1127 <fmaxd+0x27>
fldt   -0x10(%rbp)
fstpt  -0x2c(%rbp)
jmp    1138 <fmaxd+0x38>
fldt   -0x20(%rbp)
fstpt  -0x2c(%rbp)
fldt   -0x2c(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmaxd>:
fldt   0x18(%rsp)
fldt   0x8(%rsp)
fucomi %st(1),%st
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
ret

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

LLVM IR (-O2):
define x86_fp80 @fmaxd(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp ogt x86_fp80 %0, %1
%4 = select i1 %3, x86_fp80 %0, x86_fp80 %1
ret x86_fp80 %4
}
/* Variables and functions */
int fko_errstr(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int);
char *fko_errmsg(char *msg, int res) {
  static char err_msg[255 + 1] = {0};
  snprintf(err_msg, 255, "Error: %s: %i", msg, fko_errstr(res));
  return (err_msg);
}


x86 assembly (clang, -O0):
<fko_errmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <fko_errstr@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,%r8d
lea    0x2ef3(%rip),%rdi
mov    $0xff,%esi
lea    0xea7(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2edb(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fko_errmsg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <fko_errstr@plt>
lea    0x2f0b(%rip),%r14
lea    0xec4(%rip),%rdx
mov    %r14,%rdi
mov    $0xff,%esi
mov    %rbx,%rcx
mov    %eax,%r8d
call   1030 <snprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@fko_errmsg.err_msg = internal global [256 x i8] zeroinitializer
@.str = [14 x i8] c"Error: %s: %i\00"
define i8* @fko_errmsg(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 = load i32, i32* %4
%7 = call i32 @fko_errstr(i32 %6)
%8 = call i32 @snprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @fko_errmsg.err_msg, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @fko_errmsg.err_msg, i64 0, i64 0)
}

LLVM IR (-O2):
@fko_errmsg.err_msg = internal global [256 x i8] zeroinitializer
@.str = [14 x i8] c"Error: %s: %i\00"
define i8* @fko_errmsg(i8* %0, i32 %1) {
%3 = tail call i32 @fko_errstr(i32 %1)
%4 = tail call i32 @snprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @fko_errmsg.err_msg, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @fko_errmsg.err_msg, i64 0, i64 0)
}