xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ slip_send(int, unsigned char);
void slip_send_char(int fd, unsigned char c) {
  switch (c) {
  case 0300:
    slip_send(fd, 0333);
    slip_send(fd, 0334);
    break;
  case 0333:
    slip_send(fd, 0333);
    slip_send(fd, 0335);
    break;
  default:
    slip_send(fd, c);
    break;
  }
}


x86 assembly (clang, -O0):
<slip_send_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xc0,%eax
je     114b <slip_send_char+0x3b>
jmp    1138 <slip_send_char+0x28>
mov    -0xc(%rbp),%eax
sub    $0xdb,%eax
je     116a <slip_send_char+0x5a>
jmp    1189 <slip_send_char+0x79>
mov    -0x4(%rbp),%edi
mov    $0xdb,%esi
call   1030 <slip_send@plt>
mov    -0x4(%rbp),%edi
mov    $0xdc,%esi
call   1030 <slip_send@plt>
jmp    1195 <slip_send_char+0x85>
mov    -0x4(%rbp),%edi
mov    $0xdb,%esi
call   1030 <slip_send@plt>
mov    -0x4(%rbp),%edi
mov    $0xdd,%esi
call   1030 <slip_send@plt>
jmp    1195 <slip_send_char+0x85>
mov    -0x4(%rbp),%edi
movzbl -0x5(%rbp),%esi
call   1030 <slip_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slip_send_char>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
cmp    $0xc0,%bpl
je     1128 <slip_send_char+0x18>
cmp    $0xdb,%bpl
jne    1137 <slip_send_char+0x27>
mov    $0xdd,%bpl
jmp    112b <slip_send_char+0x1b>
mov    $0xdc,%bpl
mov    %ebx,%edi
mov    $0xdb,%esi
call   1030 <slip_send@plt>
movzbl %bpl,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <slip_send@plt>

LLVM IR (-O0):
define void @slip_send_char(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
switch i32 %6, label %17 [
i32 192, label %7
i32 219, label %12
]
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 @slip_send(i32 %8, i8 zeroext -37)
%10 = load i32, i32* %3
%11 = call i32 @slip_send(i32 %10, i8 zeroext -36)
br label %21
12: ; preds = %2
%13 = load i32, i32* %3
%14 = call i32 @slip_send(i32 %13, i8 zeroext -37)
%15 = load i32, i32* %3
%16 = call i32 @slip_send(i32 %15, i8 zeroext -35)
br label %21
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i8, i8* %4
%20 = call i32 @slip_send(i32 %18, i8 zeroext %19)
br label %21
21: ; preds = %17, %12, %7
ret void
}

LLVM IR (-O2):
define void @slip_send_char(i32 %0, i8 zeroext %1) {
switch i8 %1, label %7 [
i8 -64, label %4
i8 -37, label %3
]
3: ; preds = %2
br label %4
4: ; preds = %2, %3
%5 = phi i8 [ -35, %3 ], [ -36, %2 ]
%6 = tail call i32 @slip_send(i32 %0, i8 zeroext -37)
br label %7
7: ; preds = %4, %2
%8 = phi i8 [ %1, %2 ], [ %5, %4 ]
%9 = tail call i32 @slip_send(i32 %0, i8 zeroext %8)
ret void
}
void RTMemWipeThoroughly(void) {}


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

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

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

LLVM IR (-O2):
define void @RTMemWipeThoroughly() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int f();
int g();
int main() {
  assert(f() == 1);
  assert(f() == 2);
  assert(g() == 1);
  assert(g() == 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <f@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x0,%al
call   1030 <f@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x0,%al
call   1050 <g@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x0,%al
call   1050 <g@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <f@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
call   1030 <f@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
call   1050 <g@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
call   1050 <g@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @f()
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 (...) @f()
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 (...) @g()
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 (...) @g()
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (...) @f()
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 (...) @g()
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 (...) @g()
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bubble_sort(int *, int);
int *malloc(int);
int /*<<< orphan*/ populate_array(int *, int *, int);
int /*<<< orphan*/ print_array(int *, int);
int main() {
  int *A = malloc(100 * sizeof(int));
  int num_elements = 0;
  populate_array(A, &num_elements, 100);
  bubble_sort(A, num_elements);
  print_array(A, num_elements);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x190,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x64,%edx
call   1050 <populate_array@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <bubble_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x190,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rax,%rdi
mov    $0x64,%edx
call   1050 <populate_array@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <bubble_sort@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @malloc(i32 400)
store i32* %3, i32** %1
store i32 0, i32* %2
%4 = load i32*, i32** %1
%5 = call i32 @populate_array(i32* %4, i32* %2, i32 100)
%6 = load i32*, i32** %1
%7 = load i32, i32* %2
%8 = call i32 @bubble_sort(i32* %6, i32 %7)
%9 = load i32*, i32** %1
%10 = load i32, i32* %2
%11 = call i32 @print_array(i32* %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = tail call i32* @malloc(i32 400)
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = call i32 @populate_array(i32* %2, i32* %1, i32 100)
%5 = load i32, i32* %1
%6 = call i32 @bubble_sort(i32* %2, i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @print_array(i32* %2, i32 %7)
ret i32 0
}
/* Variables and functions */
int SSL_connect(void *);
int dv_openssl_error(void *, int);
int dv_openssl_connect(void *s) {
  int ret = 0;
  ret = SSL_connect(s);
  if (ret == 1) {
    return 0;
  }
  return dv_openssl_error(s, ret);
}


x86 assembly (clang, -O0):
<dv_openssl_connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <SSL_connect@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1155 <dv_openssl_connect+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1164 <dv_openssl_connect+0x44>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <dv_openssl_error@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dv_openssl_connect>:
push   %rbx
mov    %rdi,%rbx
call   1040 <SSL_connect@plt>
cmp    $0x1,%eax
jne    1132 <dv_openssl_connect+0x12>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <dv_openssl_error@plt>

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

LLVM IR (-O2):
define i32 @dv_openssl_connect(i8* %0) {
%2 = tail call i32 @SSL_connect(i8* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @dv_openssl_error(i8* %0, i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ Evt_setExpId(void *, char const);
void Evt_setExpIdCharP(void *my, const char *expId) {
  Evt_setExpId(my, (expId[0] << 8) | expId[1]);
}


x86 assembly (clang, -O0):
<Evt_setExpIdCharP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
or     %ecx,%eax
movsbl %al,%esi
call   1030 <Evt_setExpId@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Evt_setExpIdCharP>:
movsbl 0x1(%rsi),%esi
jmp    1030 <Evt_setExpId@plt>

LLVM IR (-O0):
define void @Evt_setExpIdCharP(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = or i32 %10, %14
%16 = trunc i32 %15 to i8
%17 = call i32 @Evt_setExpId(i8* %5, i8 signext %16)
ret void
}

LLVM IR (-O2):
define void @Evt_setExpIdCharP(i8* %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 1
%4 = load i8, i8* %3
%5 = tail call i32 @Evt_setExpId(i8* %0, i8 signext %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int wait(int /*<<< orphan*/ *);
int test_fork_sigchld_ignored(void) {
  signal(SIGCHLD, SIG_IGN);
  int n = fork();
  if (n == 0)
    exit(0);
  assert(wait(NULL) == -1);
  return 0;
}


x86 assembly (clang, -O0):
<test_fork_sigchld_ignored>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    118a <test_fork_sigchld_ignored+0x3a>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <wait@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fork_sigchld_ignored>:
push   %rax
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
je     118c <test_fork_sigchld_ignored+0x3c>
xor    %edi,%edi
call   1060 <wait@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
define i32 @test_fork_sigchld_ignored() {
%1 = alloca i32
%2 = load i32, i32* @SIGCHLD
%3 = load i32, i32* @SIG_IGN
%4 = call i32 @signal(i32 %2, i32 %3)
%5 = call i32 (...) @fork()
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %0
%11 = call i32 @wait(i32* null)
%12 = icmp eq i32 %11, -1
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret i32 0
}

LLVM IR (-O2):
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
define i32 @test_fork_sigchld_ignored() {
%1 = load i32, i32* @SIGCHLD
%2 = load i32, i32* @SIG_IGN
%3 = tail call i32 @signal(i32 %1, i32 %2)
%4 = tail call i32 (...) @fork()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %0
%9 = tail call i32 @wait(i32* null)
%10 = icmp eq i32 %9, -1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int upper_bound(float *, int, double);
void test_upper_bound() {
  float f[] = {1.0, 2.0, 3.0, 4.0, 5.0};
  int index = upper_bound(f, 5, 0.6);
  printf("\x1b[33m%d\x1b[0m\n", index);
}


x86 assembly (clang, -O0):
<test_upper_bound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
movsd  0xea8(%rip),%xmm0
call   1030 <upper_bound@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_upper_bound>:
sub    $0x18,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
movsd  0xebc(%rip),%xmm0
mov    $0x5,%esi
call   1030 <upper_bound@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_upper_bound.f = [5 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00]
@.str = [13 x i8] c"\1B[33m%d\1B[0m\0A\00"
define void @test_upper_bound() {
%1 = alloca [5 x float]
%2 = alloca i32
%3 = bitcast [5 x float]* %1 to i8*
%4 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%5 = call i32 @upper_bound(float* %4, i32 5, double 6.000000e-01)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@__const.test_upper_bound.f = [5 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00]
@.str = [13 x i8] c"\1B[33m%d\1B[0m\0A\00"
define void @test_upper_bound() {
%1 = alloca [5 x float]
%2 = bitcast [5 x float]* %1 to i8*
%3 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%4 = call i32 @upper_bound(float* %3, i32 5, double 6.000000e-01)
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  kill(getpid(), SIGKILL);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <kill@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGKILL = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @getpid()
%7 = load i32, i32* @SIGKILL
%8 = call i32 @kill(i32 %6, i32 %7)
ret i32 -1
}

LLVM IR (-O2):
@SIGKILL = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = load i32, i32* @SIGKILL
%5 = tail call i32 @kill(i32 %3, i32 %4)
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int syscall(int, int /*<<< orphan*/, int);
int msgget(key_t k, int flag) { return syscall(303, k, flag); }


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

x86 assembly (clang, -O2):
<msgget>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x12f,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @msgget(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 @syscall(i32 303, i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @msgget(i32 %0, i32 %1) {
%3 = tail call i32 @syscall(i32 303, i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
struct ndiff {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct ndiff *);
int /*<<< orphan*/ free(struct ndiff *);
int /*<<< orphan*/ ndiff_teardown(struct ndiff *);
void ndiff_free(struct ndiff *dif) {
  assert(dif);
  ndiff_teardown(dif);
  free(dif);
}


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

x86 assembly (clang, -O2):
<ndiff_free>:
push   %rbx
mov    %rdi,%rbx
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <ndiff_teardown@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.ndiff = type { i32 }
define void @ndiff_free(%struct.ndiff* %0) {
%2 = alloca %struct.ndiff*
store %struct.ndiff* %0, %struct.ndiff** %2
%3 = load %struct.ndiff*, %struct.ndiff** %2
%4 = call i32 @assert(%struct.ndiff* %3)
%5 = load %struct.ndiff*, %struct.ndiff** %2
%6 = call i32 @ndiff_teardown(%struct.ndiff* %5)
%7 = load %struct.ndiff*, %struct.ndiff** %2
%8 = call i32 @free(%struct.ndiff* %7)
ret void
}

LLVM IR (-O2):
%struct.ndiff = type { i32 }
define void @ndiff_free(%struct.ndiff* %0) {
%2 = tail call i32 @assert(%struct.ndiff* %0)
%3 = tail call i32 @ndiff_teardown(%struct.ndiff* %0)
%4 = tail call i32 @free(%struct.ndiff* %0)
ret void
}
void gtk_file_filter_get_name() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_filter_get_name() {
ret void
}
int test_imm_71int8_mem(signed char *val) {
  return ((*val) & (0x71 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_71int8_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, 113
%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_71int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 113
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void RTPathSetMode(void) {}


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

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

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

LLVM IR (-O2):
define void @RTPathSetMode() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void raise_error(char *message) {
  printf("ERROR: %s\n", message);
  exit(1);
}


x86 assembly (clang, -O0):
<raise_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<raise_error>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @raise_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @raise_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int clamp(int, int, int);
int clampMotorSpeed(int speed) { return clamp(speed, -127, 127); }


x86 assembly (clang, -O0):
<clampMotorSpeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xffffff81,%esi
mov    $0x7f,%edx
call   1030 <clamp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampMotorSpeed>:
mov    $0xffffff81,%esi
mov    $0x7f,%edx
jmp    1030 <clamp@plt>

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

LLVM IR (-O2):
define i32 @clampMotorSpeed(i32 %0) {
%2 = tail call i32 @clamp(i32 %0, i32 -127, i32 127)
ret i32 %2
}
int isWhiteSpace(int ch) { return (ch == ' ' || ch == '\n' || ch == '\t'); }


x86 assembly (clang, -O0):
<isWhiteSpace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <isWhiteSpace+0x2f>
mov    $0x1,%al
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <isWhiteSpace+0x2f>
cmpl   $0x9,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isWhiteSpace>:
mov    $0x1,%eax
cmp    $0xa,%edi
je     110f <isWhiteSpace+0xf>
cmp    $0x20,%edi
jne    1110 <isWhiteSpace+0x10>
ret
xor    %eax,%eax
cmp    $0x9,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isWhiteSpace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %5
i32 10, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 9
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() {
  printf("hahaha.");
  main();
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1120 <main+0x10>

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

LLVM IR (-O2):
@.str = [8 x i8] c"hahaha.\00"
define void @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %1
}
/* Variables and functions */
double fabs(double);
unsigned char coords_match(double lat1, double lon1, double lat2, double lon2) {
  return (fabs(lat1 - lat2) < 0.0001 && fabs(lon1 - lon2) < 0.0001) ? 1 : 0;
}


x86 assembly (clang, -O0):
<coords_match>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xee7(%rip),%xmm0
pand   %xmm0,%xmm1
xor    %eax,%eax
movsd  0xec9(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
jbe    116b <coords_match+0x6b>
movsd  -0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movaps 0xebb(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe9f(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<coords_match>:
subsd  %xmm2,%xmm0
andpd  0xef4(%rip),%xmm0
movsd  0xefc(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    112e <coords_match+0x2e>
subsd  %xmm3,%xmm1
andpd  0xeda(%rip),%xmm1
ucomisd %xmm1,%xmm2
seta   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i8 @coords_match(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %7
%11 = fsub double %9, %10
%12 = call double @llvm.fabs.f64(double %11)
%13 = fcmp olt double %12, 1.000000e-04
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load double, double* %6
%16 = load double, double* %8
%17 = fsub double %15, %16
%18 = call double @llvm.fabs.f64(double %17)
%19 = fcmp olt double %18, 1.000000e-04
br label %20
20: ; preds = %14, %4
%21 = phi i1 [ false, %4 ], [ %19, %14 ]
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 1, i32 0
%24 = trunc i32 %23 to i8
ret i8 %24
}

LLVM IR (-O2):
define zeroext i8 @coords_match(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %2
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp olt double %6, 1.000000e-04
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = fsub double %1, %3
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = fcmp olt double %10, 1.000000e-04
%12 = zext i1 %11 to i8
br label %13
13: ; preds = %8, %4
%14 = phi i8 [ 0, %4 ], [ %12, %8 ]
ret i8 %14
}
int test_imm_FDuint16_reg(unsigned short val) {
  return ((val) & (0xFD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FDuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xfd,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_FDuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 253
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int add(int x, int y) { return (x + y); }


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

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @add(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
double INT_MAX;
int /*<<< orphan*/ f(double);
int main(void) {
  f(INT_MAX * 2.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
mov    0x2eba(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@INT_MAX = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load double, double* @INT_MAX
%3 = fmul double %2, 2.000000e+00
%4 = call i32 @f(double %3)
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global double 0.000000e+00
define i32 @main() {
%1 = load double, double* @INT_MAX
%2 = fmul double %1, 2.000000e+00
%3 = tail call i32 @f(double %2)
ret i32 0
}
/* Variables and functions */
int WCOREDUMP(int);
int goose_WCOREDUMP(int status) { return WCOREDUMP(status); }


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

x86 assembly (clang, -O2):
<goose_WCOREDUMP>:
jmp    1030 <WCOREDUMP@plt>

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

LLVM IR (-O2):
define i32 @goose_WCOREDUMP(i32 %0) {
%2 = tail call i32 @WCOREDUMP(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
double B(double);
double G(double);
double R(double);
uint32_t tempColor(double T, double brite) {
  uint8_t Red = R(T) * brite;
  uint8_t Grn = G(T) * brite;
  uint8_t Blu = B(T) * brite;
  return (uint32_t)Grn << 16 | (uint32_t)Red << 8 | Blu;
}


x86 assembly (clang, -O0):
<tempColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <R@plt>
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <G@plt>
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <B@plt>
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
mov    -0x14(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tempColor>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1040 <R@plt>
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%ebx
movsd  0x10(%rsp),%xmm0
call   1050 <G@plt>
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%ebp
movsd  0x10(%rsp),%xmm0
call   1030 <B@plt>
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%eax
shl    $0x10,%ebp
shl    $0x8,%ebx
or     %ebp,%ebx
or     %eax,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @tempColor(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store double %0, double* %3
store double %1, double* %4
%8 = load double, double* %3
%9 = call double @R(double %8)
%10 = load double, double* %4
%11 = fmul double %9, %10
%12 = fptosi double %11 to i32
store i32 %12, i32* %5
%13 = load double, double* %3
%14 = call double @G(double %13)
%15 = load double, double* %4
%16 = fmul double %14, %15
%17 = fptosi double %16 to i32
store i32 %17, i32* %6
%18 = load double, double* %3
%19 = call double @B(double %18)
%20 = load double, double* %4
%21 = fmul double %19, %20
%22 = fptosi double %21 to i32
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = shl i32 %23, 16
%25 = load i32, i32* %5
%26 = shl i32 %25, 8
%27 = or i32 %24, %26
%28 = load i32, i32* %7
%29 = or i32 %27, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @tempColor(double %0, double %1) {
%3 = tail call double @R(double %0)
%4 = fmul double %3, %1
%5 = fptosi double %4 to i32
%6 = tail call double @G(double %0)
%7 = fmul double %6, %1
%8 = fptosi double %7 to i32
%9 = tail call double @B(double %0)
%10 = fmul double %9, %1
%11 = fptosi double %10 to i32
%12 = shl i32 %8, 16
%13 = shl i32 %5, 8
%14 = or i32 %12, %13
%15 = or i32 %14, %11
ret i32 %15
}
/* Variables and functions */
scalar_t__ Mem_Alloc(int);
scalar_t__ Mem_Init(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  assert(Mem_Init(4096) == 0);
  int *ptr = (int *)Mem_Alloc(sizeof(int));
  assert(ptr != NULL);
  *ptr = 42;
  assert(*ptr == 42);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x4,%edi
call   1050 <Mem_Alloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x2a,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    $0x4,%edi
call   1050 <Mem_Alloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
movl   $0x2a,(%rbx)
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @Mem_Init(i32 4096)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i64 @Mem_Alloc(i32 4)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %2
%9 = load i32*, i32** %2
%10 = icmp ne i32* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32*, i32** %2
store i32 42, i32* %13
%14 = load i32*, i32** %2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 42
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @Mem_Init(i32 4096)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @Mem_Alloc(i32 4)
%6 = inttoptr i64 %5 to i32*
%7 = icmp ne i64 %5, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
store i32 42, i32* %6
%10 = tail call i32 @assert(i32 1)
%11 = tail call i32 @exit(i32 0)
unreachable
}
int test07(int *a, short *b, int c, int d) {
  if (*a & *b)
    return c;
  return d;
}


x86 assembly (clang, -O0):
<test07>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1135 <test07+0x35>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <test07+0x3b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test07>:
mov    %edx,%eax
movswl (%rsi),%edx
test   %edx,(%rdi)
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test07(i32* nocapture %0, i16* nocapture %1, i32 %2, i32 %3) {
%5 = load i32, i32* %0
%6 = load i16, i16* %1
%7 = sext i16 %6 to i32
%8 = and i32 %5, %7
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 %3, i32 %2
ret i32 %10
}
int CLAMP16(int x) {
  if (x > 32767)
    x = 32767;
  else if (x < -32768)
    x = -32768;
  return x;
}


x86 assembly (clang, -O0):
<CLAMP16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x7fff,-0x4(%rbp)
jle    1120 <CLAMP16+0x20>
movl   $0x7fff,-0x4(%rbp)
jmp    1139 <CLAMP16+0x39>
cmpl   $0xffff8000,-0x4(%rbp)
jge    1134 <CLAMP16+0x34>
movl   $0xffff8000,-0x4(%rbp)
jmp    1139 <CLAMP16+0x39>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CLAMP16>:
cmp    $0xffff8001,%edi
mov    $0xffff8000,%ecx
cmovge %edi,%ecx
cmp    $0x7fff,%ecx
mov    $0x7fff,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @CLAMP16(i32 %0) {
%2 = icmp sgt i32 %0, -32768
%3 = select i1 %2, i32 %0, i32 -32768
%4 = icmp slt i32 %3, 32767
%5 = select i1 %4, i32 %3, i32 32767
ret i32 %5
}
/* Type definitions */
struct flock {
  scalar_t__ l_len;
  scalar_t__ l_start;
  int /*<<< orphan*/ l_whence;
  int /*<<< orphan*/ l_type;
};

/* Variables and functions */
int /*<<< orphan*/ F_SETLKW;
int /*<<< orphan*/ F_WRLCK;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fcntl(int, int /*<<< orphan*/, struct flock *);
void my_lock(int fd) {
  struct flock lock;
  return;
  lock.l_type = F_WRLCK;
  lock.l_whence = SEEK_SET;
  lock.l_start = 0;
  lock.l_len = 0;
  fcntl(fd, F_SETLKW, &lock);
}


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

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

LLVM IR (-O0):
%struct.flock = type { i64, i64, i32, i32 }
@F_SETLKW = global i32 0
@F_WRLCK = global i32 0
@SEEK_SET = global i32 0
define void @my_lock(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.flock
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
%struct.flock = type { i64, i64, i32, i32 }
@F_SETLKW = global i32 0
@F_WRLCK = global i32 0
@SEEK_SET = global i32 0
define void @my_lock(i32 %0) {
ret void
}
int HelpItem27(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem27() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ func(char *);
int main() {
  func("test");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @func(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i32 @main() {
%1 = tail call i32 @func(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ show_stacktrace();
void g() { show_stacktrace(); }


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

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

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

LLVM IR (-O2):
define void @g() {
%1 = tail call i32 (...) @show_stacktrace()
ret void
}
int fun1048() { return 1048; }


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

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

LLVM IR (-O0):
define i32 @fun1048() {
ret i32 1048
}

LLVM IR (-O2):
define i32 @fun1048() {
ret i32 1048
}
float f_float() {
  float f;
  f = 123.4567;
  return f;
}


x86 assembly (clang, -O0):
<f_float>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_float>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @f_float() {
%1 = alloca float
store float 0x405EDD3AA0000000, float* %1
%2 = load float, float* %1
ret float %2
}

LLVM IR (-O2):
define float @f_float() {
ret float 0x405EDD3AA0000000
}
int yyerror(const char *s __attribute__((__unused__))) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @yyerror(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int sscanf(char const *, char *, unsigned int *, unsigned int *,
           unsigned int *);
int is_version_number(const char *version) {
  unsigned int dummy;
  return (sscanf(version, "%u.%u.%u", &dummy, &dummy, &dummy) == 3);
}


x86 assembly (clang, -O0):
<is_version_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0xc(%rbp),%r8
mov    %r8,%rdx
mov    %r8,%rcx
call   1030 <sscanf@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_version_number>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rcx
mov    %rcx,%rdx
mov    %rcx,%r8
call   1030 <sscanf@plt>
xor    %ecx,%ecx
cmp    $0x3,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%u.%u.%u\00"
define i32 @is_version_number(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %3, i32* %3)
%6 = icmp eq i32 %5, 3
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@.str = [9 x i8] c"%u.%u.%u\00"
define i32 @is_version_number(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %2, i32* %2)
%5 = icmp eq i32 %4, 3
%6 = zext i1 %5 to i32
ret i32 %6
}
__attribute__((vector_size(16))) float fb(void) {
  return (__attribute__((vector_size(16))) float){1.0, 0.0, 1.0, 0.0};
}


x86 assembly (clang, -O0):
<fb>:
push   %rbp
mov    %rsp,%rbp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,-0x10(%rbp)
movaps -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb>:
movaps 0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define <4 x float> @fb() {
%1 = alloca <4 x float>
store <4 x float> <float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 0.000000e+00>, <4 x float>* %1
%2 = load <4 x float>, <4 x float>* %1
ret <4 x float> %2
}

LLVM IR (-O2):
define <4 x float> @fb() {
ret <4 x float> <float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 0.000000e+00>
}
/* Variables and functions */
int /*<<< orphan*/ utf8_remove_last_char(char *);
void sttstr_trim_last_char(char *this) { utf8_remove_last_char(this); }


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

x86 assembly (clang, -O2):
<sttstr_trim_last_char>:
jmp    1030 <utf8_remove_last_char@plt>

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

LLVM IR (-O2):
define void @sttstr_trim_last_char(i8* %0) {
%2 = tail call i32 @utf8_remove_last_char(i8* %0)
ret void
}
void test_builtin_alloca() {
  char *foo2 = __builtin_alloca(0);
  for (unsigned i = 0; i < 100; i++) {
    foo2[i] = 0;
  }
}


x86 assembly (clang, -O0):
<test_builtin_alloca>:
push   %rbp
mov    %rsp,%rbp
lea    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jae    1136 <test_builtin_alloca+0x36>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1113 <test_builtin_alloca+0x13>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_builtin_alloca() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i8, i64 0
store i8* %3, i8** %1
store i32 0, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp ult i32 %5, 100
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i8*, i8** %1
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = add i32 %13, 1
store i32 %14, i32* %2
br label %4
15: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @test_builtin_alloca() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ stop_pktcraft();
void pktcrafter_sigint_watchdog(int signr) { stop_pktcraft(); }


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

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

LLVM IR (-O0):
define void @pktcrafter_sigint_watchdog(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @stop_pktcraft()
ret void
}

LLVM IR (-O2):
define void @pktcrafter_sigint_watchdog(i32 %0) {
%2 = tail call i32 (...) @stop_pktcraft()
ret void
}
void pheader() { printf(1, "%s type ino sz ch1 ch2 chksm\n", fmtname("path")); }


x86 assembly (clang, -O0):
<pheader>:
push   %rbp
mov    %rsp,%rbp
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1040 <fmtname@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pheader>:
push   %rax
lea    0xef6(%rip),%rdi
xor    %eax,%eax
call   1040 <fmtname@plt>
lea    0xeca(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"%s type ino sz ch1 ch2 chksm\0A\00"
@.str.1 = [5 x i8] c"path\00"
define void @pheader() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @fmtname to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s type ino sz ch1 ch2 chksm\0A\00"
@.str.1 = [5 x i8] c"path\00"
define void @pheader() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fmtname to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}