xunge/DecIR huggingface dataset:
int checkContent(char c) {
  if (c == '[' || c == '{' || c == '(')
    return 1;
  if (c == ']' || c == '}' || c == ')')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<checkContent>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x5b,%eax
je     1131 <checkContent+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x7b,%eax
je     1131 <checkContent+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x28,%eax
jne    113d <checkContent+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1177 <checkContent+0x77>
movsbl -0x5(%rbp),%eax
cmp    $0x5d,%eax
je     1164 <checkContent+0x64>
movsbl -0x5(%rbp),%eax
cmp    $0x7d,%eax
je     1164 <checkContent+0x64>
movsbl -0x5(%rbp),%eax
cmp    $0x29,%eax
jne    1170 <checkContent+0x70>
movl   $0x0,-0x4(%rbp)
jmp    1177 <checkContent+0x77>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkContent>:
cmp    $0x29,%dil
je     1117 <checkContent+0x17>
cmp    $0x7d,%dil
je     1117 <checkContent+0x17>
mov    $0x1,%eax
cmp    $0x5d,%dil
jne    1119 <checkContent+0x19>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @checkContent(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 91
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 123
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 40
br i1 %14, label %15, label %16
15: ; preds = %11, %7, %1
store i32 1, i32* %2
br label %30
16: ; preds = %11
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 93
br i1 %19, label %28, label %20
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 125
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 41
br i1 %27, label %28, label %29
28: ; preds = %24, %20, %16
store i32 0, i32* %2
br label %30
29: ; preds = %24
store i32 1, i32* %2
br label %30
30: ; preds = %29, %28, %15
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @checkContent(i8 signext %0) {
switch i8 %0, label %3 [
i8 41, label %2
i8 93, label %2
i8 125, label %2
]
2: ; preds = %1, %1, %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ]
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int SHA256_DIGEST_LENGTH;
int /*<<< orphan*/ bbp_rmd160(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ bbp_sha256(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                              size_t);
void bbp_hash160(uint8_t *digest, const uint8_t *message, size_t len) {
  uint8_t tmp[SHA256_DIGEST_LENGTH];
  bbp_sha256(tmp, message, len);
  bbp_rmd160(digest, tmp, SHA256_DIGEST_LENGTH);
}


x86 assembly (clang, -O0):
<bbp_hash160>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <bbp_sha256@plt>
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    0x2e63(%rip),%rax
mov    (%rax),%edx
call   1040 <bbp_rmd160@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbp_hash160>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2eac(%rip),%r15
mov    (%r15),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1030 <bbp_sha256@plt>
mov    (%r15),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <bbp_rmd160@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SHA256_DIGEST_LENGTH = global i32 0
define void @bbp_hash160(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%9 = load i32, i32* @SHA256_DIGEST_LENGTH
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i32, i64 %10
store i64 %10, i64* %8
%13 = load i32*, i32** %5
%14 = load i64, i64* %6
%15 = call i32 @bbp_sha256(i32* %12, i32* %13, i64 %14)
%16 = load i32*, i32** %4
%17 = load i32, i32* @SHA256_DIGEST_LENGTH
%18 = call i32 @bbp_rmd160(i32* %16, i32* %12, i32 %17)
%19 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@SHA256_DIGEST_LENGTH = global i32 0
define void @bbp_hash160(i32* %0, i32* %1, i64 %2) {
%4 = load i32, i32* @SHA256_DIGEST_LENGTH
%5 = zext i32 %4 to i64
%6 = alloca i32, i64 %5
%7 = call i32 @bbp_sha256(i32* %6, i32* %1, i64 %2)
%8 = load i32, i32* @SHA256_DIGEST_LENGTH
%9 = call i32 @bbp_rmd160(i32* %0, i32* %6, i32 %8)
ret void
}
int main(void) {
  char hello[5];
  hello + 1;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds i8, i8* %2, i64 1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *);
int uspe_match_unpack(char *buffer, size_t buflen, u_int8_t *data,
                      size_t data_len) {
  snprintf(buffer, buflen, "tproxy");
  return 0;
}


x86 assembly (clang, -O0):
<uspe_match_unpack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdx
call   1030 <snprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"tproxy\00"
define i32 @uspe_match_unpack(i8* %0, i64 %1, i32* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @snprintf(i8* %9, i64 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"tproxy\00"
define i32 @uspe_match_unpack(i8* nocapture writeonly %0, i64 %1, i32* nocapture readnone %2, i64 %3) {
%5 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
__attribute__((constructor)) void init(void) {}


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer
define void @init() {
ret void
}
int test_imm_3Fint8_mem(signed char *val) {
  return ((*val) & (0x3F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Fint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x3f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_3Fint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 63
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ erase_flash();
int /*<<< orphan*/ fd_log_initialize();
int /*<<< orphan*/ fd_w25q16dw_initialize();
int /*<<< orphan*/ verify_add_sector_erase();
int /*<<< orphan*/ verify_empty_state();
int /*<<< orphan*/ verify_single_page_add_remove();
int /*<<< orphan*/ verify_two_page_wrap();
void fd_storage_unit_tests(void) {
  fd_log_initialize();
  fd_w25q16dw_initialize();
  verify_add_sector_erase();
  erase_flash();
  verify_empty_state();
  verify_single_page_add_remove();
  verify_two_page_wrap();
}


x86 assembly (clang, -O0):
<fd_storage_unit_tests>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <fd_log_initialize@plt>
mov    $0x0,%al
call   1040 <fd_w25q16dw_initialize@plt>
mov    $0x0,%al
call   1070 <verify_add_sector_erase@plt>
mov    $0x0,%al
call   1060 <erase_flash@plt>
mov    $0x0,%al
call   1050 <verify_empty_state@plt>
mov    $0x0,%al
call   1090 <verify_single_page_add_remove@plt>
mov    $0x0,%al
call   1080 <verify_two_page_wrap@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_storage_unit_tests>:
push   %rax
xor    %eax,%eax
call   1030 <fd_log_initialize@plt>
xor    %eax,%eax
call   1040 <fd_w25q16dw_initialize@plt>
xor    %eax,%eax
call   1070 <verify_add_sector_erase@plt>
xor    %eax,%eax
call   1060 <erase_flash@plt>
xor    %eax,%eax
call   1050 <verify_empty_state@plt>
xor    %eax,%eax
call   1090 <verify_single_page_add_remove@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <verify_two_page_wrap@plt>

LLVM IR (-O0):
define void @fd_storage_unit_tests() {
%1 = call i32 (...) @fd_log_initialize()
%2 = call i32 (...) @fd_w25q16dw_initialize()
%3 = call i32 (...) @verify_add_sector_erase()
%4 = call i32 (...) @erase_flash()
%5 = call i32 (...) @verify_empty_state()
%6 = call i32 (...) @verify_single_page_add_remove()
%7 = call i32 (...) @verify_two_page_wrap()
ret void
}

LLVM IR (-O2):
define void @fd_storage_unit_tests() {
%1 = tail call i32 (...) @fd_log_initialize()
%2 = tail call i32 (...) @fd_w25q16dw_initialize()
%3 = tail call i32 (...) @verify_add_sector_erase()
%4 = tail call i32 (...) @erase_flash()
%5 = tail call i32 (...) @verify_empty_state()
%6 = tail call i32 (...) @verify_single_page_add_remove()
%7 = tail call i32 (...) @verify_two_page_wrap()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ absolutex();
int /*<<< orphan*/ writememw65816(int /*<<< orphan*/, int /*<<< orphan*/);
void stzAbsx16(void) { writememw65816(absolutex(), 0); }


x86 assembly (clang, -O0):
<stzAbsx16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <absolutex@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <writememw65816@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stzAbsx16>:
push   %rax
xor    %eax,%eax
call   1040 <absolutex@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <writememw65816@plt>

LLVM IR (-O0):
define void @stzAbsx16() {
%1 = call i32 (...) @absolutex()
%2 = call i32 @writememw65816(i32 %1, i32 0)
ret void
}

LLVM IR (-O2):
define void @stzAbsx16() {
%1 = tail call i32 (...) @absolutex()
%2 = tail call i32 @writememw65816(i32 %1, i32 0)
ret void
}
void inplace_swap(int *x, int *y) {
  *x ^= *y;
  *y ^= *x;
  *x ^= *y;
}


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

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

LLVM IR (-O0):
define void @inplace_swap(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = xor i32 %8, %6
store i32 %9, i32* %7
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = xor i32 %13, %11
store i32 %14, i32* %12
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = xor i32 %18, %16
store i32 %19, i32* %17
ret void
}

LLVM IR (-O2):
define void @inplace_swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32, i32* %0
%5 = xor i32 %4, %3
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = xor i32 %6, %5
store i32 %7, i32* %1
%8 = load i32, i32* %0
%9 = xor i32 %8, %7
store i32 %9, i32* %0
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int uint32_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct ip {
  TYPE_1__ ip_dst;
};
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int *, int /*<<< orphan*/ *, int);
int IsBroadcast(struct ip *hdr) {
  uint32_t addr;
  assert(hdr != NULL);
  memcpy(&addr, &hdr->ip_dst.s_addr, sizeof(addr));
  if (addr == 0xFFFFFFFF)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<IsBroadcast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
cmpl   $0xffffffff,-0x14(%rbp)
jne    1166 <IsBroadcast+0x46>
movl   $0x1,-0x4(%rbp)
jmp    116d <IsBroadcast+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsBroadcast>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
cmpl   $0xffffffff,0xc(%rsp)
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.ip = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
define i32 @IsBroadcast(%struct.ip* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp ne %struct.ip* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 0, i32 0
%8 = call i32 @memcpy(i32* %2, i32* %7, i32 4)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, -1
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Type definitions */
struct stat {
  int st_size;
};
typedef int off_t;

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
off_t file_size(const char *filename) {
  struct stat s;
  if (stat(filename, &s) < 0)
    return -1;
  return s.st_size;
}


x86 assembly (clang, -O0):
<file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    113f <file_size+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1145 <file_size+0x35>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
js     1129 <file_size+0x19>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_size(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
int my_square_root(int nb) {
  int i;
  for (i = 0; i <= nb; i++) {
    if (i * i == nb)
      return (i);
  }
  return (0);
}


x86 assembly (clang, -O0):
<my_square_root>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1148 <my_square_root+0x48>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1135 <my_square_root+0x35>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <my_square_root+0x4f>
jmp    113a <my_square_root+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <my_square_root+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_square_root>:
test   %edi,%edi
js     1120 <my_square_root+0x20>
lea    0x1(%rdi),%ecx
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%edx
imul   %eax,%edx
cmp    %edi,%edx
je     1122 <my_square_root+0x22>
add    $0x1,%eax
cmp    %eax,%ecx
jne    1110 <my_square_root+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_square_root(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %7
%4 = phi i32 [ %8, %7 ], [ 0, %1 ]
%5 = mul nsw i32 %4, %4
%6 = icmp eq i32 %5, %0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = add nuw i32 %4, 1
%9 = icmp eq i32 %4, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %7, %1
%11 = phi i32 [ 0, %1 ], [ 0, %7 ], [ %4, %3 ]
ret i32 %11
}
void pthread_setcanceltype() {}


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

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

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

LLVM IR (-O2):
define void @pthread_setcanceltype() {
ret void
}
int gtsf2(float a, float b) { return a > b; }


x86 assembly (clang, -O0):
<gtsf2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtsf2>:
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @gtsf2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ogt float %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @gtsf2(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ manager_suspend();
void __attribute__((visibility("default"))) pthread_workqueue_suspend_np(void) {
  manager_suspend();
}


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

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

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

LLVM IR (-O2):
define void @pthread_workqueue_suspend_np() {
%1 = tail call i32 (...) @manager_suspend()
ret void
}
void exit() {}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
unreachable
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int /*<<< orphan*/);
void TOSH_MAKE_UART_RXD0_INPUT() { clear_io_bit(0x72, 0); }


x86 assembly (clang, -O0):
<TOSH_MAKE_UART_RXD0_INPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x72,%edi
xor    %esi,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_UART_RXD0_INPUT>:
mov    $0x72,%edi
xor    %esi,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_UART_RXD0_INPUT() {
%1 = call i32 @clear_io_bit(i32 114, i32 0)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_UART_RXD0_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 114, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ base_err_alloc(size_t);
void *realloc(void *, size_t);
void *base_realloc(void *ptr, size_t size) {
  void *tmp = realloc(ptr, size);
  if (tmp == NULL) {
    base_err_alloc(size);
  }
  return tmp;
}


x86 assembly (clang, -O0):
<base_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1155 <base_realloc+0x35>
mov    -0x10(%rbp),%rdi
call   1030 <base_err_alloc@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113c <base_realloc+0x1c>
mov    %r14,%rdi
call   1030 <base_err_alloc@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @base_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @base_err_alloc(i64 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int SlopeDiv(unsigned int num, unsigned int den) {
  int64_t ans;
  if (den < 512) {
    return 2048;
  } else {
    ans = ((int64_t)num << 3) / (den >> 8);
    if (ans <= 2048) {
      return (int)ans;
    } else {
      return 2048;
    }
  }
}


x86 assembly (clang, -O0):
<SlopeDiv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x200,-0xc(%rbp)
jae    1123 <SlopeDiv+0x23>
movl   $0x800,-0x4(%rbp)
jmp    1155 <SlopeDiv+0x55>
mov    -0x8(%rbp),%eax
shl    $0x3,%eax
mov    -0xc(%rbp),%ecx
shr    $0x8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x800,-0x10(%rbp)
jg     114e <SlopeDiv+0x4e>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <SlopeDiv+0x55>
movl   $0x800,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SlopeDiv>:
mov    $0x800,%eax
cmp    $0x200,%esi
jb     1128 <SlopeDiv+0x28>
shl    $0x3,%edi
shr    $0x8,%esi
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %eax,%ecx
cmp    $0x800,%eax
mov    $0x800,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @SlopeDiv(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp ult i32 %7, 512
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 2048, i32* %3
br label %21
10: ; preds = %2
%11 = load i32, i32* %4
%12 = shl i32 %11, 3
%13 = load i32, i32* %5
%14 = lshr i32 %13, 8
%15 = udiv i32 %12, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp sle i32 %16, 2048
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %21
20: ; preds = %10
store i32 2048, i32* %3
br label %21
21: ; preds = %20, %18, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @SlopeDiv(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, 512
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = shl i32 %0, 3
%6 = lshr i32 %1, 8
%7 = udiv i32 %5, %6
%8 = icmp ult i32 %7, 2048
%9 = select i1 %8, i32 %7, i32 2048
br label %10
10: ; preds = %4, %2
%11 = phi i32 [ 2048, %2 ], [ %9, %4 ]
ret i32 %11
}
/* Type definitions */
struct xmalloc_stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ xmalloc_stat_dec(struct xmalloc_stat *);
void xfree(void *ptr, struct xmalloc_stat *st) {
  free(ptr);
  if (ptr)
    xmalloc_stat_dec(st);
}


x86 assembly (clang, -O0):
<xfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x8(%rbp)
je     114d <xfree+0x2d>
mov    -0x10(%rbp),%rdi
call   1040 <xmalloc_stat_dec@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfree>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <free@plt>
test   %rbx,%rbx
je     1143 <xfree+0x23>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <xmalloc_stat_dec@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.xmalloc_stat = type { i32 }
define void @xfree(i8* %0, %struct.xmalloc_stat* %1) {
%3 = tail call i32 @free(i8* %0)
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @xmalloc_stat_dec(%struct.xmalloc_stat* %1)
br label %7
7: ; preds = %5, %2
ret void
}
void foo190(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo190(i32 %0) {
ret void
}
/* Type definitions */
struct timezone {
  long tv_sec;
};
struct timeval {
  long tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timezone *, struct timezone *);
int /*<<< orphan*/ memset(struct timezone *, int /*<<< orphan*/, int);
long get_sec(void) {
  struct timeval tv;
  struct timezone tz;
  memset(&tv, 0, sizeof(&tv));
  memset(&tz, 0, sizeof(&tz));
  gettimeofday(&tv, &tz);
  return tv.tv_sec;
}


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

x86 assembly (clang, -O2):
<get_sec>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
%struct.timezone = type { i64 }
define i64 @get_sec() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to %struct.timezone*
%4 = call i32 @memset(%struct.timezone* %3, i32 0, i32 8)
%5 = call i32 @memset(%struct.timezone* %2, i32 0, i32 8)
%6 = bitcast %struct.timeval* %1 to %struct.timezone*
%7 = call i32 @gettimeofday(%struct.timezone* %6, %struct.timezone* %2)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%9 = load i64, i64* %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
%struct.timezone = type { i64 }
define i64 @get_sec() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = bitcast %struct.timeval* %1 to %struct.timezone*
%6 = call i32 @memset(%struct.timezone* %5, i32 0, i32 8)
%7 = call i32 @memset(%struct.timezone* %2, i32 0, i32 8)
%8 = call i32 @gettimeofday(%struct.timezone* %5, %struct.timezone* %2)
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
ret i64 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ slk_attr();
uint32_t __darwin_slk_attr(void) { return slk_attr(); }


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

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

LLVM IR (-O0):
define i32 @__darwin_slk_attr() {
%1 = call i32 (...) @slk_attr()
ret i32 %1
}

LLVM IR (-O2):
define i32 @__darwin_slk_attr() {
%1 = tail call i32 (...) @slk_attr()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVBUF;
int /*<<< orphan*/ SO_SNDBUF;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              char *, int);
void set_socket_buff_size(int s, unsigned int w_size, unsigned int r_size) {
  setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&w_size, sizeof(int));
  setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&r_size, sizeof(int));
}


x86 assembly (clang, -O0):
<set_socket_buff_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
mov    0x2eac(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    -0x4(%rbp),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_socket_buff_size>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %esi,0x4(%rsp)
mov    %edx,(%rsp)
mov    0x2ec4(%rip),%r14
mov    (%r14),%esi
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r14),%esi
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_SNDBUF = global i32 0
@SO_RCVBUF = global i32 0
define void @set_socket_buff_size(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* @SOL_SOCKET
%9 = load i32, i32* @SO_SNDBUF
%10 = bitcast i32* %5 to i8*
%11 = call i32 @setsockopt(i32 %7, i32 %8, i32 %9, i8* %10, i32 4)
%12 = load i32, i32* %4
%13 = load i32, i32* @SOL_SOCKET
%14 = load i32, i32* @SO_RCVBUF
%15 = bitcast i32* %6 to i8*
%16 = call i32 @setsockopt(i32 %12, i32 %13, i32 %14, i8* %15, i32 4)
ret void
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_SNDBUF = global i32 0
@SO_RCVBUF = global i32 0
define void @set_socket_buff_size(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %1, i32* %4
store i32 %2, i32* %5
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_SNDBUF
%8 = bitcast i32* %4 to i8*
%9 = call i32 @setsockopt(i32 %0, i32 %6, i32 %7, i8* %8, i32 4)
%10 = load i32, i32* @SOL_SOCKET
%11 = load i32, i32* @SO_RCVBUF
%12 = bitcast i32* %5 to i8*
%13 = call i32 @setsockopt(i32 %0, i32 %10, i32 %11, i8* %12, i32 4)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t instruction_operation_extract_operation_mode(uint16_t instruction) {
  return (instruction >> 0x06) & 0x07;
}


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

x86 assembly (clang, -O2):
<instruction_operation_extract_operation_mode>:
mov    %edi,%eax
shr    $0x6,%eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @instruction_operation_extract_operation_mode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 6
%5 = and i32 %4, 7
ret i32 %5
}

LLVM IR (-O2):
define i32 @instruction_operation_extract_operation_mode(i32 %0) {
%2 = lshr i32 %0, 6
%3 = and i32 %2, 7
ret i32 %3
}
int main(int argc, const char *argv[]) {
  char i, a;
  a = i = 0;
  int c = 1;
  while (i < 10) {
    a = a + 2;
    ++i;
    c = c * 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movl   $0x1,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jge    114e <main+0x4e>
movsbl -0x12(%rbp),%eax
add    $0x2,%eax
mov    %al,-0x12(%rbp)
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1121 <main+0x21>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
struct tuning_param {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(struct tuning_param *);
void tuning_param_destroy_list(struct tuning_param *params) {
  assert(params != NULL);
  free(params);
}


x86 assembly (clang, -O0):
<tuning_param_destroy_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tuning_param_destroy_list>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.tuning_param = type { i32 }
define void @tuning_param_destroy_list(%struct.tuning_param* %0) {
%2 = alloca %struct.tuning_param*
store %struct.tuning_param* %0, %struct.tuning_param** %2
%3 = load %struct.tuning_param*, %struct.tuning_param** %2
%4 = icmp ne %struct.tuning_param* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load %struct.tuning_param*, %struct.tuning_param** %2
%8 = call i32 @free(%struct.tuning_param* %7)
ret void
}

LLVM IR (-O2):
%struct.tuning_param = type { i32 }
define void @tuning_param_destroy_list(%struct.tuning_param* %0) {
%2 = icmp ne %struct.tuning_param* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @free(%struct.tuning_param* %0)
ret void
}
/* Variables and functions */
char *convert(char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char *s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  printf("Original string:\t%s\nZigzag string:\t\t%s\n", s, convert(s, 5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1030 <convert@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <convert@plt>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [40 x i8] c"Original string:\09%s\0AZigzag string:\09\09%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @convert(i8* %4, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [40 x i8] c"Original string:\09%s\0AZigzag string:\09\09%s\0A\00"
define i32 @main() {
%1 = tail call i8* @convert(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int write(int, char *, int);
int pipe_write(int pipe, char *buffer, int count) {
  if (count == write(pipe, buffer, count))
    return (0);
  return (-1);
}


x86 assembly (clang, -O0):
<pipe_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    1150 <pipe_write+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1157 <pipe_write+0x47>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pipe_write>:
push   %rbx
mov    %edx,%ebx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @pipe_write(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%5 = icmp ne i32 %4, %2
%6 = sext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int /*<<< orphan*/ IntEnable(int);
int /*<<< orphan*/ IntRegister(int, void (*)());
void WatchdogIntRegister(unsigned long ulBase, void (*pfnHandler)(void)) {
  DEBUG_ASSERT((ulBase == 0x40000000) || (ulBase == 0x40001000));
  IntRegister(34, pfnHandler);
  IntEnable(34);
}


x86 assembly (clang, -O0):
<WatchdogIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x40000000,-0x8(%rbp)
40
mov    %al,-0x11(%rbp)
je     1161 <WatchdogIntRegister+0x31>
cmpq   $0x40001000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rsi
mov    $0x22,%edi
call   1040 <IntRegister@plt>
mov    $0x22,%edi
call   1030 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogIntRegister>:
push   %rbx
mov    %rsi,%rbx
and    $0xffffffffffffefff,%rdi
xor    %eax,%eax
cmp    $0x40000000,%rdi
sete   %al
mov    %eax,%edi
call   1050 <DEBUG_ASSERT@plt>
mov    $0x22,%edi
mov    %rbx,%rsi
call   1040 <IntRegister@plt>
mov    $0x22,%edi
pop    %rbx
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @WatchdogIntRegister(i64 %0, void ()* %1) {
%3 = alloca i64
%4 = alloca void ()*
store i64 %0, i64* %3
store void ()* %1, void ()** %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1073741824
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 1073745920
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @DEBUG_ASSERT(i32 %12)
%14 = load void ()*, void ()** %4
%15 = bitcast void ()* %14 to void (...)*
%16 = call i32 @IntRegister(i32 34, void (...)* %15)
%17 = call i32 @IntEnable(i32 34)
ret void
}

LLVM IR (-O2):
define void @WatchdogIntRegister(i64 %0, void ()* %1) {
%3 = and i64 %0, -4097
%4 = icmp eq i64 %3, 1073741824
%5 = zext i1 %4 to i32
%6 = tail call i32 @DEBUG_ASSERT(i32 %5)
%7 = bitcast void ()* %1 to void (...)*
%8 = tail call i32 @IntRegister(i32 34, void (...)* %7)
%9 = tail call i32 @IntEnable(i32 34)
ret void
}
/* Variables and functions */
int SIGTERM;
int scalanative_libc_sigterm() { return SIGTERM; }


x86 assembly (clang, -O0):
<scalanative_libc_sigterm>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalanative_libc_sigterm>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@SIGTERM = global i32 0
define i32 @scalanative_libc_sigterm() {
%1 = load i32, i32* @SIGTERM
ret i32 %1
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define i32 @scalanative_libc_sigterm() {
%1 = load i32, i32* @SIGTERM
ret i32 %1
}
int TestByteOrder() {
  short int word = 0x0001;
  char *byte = (char *)&word;
  return (byte[0] ? 1 : 0);
}


x86 assembly (clang, -O0):
<TestByteOrder>:
push   %rbp
mov    %rsp,%rbp
movw   $0x1,-0x2(%rbp)
lea    -0x2(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @TestByteOrder() {
%1 = alloca i16
%2 = alloca i8*
store i16 1, i16* %1
%3 = bitcast i16* %1 to i8*
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
ret i32 %10
}

LLVM IR (-O2):
define i32 @TestByteOrder() {
ret i32 1
}
unsigned xrop3_230_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T & S;
  stk3 = ~stk3;
  stk2 = D & stk3;
  stk1 = S ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_230_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_230_0_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
and    %edi,%esi
not    %sil
movzbl %sil,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_230_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = and i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = xor i32 %26, -1
store i32 %27, i32* %10
%28 = load i32, i32* %5
%29 = load i32, i32* %10
%30 = and i32 %28, %29
store i32 %30, i32* %9
%31 = load i32, i32* %6
%32 = load i32, i32* %9
%33 = xor i32 %31, %32
store i32 %33, i32* %8
%34 = load i32, i32* %8
ret i32 %34
}

LLVM IR (-O2):
define i32 @xrop3_230_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = and i8 %1, %0
%6 = xor i8 %5, -1
%7 = zext i8 %6 to i32
%8 = xor i32 %4, %7
ret i32 %8
}