xunge/DecIR huggingface dataset:
/* Type definitions */
struct ship {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Write(int, struct ship *, long, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
void send_explode(struct ship *ship, long a) { Write(7, ship, a, 0, 0, 0); }


x86 assembly (clang, -O0):
<send_explode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x7,%edi
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <Write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_explode>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x7,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <Write@plt>

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

LLVM IR (-O2):
%struct.ship = type { i32 }
define void @send_explode(%struct.ship* %0, i64 %1) {
%3 = tail call i32 @Write(i32 7, %struct.ship* %0, i64 %1, i32 0, i32 0, i32 0)
ret void
}
void _irq_entry(void) {}


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

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

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

LLVM IR (-O2):
define void @_irq_entry() {
ret void
}
/* Variables and functions */
double get_rn_dbl(int *);
double fget_rn_dbl(int **genptr) { return get_rn_dbl(*genptr); }


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

x86 assembly (clang, -O2):
<fget_rn_dbl>:
mov    (%rdi),%rdi
jmp    1030 <get_rn_dbl@plt>

LLVM IR (-O0):
define double @fget_rn_dbl(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32**, i32*** %2
%4 = load i32*, i32** %3
%5 = call double @get_rn_dbl(i32* %4)
ret double %5
}

LLVM IR (-O2):
define double @fget_rn_dbl(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = tail call double @get_rn_dbl(i32* %2)
ret double %3
}
int recSum(int n) {
  if (n > 0)
    return n + recSum(n - 1);
}


x86 assembly (clang, -O0):
<recSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1140 <recSum+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <recSum@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @recSum(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *progname) {
  printf("Usage: %s [-v] [start [stop]]\n", progname);
}


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

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

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

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: %s [-v] [start [stop]]\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int hf_create_file(char *filename, int recsize) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @hf_create_file(i8* nocapture readnone %0, i32 %1) {
ret i32 -1
}
/* Variables and functions */
int isnan(double);
int my_isnan(double x) { return isnan(x); }


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

x86 assembly (clang, -O2):
<my_isnan>:
jmp    1030 <isnan@plt>

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

LLVM IR (-O2):
define i32 @my_isnan(double %0) {
%2 = tail call i32 @isnan(double %0)
ret i32 %2
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void closeFile(int dskr) {
  int result = close(dskr);
  if (result == -1) {
    perror("close");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<closeFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1166 <closeFile+0x36>
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeFile>:
push   %rax
call   1030 <close@plt>
cmp    $0xffffffff,%eax
je     113d <closeFile+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"close\00"
define void @closeFile(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}
int checkdccs() { return 0x0; }


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

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

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

LLVM IR (-O2):
define i32 @checkdccs() {
ret i32 0
}
int platform_random(int min, int max) { return 0; }


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

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

LLVM IR (-O0):
define i32 @platform_random(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 @platform_random(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hello_world();
int /*<<< orphan*/ printf(char *);
int main() {
  int a;
  int b;
  int c;
  a = 1;
  b = a + 5;
  c = a + b;
  printf("hi\n");
  printf("calling sub\n");
  hello_world();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <hello_world@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"hi\0A\00"
@.str.1 = [13 x i8] c"calling sub\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %1
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 5
store i32 %5, i32* %2
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = add nsw i32 %6, %7
store i32 %8, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (...) @hello_world()
ret i32 0
}

LLVM IR (-O2):
@str = [3 x i8] c"hi\00"
@str.2 = [12 x i8] c"calling sub\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 (...) @hello_world()
ret i32 0
}
/* Variables and functions */
bool greater(int excepted, int actual) { return actual > excepted; }


x86 assembly (clang, -O0):
<greater>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<greater>:
xor    %eax,%eax
cmp    %edi,%esi
setg   %al
ret

LLVM IR (-O0):
define i32 @greater(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* %3
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @greater(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ NOR_CTL_RestoreConfig();
void NOR_CTL_Wakeup(void) { NOR_CTL_RestoreConfig(); }


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

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

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

LLVM IR (-O2):
define void @NOR_CTL_Wakeup() {
%1 = tail call i32 (...) @NOR_CTL_RestoreConfig()
ret void
}
/* Type definitions */
typedef long long uint32_t;
typedef long long int64_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int64_t millihz_to_nsec(uint32_t mhz) {
  assert(mhz > 0);
  return 1000000000000LL / mhz;
}


x86 assembly (clang, -O0):
<millihz_to_nsec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movabs $0xe8d4a51000,%rax
cqto
idivq  -0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<millihz_to_nsec>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setg   %dil
call   1030 <assert@plt>
movabs $0xe8d4a51000,%rax
xor    %edx,%edx
idiv   %rbx
pop    %rbx
ret

LLVM IR (-O0):
define i64 @millihz_to_nsec(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp sgt i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i64, i64* %2
%8 = sdiv i64 1000000000000, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @millihz_to_nsec(i64 %0) {
%2 = icmp sgt i64 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = sdiv i64 1000000000000, %0
ret i64 %5
}
void ReleaseDebugSettings() {}


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

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

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

LLVM IR (-O2):
define void @ReleaseDebugSettings() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int);
void m_sort(int a[], int start, int n) {
  if (n <= 1) {
    return;
  }
  int half = n / 2;
  m_sort(a, start, half);
  m_sort(a, start + half, n - half);
  merge(a, start, n);
}


x86 assembly (clang, -O0):
<m_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jg     1141 <m_sort+0x21>
jmp    1182 <m_sort+0x62>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <m_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    -0x14(%rbp),%edx
call   1040 <m_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_sort>:
cmp    $0x1,%edx
jg     1126 <m_sort+0x6>
ret
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r15
mov    %edx,%ebx
shr    %ebx
mov    %ebx,%edx
call   1040 <m_sort@plt>
mov    %ebp,%edx
sub    %ebx,%edx
add    %r14d,%ebx
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <m_sort@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <merge@plt>

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

LLVM IR (-O2):
define void @m_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 2
br i1 %4, label %5, label %6
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = lshr i32 %2, 1
tail call void @m_sort(i32* %0, i32 %1, i32 %7)
%8 = add nsw i32 %7, %1
%9 = sub nsw i32 %2, %7
tail call void @m_sort(i32* %0, i32 %8, i32 %9)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %2)
br label %5
}
/* Variables and functions */
char *cJSON_strdup(char const *, size_t *, int);
char *bson_parse_name(const char *bson, size_t *len) {
  return cJSON_strdup(bson, len, 1);
}


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

x86 assembly (clang, -O2):
<bson_parse_name>:
mov    $0x1,%edx
jmp    1030 <cJSON_strdup@plt>

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

LLVM IR (-O2):
define i8* @bson_parse_name(i8* %0, i64* %1) {
%3 = tail call i8* @cJSON_strdup(i8* %0, i64* %1, i32 1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ check(int);
void main() {
  int x = 3;
  check(x < 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <check@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %edi,%edi
jmp    1030 <check@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 3, i32* %1
%2 = load i32, i32* %1
%3 = icmp slt i32 %2, 2
%4 = zext i1 %3 to i32
%5 = call i32 @check(i32 %4)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @check(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hola Mundo!\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Hola Mundo!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [12 x i8] c"Hola Mundo!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void read_only() {
  int fd = open("Makefile", O_RDONLY);
  if (fd == -1) {
    perror("open");
  }
}


x86 assembly (clang, -O0):
<read_only>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1156 <read_only+0x36>
lea    0xeb8(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_only>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <open@plt>
cmp    $0xffffffff,%eax
je     113d <read_only+0x1d>
pop    %rax
ret
lea    0xec5(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Makefile\00"
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
define void @read_only() {
%1 = alloca i32
%2 = load i32, i32* @O_RDONLY
%3 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Makefile\00"
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
define void @read_only() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ box_click_reset();
int /*<<< orphan*/ button_click_reset();
void all_objects_click_reset(void) {
  box_click_reset();
  button_click_reset();
}


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

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

LLVM IR (-O0):
define void @all_objects_click_reset() {
%1 = call i32 (...) @box_click_reset()
%2 = call i32 (...) @button_click_reset()
ret void
}

LLVM IR (-O2):
define void @all_objects_click_reset() {
%1 = tail call i32 (...) @box_click_reset()
%2 = tail call i32 (...) @button_click_reset()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ iks_md5(char *, unsigned char *);
int /*<<< orphan*/ printf(char *, unsigned char *);
int /*<<< orphan*/ puts(char *);
int main() {
  unsigned char *md5;
  char *pass;
  puts("foo");
  pass = "foothebar";
  puts("foo");
  iks_md5(pass, md5);
  printf("%s\n", md5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb2(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <iks_md5@plt>
mov    -0x10(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1030 <iks_md5@plt>
lea    0xeb3(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [10 x i8] c"foothebar\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @iks_md5(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* undef)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* undef)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_userdata(void *ptr) {
  free(ptr);
  return;
}


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

x86 assembly (clang, -O2):
<free_userdata>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_userdata(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int log10(int);
int internal_log10_i(int value) { return log10(value); }


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

x86 assembly (clang, -O2):
<internal_log10_i>:
jmp    1030 <log10@plt>

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

LLVM IR (-O2):
define i32 @internal_log10_i(i32 %0) {
%2 = tail call i32 @log10(i32 %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ shim_enosys(int /*<<< orphan*/, int, int, unsigned int);
int shim_pidfd_getfd(int pidfd, int targetfd, unsigned int flags) {
  return (int)shim_enosys(0, pidfd, targetfd, flags);
}


x86 assembly (clang, -O0):
<shim_pidfd_getfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
xor    %edi,%edi
call   1030 <shim_enosys@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shim_pidfd_getfd>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <shim_enosys@plt>

LLVM IR (-O0):
define i32 @shim_pidfd_getfd(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* %5
%9 = load i32, i32* %6
%10 = call i64 @shim_enosys(i32 0, i32 %7, i32 %8, i32 %9)
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @shim_pidfd_getfd(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @shim_enosys(i32 0, i32 %0, i32 %1, i32 %2)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *thr_fn1(void *arg) {
  sleep(10);
  printf("thread 1 returning\n");
  return ((void *)1);
}


x86 assembly (clang, -O0):
<thr_fn1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xa,%edi
call   1040 <sleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr_fn1>:
push   %rax
mov    $0xa,%edi
call   1040 <sleep@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"thread 1 returning\0A\00"
define i8* @thr_fn1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 10)
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i8* inttoptr (i64 1 to i8*)
}

LLVM IR (-O2):
@str = [19 x i8] c"thread 1 returning\00"
define i8* @thr_fn1(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i8* inttoptr (i64 1 to i8*)
}
const char *CompactionFilterFactoryV2Name(void *arg) {
  return "TestCompactionFilterFactoryV2";
}


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"TestCompactionFilterFactoryV2\00"
define i8* @CompactionFilterFactoryV2Name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [30 x i8] c"TestCompactionFilterFactoryV2\00"
define i8* @CompactionFilterFactoryV2Name(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ oled_partialflush(int /*<<< orphan*/, int /*<<< orphan*/,
                                     int, int);
void oled_flush() { oled_partialflush(0, 0, 128 - 1, 128 - 1); }


x86 assembly (clang, -O0):
<oled_flush>:
push   %rbp
mov    %rsp,%rbp
xor    %esi,%esi
mov    $0x7f,%ecx
mov    %esi,%edi
mov    %ecx,%edx
call   1030 <oled_partialflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<oled_flush>:
xor    %edi,%edi
xor    %esi,%esi
mov    $0x7f,%edx
mov    $0x7f,%ecx
jmp    1030 <oled_partialflush@plt>

LLVM IR (-O0):
define void @oled_flush() {
%1 = call i32 @oled_partialflush(i32 0, i32 0, i32 127, i32 127)
ret void
}

LLVM IR (-O2):
define void @oled_flush() {
%1 = tail call i32 @oled_partialflush(i32 0, i32 0, i32 127, i32 127)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ malloc(int);
void my_malloc1(int n) { malloc(n); }


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

x86 assembly (clang, -O2):
<my_malloc1>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define void @my_malloc1(i32 %0) {
%2 = tail call i32 @malloc(i32 %0)
ret void
}
void OS_cleanup(void) {}


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

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

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

LLVM IR (-O2):
define void @OS_cleanup() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int fchmod(int, int /*<<< orphan*/);
__attribute__((__weak__, __always___)) int softboundcets_fchmod(int fd,
                                                                mode_t mode) {
  return fchmod(fd, mode);
}


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

x86 assembly (clang, -O2):
<softboundcets_fchmod>:
jmp    1030 <fchmod@plt>

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

LLVM IR (-O2):
define weak i32 @softboundcets_fchmod(i32 %0, i32 %1) {
%3 = tail call i32 @fchmod(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t ror64(uint64_t word, uint32_t shift) {
  return (word >> shift) | (word << (64 - shift));
}


x86 assembly (clang, -O0):
<ror64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x40,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ror64(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = sub nsw i32 64, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
__attribute__((always_)) void serialize_cpu(void) {
  __asm__ __volatile__("cpuid" : : : "ax", "bx", "cx", "dx");
}


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

x86 assembly (clang, -O2):
<serialize_cpu>:
push   %rbx
cpuid
pop    %rbx
ret

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

LLVM IR (-O2):
define void @serialize_cpu() {
tail call void asm sideeffect "cpuid", "~{ax},~{bx},~{cx},~{dx},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int func2(int);
int /*<<< orphan*/ printf(char *, int);
int func1(void) {
  int a;
  a = func2(10);
  printf("a = %d\n", a);
  return a;
}


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

x86 assembly (clang, -O2):
<func1>:
push   %rbx
mov    $0xa,%edi
call   1040 <func2@plt>
mov    %eax,%ebx
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"a = %d\0A\00"
define i32 @func1() {
%1 = alloca i32
%2 = call i32 @func2(i32 10)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@.str = [8 x i8] c"a = %d\0A\00"
define i32 @func1() {
%1 = tail call i32 @func2(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ Sys_failure(char *);
int setsockopt(int, int, int, void const *, int /*<<< orphan*/);
void Setsockopt(int s, int level, int optname, const void *optval,
                socklen_t optlen) {
  int retval;
  retval = setsockopt(s, level, optname, optval, optlen);
  if (retval == -1)
    Sys_failure("setsockopt");
}


x86 assembly (clang, -O0):
<Setsockopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1168 <Setsockopt+0x48>
lea    0xe9d(%rip),%rdi
call   1040 <Sys_failure@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Setsockopt>:
push   %rax
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     112d <Setsockopt+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <Sys_failure@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"setsockopt\00"
define void @Setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i8*, i8** %9
%16 = load i32, i32* %10
%17 = call i32 @setsockopt(i32 %12, i32 %13, i32 %14, i8* %15, i32 %16)
store i32 %17, i32* %11
%18 = load i32, i32* %11
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %5
%21 = call i32 @Sys_failure(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %5
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"setsockopt\00"
define void @Setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32 @setsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @Sys_failure(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret void
}
OP(ed, c5) {}


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
double test2(double x) {
  return __imag __builtin_cexp((__extension__ 1.0iF) * x);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm2
xorps  %xmm1,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xecf(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <cexp@plt>
movaps %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rax
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <cexp@plt>
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @test2(double %0) {
%2 = alloca double
%3 = alloca { double, double }
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double 0.000000e+00, %4
%6 = fmul double 1.000000e+00, %4
%7 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%8 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %5, double* %7
store double %6, double* %8
%9 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%10 = load double, double* %9
%11 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%12 = load double, double* %11
%13 = call { double, double } @cexp(double %10, double %12)
%14 = extractvalue { double, double } %13, 0
%15 = extractvalue { double, double } %13, 1
ret double %15
}

LLVM IR (-O2):
define double @test2(double %0) {
%2 = fmul double %0, 0.000000e+00
%3 = tail call { double, double } @cexp(double %2, double %0)
%4 = extractvalue { double, double } %3, 1
ret double %4
}
/* Variables and functions */
int find(int);
int test_found() {
  return 11 == find(1) && 17 == find(7) && 49 == find(36) && 455 == find(100);
}


x86 assembly (clang, -O0):
<test_found>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <find@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xb,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    118b <test_found+0x7b>
mov    $0x7,%edi
call   1030 <find@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x11,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    118b <test_found+0x7b>
mov    $0x24,%edi
call   1030 <find@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x31,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    118b <test_found+0x7b>
mov    $0x64,%edi
call   1030 <find@plt>
mov    %eax,%ecx
mov    $0x1c7,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_found>:
push   %rbx
mov    $0x1,%edi
call   1030 <find@plt>
xor    %ebx,%ebx
cmp    $0xb,%eax
jne    1154 <test_found+0x44>
mov    $0x7,%edi
call   1030 <find@plt>
cmp    $0x11,%eax
jne    1154 <test_found+0x44>
mov    $0x24,%edi
call   1030 <find@plt>
cmp    $0x31,%eax
jne    1154 <test_found+0x44>
mov    $0x64,%edi
call   1030 <find@plt>
xor    %ebx,%ebx
cmp    $0x1c7,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_found() {
%1 = call i32 @find(i32 1)
%2 = icmp eq i32 11, %1
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = call i32 @find(i32 7)
%5 = icmp eq i32 17, %4
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = call i32 @find(i32 36)
%8 = icmp eq i32 49, %7
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = call i32 @find(i32 100)
%11 = icmp eq i32 455, %10
br label %12
12: ; preds = %9, %6, %3, %0
%13 = phi i1 [ false, %6 ], [ false, %3 ], [ false, %0 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @test_found() {
%1 = tail call i32 @find(i32 1)
%2 = icmp eq i32 %1, 11
br i1 %2, label %3, label %13
3: ; preds = %0
%4 = tail call i32 @find(i32 7)
%5 = icmp eq i32 %4, 17
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = tail call i32 @find(i32 36)
%8 = icmp eq i32 %7, 49
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i32 @find(i32 100)
%11 = icmp eq i32 %10, 455
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3, %0
%14 = phi i32 [ 0, %6 ], [ 0, %3 ], [ 0, %0 ], [ %12, %9 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int *pint;
  int a = 1;
  pint = &a;
  void *pvoid;
  pvoid = pint;
  printf("*pint = %d\n", 1);
  printf("*pvoid = %d\n", (int)*((int *)pvoid));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"*pint = %d\0A\00"
@.str.1 = [13 x i8] c"*pvoid = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
store i32 1, i32* %3
store i32* %3, i32** %2
%5 = load i32*, i32** %2
%6 = bitcast i32* %5 to i8*
store i8* %6, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"*pint = %d\0A\00"
@.str.1 = [13 x i8] c"*pvoid = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int fget_int(FILE *file) {
  int ret;
  fread(&ret, sizeof(int), 1, file);
  return ret;
}


x86 assembly (clang, -O0):
<fget_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fget_int>:
push   %rax
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fget_int(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %4)
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @fget_int(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @fread(i32* %2, i32 4, i32 1, i32* %0)
%5 = load i32, i32* %2
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
float htob_float(float hostval) {
  union {
    float f;
    uint8_t b[4];
  } u1, u2;
  u1.f = hostval;
  u2.b[0] = u1.b[3];
  u2.b[1] = u1.b[2];
  u2.b[2] = u1.b[1];
  u2.b[3] = u1.b[0];
  return u2.f;
}


x86 assembly (clang, -O0):
<htob_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movss  -0x28(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { [4 x i32] }
define float @htob_float(float %0) {
%2 = alloca float
%3 = alloca %union.anon
%4 = alloca %union.anon
store float %0, float* %2
%5 = load float, float* %2
%6 = bitcast %union.anon* %3 to float*
store float %5, float* %6
%7 = bitcast %union.anon* %3 to [4 x i32]*
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
%9 = load i32, i32* %8
%10 = bitcast %union.anon* %4 to [4 x i32]*
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
store i32 %9, i32* %11
%12 = bitcast %union.anon* %3 to [4 x i32]*
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 2
%14 = load i32, i32* %13
%15 = bitcast %union.anon* %4 to [4 x i32]*
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %15, i64 0, i64 1
store i32 %14, i32* %16
%17 = bitcast %union.anon* %3 to [4 x i32]*
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 1
%19 = load i32, i32* %18
%20 = bitcast %union.anon* %4 to [4 x i32]*
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %20, i64 0, i64 2
store i32 %19, i32* %21
%22 = bitcast %union.anon* %3 to [4 x i32]*
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %22, i64 0, i64 0
%24 = load i32, i32* %23
%25 = bitcast %union.anon* %4 to [4 x i32]*
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %25, i64 0, i64 3
store i32 %24, i32* %26
%27 = bitcast %union.anon* %4 to float*
%28 = load float, float* %27
ret float %28
}

LLVM IR (-O2):
define float @htob_float(float %0) {
ret float undef
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
uint8_t *_rmt_strchr(uint8_t *p, uint8_t *last, uint8_t c) {
  while (p < last) {
    if (*p == c) {
      return p;
    }
    p++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<_rmt_strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114d <_rmt_strchr+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
jne    113c <_rmt_strchr+0x3c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1155 <_rmt_strchr+0x55>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <_rmt_strchr+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rmt_strchr>:
cmp    %rsi,%rdi
jae    111e <_rmt_strchr+0x1e>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %rdx,(%rax)
je     1120 <_rmt_strchr+0x20>
add    $0x8,%rax
cmp    %rsi,%rax
jb     1110 <_rmt_strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64* @_rmt_strchr(i64* %0, i64* readnone %1, i64 %2) {
%4 = icmp ult i64* %0, %1
br i1 %4, label %5, label %12
5: ; preds = %3, %9
%6 = phi i64* [ %10, %9 ], [ %0, %3 ]
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, %2
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = getelementptr inbounds i64, i64* %6, i64 1
%11 = icmp ult i64* %10, %1
br i1 %11, label %5, label %12
12: ; preds = %5, %9, %3
%13 = phi i64* [ null, %3 ], [ null, %9 ], [ %6, %5 ]
ret i64* %13
}
/* Variables and functions */
int /*<<< orphan*/ glNormal3f(float, float, float);
void Normal3f(float x, float y, float z) { glNormal3f(x, y, z); }


x86 assembly (clang, -O0):
<Normal3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1030 <glNormal3f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Normal3f>:
jmp    1030 <glNormal3f@plt>

LLVM IR (-O0):
define void @Normal3f(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = call i32 @glNormal3f(float %7, float %8, float %9)
ret void
}

LLVM IR (-O2):
define void @Normal3f(float %0, float %1, float %2) {
%4 = tail call i32 @glNormal3f(float %0, float %1, float %2)
ret void
}