xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ MC_put_xy_mmx(int, int, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ const *, int);
void MC_put_xy_8_mmx(uint8_t *dest, const uint8_t *ref, int stride,
                     int height) {
  MC_put_xy_mmx(8, height, dest, ref, stride);
}


x86 assembly (clang, -O0):
<MC_put_xy_8_mmx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x8,%edi
call   1030 <MC_put_xy_mmx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MC_put_xy_8_mmx>:
mov    %edx,%r8d
mov    %rsi,%rax
mov    %rdi,%rdx
mov    $0x8,%edi
mov    %ecx,%esi
mov    %rax,%rcx
jmp    1030 <MC_put_xy_mmx@plt>

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

LLVM IR (-O2):
define void @MC_put_xy_8_mmx(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i32 @MC_put_xy_mmx(i32 8, i32 %3, i32* %0, i32* %1, i32 %2)
ret void
}
/* Variables and functions */
int put_char_bare_utf8(char *, int);
int put_char_utf8(char *dst, int ch) {
  int len = put_char_bare_utf8(dst, ch);
  dst[len] = '\0';
  return len;
}


x86 assembly (clang, -O0):
<put_char_utf8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <put_char_bare_utf8@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_char_utf8>:
push   %rbx
mov    %rdi,%rbx
call   1030 <put_char_bare_utf8@plt>
cltq
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @put_char_utf8(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @put_char_bare_utf8(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8 0, i8* %12
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @put_char_utf8(i8* %0, i32 %1) {
%3 = tail call i32 @put_char_bare_utf8(i8* %0, i32 %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 0, i8* %5
ret i32 %3
}
/* Variables and functions */
double M2z_z(double, double, double, double);
double M3z_y(double sign, double xi, double et, double qq) {
  return M2z_z(sign, xi, et, qq);
}


x86 assembly (clang, -O0):
<M3z_y>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
call   1030 <M2z_z@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M3z_y>:
jmp    1030 <M2z_z@plt>

LLVM IR (-O0):
define double @M3z_y(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* %6
%11 = load double, double* %7
%12 = load double, double* %8
%13 = call double @M2z_z(double %9, double %10, double %11, double %12)
ret double %13
}

LLVM IR (-O2):
define double @M3z_y(double %0, double %1, double %2, double %3) {
%5 = tail call double @M2z_z(double %0, double %1, double %2, double %3)
ret double %5
}
char BIT(unsigned char value) {
  switch (value) {
  case 7:
    value = 0x80;
    break;
  case 6:
    value = 0x40;
    break;
  case 5:
    value = 0x20;
    break;
  case 4:
    value = 0x10;
    break;
  case 3:
    value = 0x08;
    break;
  case 2:
    value = 0x04;
    break;
  case 1:
    value = 0x02;
    break;
  case 0:
    value = 0x01;
    break;
  }
  return value;
}


x86 assembly (clang, -O0):
<BIT>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     1173 <BIT+0x73>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x80,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x40,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x20,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x10,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x8,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x4,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x2,-0x1(%rbp)
jmp    1173 <BIT+0x73>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BIT>:
lea    0x0(,%rdi,8),%ecx
movabs $0x8040201008040201,%rax
20 40 80
shr    %cl,%rax
cmp    $0x8,%dil
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @BIT(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
switch i32 %4, label %13 [
i32 7, label %5
i32 6, label %6
i32 5, label %7
i32 4, label %8
i32 3, label %9
i32 2, label %10
i32 1, label %11
i32 0, label %12
]
5: ; preds = %1
store i8 -128, i8* %2
br label %13
6: ; preds = %1
store i8 64, i8* %2
br label %13
7: ; preds = %1
store i8 32, i8* %2
br label %13
8: ; preds = %1
store i8 16, i8* %2
br label %13
9: ; preds = %1
store i8 8, i8* %2
br label %13
10: ; preds = %1
store i8 4, i8* %2
br label %13
11: ; preds = %1
store i8 2, i8* %2
br label %13
12: ; preds = %1
store i8 1, i8* %2
br label %13
13: ; preds = %1, %12, %11, %10, %9, %8, %7, %6, %5
%14 = load i8, i8* %2
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @BIT(i8 zeroext %0) {
%2 = icmp ult i8 %0, 8
%3 = zext i8 %0 to i64
%4 = shl nuw nsw i64 %3, 3
%5 = lshr i64 -9205322385119247871, %4
%6 = trunc i64 %5 to i8
%7 = select i1 %2, i8 %6, i8 %0
ret i8 %7
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int get_time(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,(%rsp),%ecx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @get_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
ret i32 %10
}
/* Variables and functions */
#define SIGALRM 130
#define SIGINT 129
#define SIGTERM 128
int /*<<< orphan*/ _exit(int);
void sig_handler(int signum) {
  switch (signum) {
  case SIGALRM:
    _exit(1);
  case SIGINT:
  case SIGTERM:
    _exit(20 + signum);
  }
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
add    $0xffffff80,%eax
sub    $0x2,%eax
jb     114f <sig_handler+0x3f>
jmp    1132 <sig_handler+0x22>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
jne    115a <sig_handler+0x4a>
jmp    1145 <sig_handler+0x35>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x4(%rbp),%edi
add    $0x14,%edi
call   1030 <_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
lea    -0x80(%rdi),%eax
cmp    $0x2,%eax
jb     1123 <sig_handler+0x13>
cmp    $0x82,%edi
je     112b <sig_handler+0x1b>
pop    %rax
ret
add    $0x14,%edi
call   1030 <_exit@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 130, label %4
i32 129, label %6
i32 128, label %6
]
4: ; preds = %1
%5 = call i32 @_exit(i32 1)
unreachable
6: ; preds = %1, %1
%7 = load i32, i32* %2
%8 = add nsw i32 20, %7
%9 = call i32 @_exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @sig_handler(i32 %0) {
switch i32 %0, label %7 [
i32 130, label %2
i32 129, label %4
i32 128, label %4
]
2: ; preds = %1
%3 = tail call i32 @_exit(i32 1)
unreachable
4: ; preds = %1, %1
%5 = add nuw nsw i32 %0, 20
%6 = tail call i32 @_exit(i32 %5)
unreachable
7: ; preds = %1
ret void
}
void _start(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <_start+0x9>
jmp    1109 <_start+0x9>

x86 assembly (clang, -O2):
<_start>:
jmp    1100 <_start>

LLVM IR (-O0):
define void @_start() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @_start() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int O_CREAT;
int O_DIRECTORY;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ open(char *, int, int);
int main(int argc, char *argv[]) {
  int j, len, fd2, fd3;
  char *temp;
  open("ruj", O_DIRECTORY | O_CREAT, 0666);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
mov    0x2eb2(%rip),%rax
or     (%rax),%esi
lea    0xeb1(%rip),%rdi
mov    $0x1b6,%edx
call   1030 <open@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    0x2ec9(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xec6(%rip),%rdi
mov    $0x1b6,%edx
call   1030 <open@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"ruj\00"
@O_DIRECTORY = global i32 0
@O_CREAT = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* @O_DIRECTORY
%12 = load i32, i32* @O_CREAT
%13 = or i32 %11, %12
%14 = call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13, i32 438)
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"ruj\00"
@O_DIRECTORY = global i32 0
@O_CREAT = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_DIRECTORY
%4 = load i32, i32* @O_CREAT
%5 = or i32 %4, %3
%6 = tail call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5, i32 438)
%7 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_get_sample_info_by_index() {
  printf("NOT IMPLEMENTED:"
         "pa_context_get_sample_info_by_index"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"NOT IMPLEMENTED:pa_context_get_sample_info_by_index\0A\00"
define i32 @pa_context_get_sample_info_by_index() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [52 x i8] c"NOT IMPLEMENTED:pa_context_get_sample_info_by_index\00"
define i32 @pa_context_get_sample_info_by_index() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int *calloc(size_t, int);
int *allocate_ints(size_t nr) { return calloc(nr, sizeof(int)); }


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

x86 assembly (clang, -O2):
<allocate_ints>:
mov    $0x4,%esi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define i32* @allocate_ints(i64 %0) {
%2 = tail call i32* @calloc(i64 %0, i32 4)
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0x0a() {
  Assert_real((isalnum(10) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              55, ("isalnum should be 0 for 0x0a"));
}


x86 assembly (clang, -O0):
<t_isalnum_0x0a>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x37,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalnum_0x0a>:
push   %rax
mov    $0xa,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x37,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0x0a\00"
define void @t_isalnum_0x0a() {
%1 = call i64 @isalnum(i32 10)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0x0a\00"
define void @t_isalnum_0x0a() {
%1 = tail call i64 @isalnum(i32 10)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void caller_1_1_2_1_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_1_2_1_2_1_2() {
ret void
}
int kol_kill_process(unsigned process) {
  asm volatile("int $0x40" ::"a"(18), "b"(2), "c"(process));
}


x86 assembly (clang, -O0):
<kol_kill_process>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x12,%eax
mov    $0x2,%ebx
int    $0x40
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_kill_process>:
push   %rbx
mov    %edi,%ecx
mov    $0x12,%eax
mov    $0x2,%ebx
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @kol_kill_process(i32 %0) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 18, i32 2, i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_stream_issendable_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_stream@%p::issendable (rtpp_stream_issendable) is "
          "invoked after destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_stream_issendable_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_stream_issendable_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [89 x i8] c"Method rtpp_stream@%p::issendable (rtpp_stream_issendable) is invoked after destruction\0A\00"
define void @rtpp_stream_issendable_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [89 x i8] c"Method rtpp_stream@%p::issendable (rtpp_stream_issendable) is invoked after destruction\0A\00"
define void @rtpp_stream_issendable_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
void o_dtor(__attribute__((unused)) struct obj *o) { printf("Destroyed\n"); }


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

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

LLVM IR (-O0):
%struct.obj = type opaque
@.str = [11 x i8] c"Destroyed\0A\00"
define void @o_dtor(%struct.obj* %0) {
%2 = alloca %struct.obj*
store %struct.obj* %0, %struct.obj** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.obj = type opaque
@str = [10 x i8] c"Destroyed\00"
define void @o_dtor(%struct.obj* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
int log_2(unsigned int x) {
  int e = 0;
  while ((1 << e) < x) {
    x -= (1 << e);
    e++;
  }
  return e;
}


x86 assembly (clang, -O0):
<log_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    -0x4(%rbp),%eax
jae    1143 <log_2+0x43>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <log_2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_2>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     1122 <log_2+0x22>
xor    %ecx,%ecx
mov    $0x1,%edx
xchg   %ax,%ax
sub    %edx,%edi
lea    0x1(%rcx),%eax
mov    $0x2,%edx
shl    %cl,%edx
mov    %eax,%ecx
cmp    %edx,%edi
ja     1110 <log_2+0x10>
ret

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

LLVM IR (-O2):
define i32 @log_2(i32 %0) {
%2 = icmp ugt i32 %0, 1
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 1, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = phi i32 [ %7, %3 ], [ %0, %1 ]
%7 = sub i32 %6, %4
%8 = add nuw nsw i32 %5, 1
%9 = shl i32 2, %5
%10 = icmp ugt i32 %7, %9
br i1 %10, label %3, label %11
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
unsigned short signext8(unsigned char a) {
  if (a & 0x80) {
    return (unsigned short)a | 0xff00;
  }
  return a;
}


x86 assembly (clang, -O0):
<signext8>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1131 <signext8+0x31>
movzbl -0x3(%rbp),%eax
movzwl %ax,%eax
or     $0xff00,%eax
mov    %ax,-0x2(%rbp)
jmp    1139 <signext8+0x39>
movzbl -0x3(%rbp),%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signext8>:
lea    -0x100(%rdi),%eax
test   %dil,%dil
cmovns %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @signext8(i8 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 128
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i16
%11 = zext i16 %10 to i32
%12 = or i32 %11, 65280
%13 = trunc i32 %12 to i16
store i16 %13, i16* %2
br label %17
14: ; preds = %1
%15 = load i8, i8* %3
%16 = zext i8 %15 to i16
store i16 %16, i16* %2
br label %17
17: ; preds = %14, %8
%18 = load i16, i16* %2
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @signext8(i8 zeroext %0) {
%2 = icmp sgt i8 %0, -1
%3 = zext i8 %0 to i16
%4 = or i16 %3, -256
%5 = select i1 %2, i16 %3, i16 %4
ret i16 %5
}
/* Variables and functions */
int /*<<< orphan*/ emit_string(char *);
void event_split_voice() { emit_string("&"); }


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"&\00"
define void @event_split_voice() {
%1 = tail call i32 @emit_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ signal(int, void (*)(int));
void signal_sub_int(int *number, int *handler, int *status) {
  intptr_t ptr = *handler, ret;
  if (status != NULL) {
    ret = (intptr_t)signal(*number, (void (*)(int))ptr);
    *status = (int)ret;
  } else
    signal(*number, (void (*)(int))ptr);
}


x86 assembly (clang, -O0):
<signal_sub_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115e <signal_sub_int+0x4e>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
call   1030 <signal@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    116d <signal_sub_int+0x5d>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
call   1030 <signal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_sub_int>:
push   %rbx
mov    %rdx,%rbx
movslq (%rsi),%rsi
mov    (%rdi),%edi
call   1030 <signal@plt>
test   %rbx,%rbx
je     1125 <signal_sub_int+0x15>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @signal_sub_int(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
store i64 %11, i64* %7
%12 = load i32*, i32** %6
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %23
14: ; preds = %3
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i64, i64* %7
%18 = inttoptr i64 %17 to void (i32)*
%19 = call i64 @signal(i32 %16, void (i32)* %18)
store i64 %19, i64* %8
%20 = load i64, i64* %8
%21 = trunc i64 %20 to i32
%22 = load i32*, i32** %6
store i32 %21, i32* %22
br label %29
23: ; preds = %3
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = load i64, i64* %7
%27 = inttoptr i64 %26 to void (i32)*
%28 = call i64 @signal(i32 %25, void (i32)* %27)
br label %29
29: ; preds = %23, %14
ret void
}

LLVM IR (-O2):
define void @signal_sub_int(i32* nocapture %0, i32* nocapture %1, i32* writeonly %2) {
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = icmp eq i32* %2, null
%7 = load i32, i32* %0
%8 = inttoptr i64 %5 to void (i32)*
%9 = tail call i64 @signal(i32 %7, void (i32)* %8)
br i1 %6, label %12, label %10
10: ; preds = %3
%11 = trunc i64 %9 to i32
store i32 %11, i32* %2
br label %12
12: ; preds = %3, %10
ret void
}
/* Variables and functions */
char *strbld(char *, char const *);
char *strbld_array(char *dest, char const *src[]) {
  char *d = dest;
  for (int i = 0; src[i] != NULL; i++) {
    d = strbld(d, src[i]);
  }
  return d;
}


x86 assembly (clang, -O0):
<strbld_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1169 <strbld_array+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strbld@plt>
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112f <strbld_array+0x1f>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strbld_array>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rax
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1144 <strbld_array+0x34>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
call   1030 <strbld@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <strbld_array+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @strbld_array(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %7, %2
%6 = phi i8* [ %0, %2 ], [ %11, %7 ]
ret i8* %6
7: ; preds = %2, %7
%8 = phi i64 [ %12, %7 ], [ 0, %2 ]
%9 = phi i8* [ %14, %7 ], [ %3, %2 ]
%10 = phi i8* [ %11, %7 ], [ %0, %2 ]
%11 = tail call i8* @strbld(i8* %10, i8* %9)
%12 = add nuw i64 %8, 1
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %5, label %7
}
/* Type definitions */
typedef int /*<<< orphan*/ text;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int main(void) {
  FILE *file;
  char text[] = "Testing";
  file = fopen("test.txt", "wb");
  fwrite(text, sizeof(text), 1, file);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xec7(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x8,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x676e6974736554,%rax
mov    %rax,(%rsp)
lea    0xeca(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1030 <fopen@plt>
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1040 <fwrite@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.text = [8 x i8] c"Testing\00"
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [3 x i8] c"wb\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [8 x i8]
store i32 0, i32* %1
%4 = bitcast [8 x i8]* %3 to i8*
%5 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%7 = load i32*, i32** %2
%8 = call i32 @fwrite(i8* %6, i32 8, i32 1, i32* %7)
ret i32 1
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [3 x i8] c"wb\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 29113321805538644, i64* %1
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @fwrite(i8* %2, i32 8, i32 1, i32* %3)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int main(int argc, char *argv[]) {
  void *p = malloc(1024);
  free(p);
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @malloc(i32 1024)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @free(i8* %8)
%10 = load i8*, i8** %6
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%4 = tail call i32 @free(i8* %3)
%5 = tail call i32 @free(i8* %3)
ret i32 0
}
int f(unsigned char c) {
  int x;
  x = c + c;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
movzbl -0x5(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
%9 = add nsw i32 %6, %8
store i32 %9, i32* %4
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @f(i8 zeroext %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void quitproc() {
  printf("ctrl-\\ pressed to quit\n");
  exit(0);
}


x86 assembly (clang, -O0):
<quitproc>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [24 x i8] c"ctrl-\\ pressed to quit\0A\00"
define void @quitproc() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"ctrl-\\ pressed to quit\00"
define void @quitproc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
double derivative_central(double (*f)(double), double x, double h) {
  return (f(x + h) - f(x - h)) / (2 * h);
}


x86 assembly (clang, -O0):
<derivative_central>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<derivative_central>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
addsd  %xmm1,%xmm0
call   *%rdi
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
call   *%rbx
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @derivative_central(double (double)* %0, double %1, double %2) {
%4 = alloca double (double)*
%5 = alloca double
%6 = alloca double
store double (double)* %0, double (double)** %4
store double %1, double* %5
store double %2, double* %6
%7 = load double (double)*, double (double)** %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fadd double %8, %9
%11 = call double %7(double %10)
%12 = load double (double)*, double (double)** %4
%13 = load double, double* %5
%14 = load double, double* %6
%15 = fsub double %13, %14
%16 = call double %12(double %15)
%17 = fsub double %11, %16
%18 = load double, double* %6
%19 = fmul double 2.000000e+00, %18
%20 = fdiv double %17, %19
ret double %20
}

LLVM IR (-O2):
define double @derivative_central(double (double)* nocapture %0, double %1, double %2) {
%4 = fadd double %1, %2
%5 = tail call double %0(double %4)
%6 = fsub double %1, %2
%7 = tail call double %0(double %6)
%8 = fsub double %5, %7
%9 = fmul double %2, 2.000000e+00
%10 = fdiv double %8, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void die(char *msg) {
  fprintf(stderr, "%s", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, unsigned long);
unsigned char mem_copy_to(void *dst, char *bytes, unsigned long len) {
  memcpy(dst, (void *)bytes, len);
  return (1);
}


x86 assembly (clang, -O0):
<mem_copy_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_copy_to>:
push   %rax
call   1030 <memcpy@plt>
mov    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @mem_copy_to(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcpy(i8* %7, i8* %8, i64 %9)
ret i8 1
}

LLVM IR (-O2):
define zeroext i8 @mem_copy_to(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
ret i8 1
}
void Sleep(int sleep_secs) {
  asm("movl %0, %%eax; int $49" : : "g"(sleep_secs) : "eax");
}


x86 assembly (clang, -O0):
<Sleep>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
int    $0x31
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sleep>:
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
int    $0x31
ret

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

LLVM IR (-O2):
define void @Sleep(i32 %0) {
tail call void asm sideeffect "movl $0, %eax; int $$49", "imr,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret void
}
/* Variables and functions */
char *ft_strcpy(char *, char *);
scalar_t__ ft_strlen(char *);
char *ft_strnew(scalar_t__);
void ft_strswap(char *s1, char *s2) {
  char *tmp;
  tmp = ft_strnew(ft_strlen(s1) + 1);
  tmp = ft_strcpy(tmp, s1);
  s1 = ft_strcpy(s1, s2);
  s2 = ft_strcpy(s2, tmp);
}


x86 assembly (clang, -O0):
<ft_strswap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <ft_strnew@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <ft_strcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ft_strcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ft_strcpy@plt>
mov    %rax,-0x10(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strswap>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <ft_strnew@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <ft_strcpy@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ft_strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <ft_strcpy@plt>

LLVM IR (-O0):
define void @ft_strswap(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @ft_strlen(i8* %6)
%8 = add nsw i64 %7, 1
%9 = call i8* @ft_strnew(i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = call i8* @ft_strcpy(i8* %10, i8* %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i8* @ft_strcpy(i8* %13, i8* %14)
store i8* %15, i8** %3
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i8* @ft_strcpy(i8* %16, i8* %17)
store i8* %18, i8** %4
ret void
}

LLVM IR (-O2):
define void @ft_strswap(i8* %0, i8* %1) {
%3 = tail call i64 @ft_strlen(i8* %0)
%4 = add nsw i64 %3, 1
%5 = tail call i8* @ft_strnew(i64 %4)
%6 = tail call i8* @ft_strcpy(i8* %5, i8* %0)
%7 = tail call i8* @ft_strcpy(i8* %0, i8* %1)
%8 = tail call i8* @ft_strcpy(i8* %1, i8* %6)
ret void
}
void _jumpToMethod(void (*function)()) { (*function)(); }


x86 assembly (clang, -O0):
<_jumpToMethod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_jumpToMethod>:
xor    %eax,%eax
jmp    *%rdi

LLVM IR (-O0):
define void @_jumpToMethod(void (...)* %0) {
%2 = alloca void (...)*
store void (...)* %0, void (...)** %2
%3 = load void (...)*, void (...)** %2
ret void
}

LLVM IR (-O2):
define void @_jumpToMethod(void (...)* nocapture %0) {
tail call void (...) %0()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ counter(int *, int, char *);
void call_counter() {
  int list[20];
  counter(list, 20, "fubarbaz");
}


x86 assembly (clang, -O0):
<call_counter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x50(%rbp),%rdi
mov    $0x14,%esi
lea    0xed8(%rip),%rdx
call   1030 <counter@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_counter>:
sub    $0x58,%rsp
lea    0xee5(%rip),%rdx
mov    %rsp,%rdi
mov    $0x14,%esi
call   1030 <counter@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"fubarbaz\00"
define void @call_counter() {
%1 = alloca [20 x i32]
%2 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%3 = call i32 @counter(i32* %2, i32 20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"fubarbaz\00"
define void @call_counter() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%4 = call i32 @counter(i32* %3, i32 20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct btf_type {
  int dummy;
};

/* Variables and functions */
scalar_t__ BTF_KIND_TYPEDEF;
scalar_t__ btf_kind(struct btf_type const *);
bool btf_is_typedef(const struct btf_type *t) {
  return btf_kind(t) == BTF_KIND_TYPEDEF;
}


x86 assembly (clang, -O0):
<btf_is_typedef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <btf_kind@plt>
mov    0x2eb4(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btf_is_typedef>:
push   %rax
call   1030 <btf_kind@plt>
mov    0x2ec3(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.btf_type = type { i32 }
@BTF_KIND_TYPEDEF = global i64 0
define i32 @btf_is_typedef(%struct.btf_type* %0) {
%2 = alloca %struct.btf_type*
store %struct.btf_type* %0, %struct.btf_type** %2
%3 = load %struct.btf_type*, %struct.btf_type** %2
%4 = call i64 @btf_kind(%struct.btf_type* %3)
%5 = load i64, i64* @BTF_KIND_TYPEDEF
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.btf_type = type { i32 }
@BTF_KIND_TYPEDEF = global i64 0
define i32 @btf_is_typedef(%struct.btf_type* %0) {
%2 = tail call i64 @btf_kind(%struct.btf_type* %0)
%3 = load i64, i64* @BTF_KIND_TYPEDEF
%4 = icmp eq i64 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
void rop3_32_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~S;
  stk2 = T & stk3;
  stk1 = *D & stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_32_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_32_0_1>:
mov    %esi,%eax
not    %eax
movzbl (%rdi),%ecx
and    %edx,%eax
and    %ecx,%eax
and    %eax,%esi
not    %edx
and    %eax,%edx
or     %eax,%esi
or     %edx,%esi
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_32_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = xor i32 %11, -1
%13 = trunc i32 %12 to i8
store i8 %13, i8* %9
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = load i8, i8* %9
%17 = zext i8 %16 to i32
%18 = and i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = and i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = and i32 %28, %30
%32 = load i8, i8* %7
%33 = zext i8 %32 to i32
%34 = load i8, i8* %6
%35 = zext i8 %34 to i32
%36 = xor i32 %35, -1
%37 = and i32 %33, %36
%38 = or i32 %31, %37
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = load i8, i8* %5
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = and i32 %44, %47
%49 = or i32 %38, %48
%50 = trunc i32 %49 to i8
%51 = load i8*, i8** %4
store i8 %50, i8* %51
ret void
}

LLVM IR (-O2):
define void @rop3_32_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %1 to i32
%5 = xor i32 %4, -1
%6 = zext i8 %2 to i32
%7 = trunc i32 %5 to i8
%8 = and i8 %7, %2
%9 = load i8, i8* %0
%10 = zext i8 %9 to i32
%11 = and i8 %8, %9
%12 = zext i8 %11 to i32
%13 = and i8 %11, %1
%14 = zext i8 %13 to i32
%15 = xor i32 %6, -1
%16 = and i32 %12, %15
%17 = and i32 %6, %5
%18 = and i32 %17, %10
%19 = or i32 %18, %14
%20 = or i32 %19, %16
%21 = trunc i32 %20 to i8
store i8 %21, i8* %0
ret void
}