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

/* Variables and functions */
int /*<<< orphan*/ *fdopen(int, char const *);
int open_at(int, char const *, char const *, int);
FILE *fopen_at(int dir, const char *dirname, const char *filename, int flags,
               const char *mode) {
  int fd = open_at(dir, dirname, filename, flags);
  if (fd < 0)
    return NULL;
  return fdopen(fd, mode);
}


x86 assembly (clang, -O0):
<fopen_at>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <open_at@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1167 <fopen_at+0x47>
movq   $0x0,-0x8(%rbp)
jmp    1177 <fopen_at+0x57>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   1030 <fdopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopen_at>:
push   %rbx
mov    %r8,%rbx
call   1040 <open_at@plt>
test   %eax,%eax
js     1138 <fopen_at+0x18>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <fdopen@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @fopen_at(i32 %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
%13 = load i32, i32* %7
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = load i32, i32* %10
%17 = call i32 @open_at(i32 %13, i8* %14, i8* %15, i32 %16)
store i32 %17, i32* %12
%18 = load i32, i32* %12
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %5
store i32* null, i32** %6
br label %25
21: ; preds = %5
%22 = load i32, i32* %12
%23 = load i8*, i8** %11
%24 = call i32* @fdopen(i32 %22, i8* %23)
store i32* %24, i32** %6
br label %25
25: ; preds = %21, %20
%26 = load i32*, i32** %6
ret i32* %26
}

LLVM IR (-O2):
define noalias i32* @fopen_at(i32 %0, i8* %1, i8* %2, i32 %3, i8* nocapture %4) {
%6 = tail call i32 @open_at(i32 %0, i8* %1, i8* %2, i32 %3)
%7 = icmp slt i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32* @fdopen(i32 %6, i8* %4)
br label %10
10: ; preds = %5, %8
%11 = phi i32* [ %9, %8 ], [ null, %5 ]
ret i32* %11
}
double test_double(double x) { return x * 0.5; }


x86 assembly (clang, -O0):
<test_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @test_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 5.000000e-01
ret double %4
}

LLVM IR (-O2):
define double @test_double(double %0) {
%2 = fmul double %0, 5.000000e-01
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ close_log();
void roll_handler(int signum) {
  (void)signum;
  close_log();
}


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

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

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

LLVM IR (-O2):
define void @roll_handler(i32 %0) {
%2 = tail call i32 (...) @close_log()
ret void
}
void msg_text_secway(struct TCP_STREAM *stream, struct NetFrame *frame,
                     struct StringReassembler *data) {
  data = (data);
  frame = (frame);
  stream = (stream);
}


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

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

LLVM IR (-O0):
%struct.TCP_STREAM = type opaque
%struct.NetFrame = type opaque
%struct.StringReassembler = type opaque
define void @msg_text_secway(%struct.TCP_STREAM* %0, %struct.NetFrame* %1, %struct.StringReassembler* %2) {
%4 = alloca %struct.TCP_STREAM*
%5 = alloca %struct.NetFrame*
%6 = alloca %struct.StringReassembler*
store %struct.TCP_STREAM* %0, %struct.TCP_STREAM** %4
store %struct.NetFrame* %1, %struct.NetFrame** %5
store %struct.StringReassembler* %2, %struct.StringReassembler** %6
%7 = load %struct.StringReassembler*, %struct.StringReassembler** %6
store %struct.StringReassembler* %7, %struct.StringReassembler** %6
%8 = load %struct.NetFrame*, %struct.NetFrame** %5
store %struct.NetFrame* %8, %struct.NetFrame** %5
%9 = load %struct.TCP_STREAM*, %struct.TCP_STREAM** %4
store %struct.TCP_STREAM* %9, %struct.TCP_STREAM** %4
ret void
}

LLVM IR (-O2):
%struct.TCP_STREAM = type opaque
%struct.NetFrame = type opaque
%struct.StringReassembler = type opaque
define void @msg_text_secway(%struct.TCP_STREAM* nocapture %0, %struct.NetFrame* nocapture %1, %struct.StringReassembler* nocapture %2) {
ret void
}
/* Variables and functions */
int open(char *, int);
int posix_openpt(int flags) { return open("/dev/ptmx", flags); }


x86 assembly (clang, -O0):
<posix_openpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_openpt>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <open@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/ptmx\00"
define i32 @posix_openpt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/ptmx\00"
define i32 @posix_openpt(i32 %0) {
%2 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr1setBank6(int);
void m65setParamsB006(uint16_t addr, uint8_t val) {
  (void)addr;
  chr1setBank6(val << 10);
}


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

x86 assembly (clang, -O2):
mov    %esi,%edi
shl    $0xa,%edi
jmp    1030 <chr1setBank6@plt>

LLVM IR (-O0):
define void @m65setParamsB006(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 = shl i32 %6, 10
%8 = call i32 @chr1setBank6(i32 %7)
ret void
}

LLVM IR (-O2):
define void @m65setParamsB006(i32 %0, i32 %1) {
%3 = shl i32 %1, 10
%4 = tail call i32 @chr1setBank6(i32 %3)
ret void
}
void gtk_text_view_get_visible_rect() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_view_get_visible_rect() {
ret void
}
int foo(int x, int y) {
  const int z = 2;
  if (z & 1)
    return x << y;
  return 0;
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ _mm_set_ss(float);
__m128 test_mm_set_ss(float A) { return _mm_set_ss(A); }


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

x86 assembly (clang, -O2):
<test_mm_set_ss>:
jmp    1030 <_mm_set_ss@plt>

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

LLVM IR (-O2):
define i32 @test_mm_set_ss(float %0) {
%2 = tail call i32 @_mm_set_ss(float %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ glColor4b(char, char, char, char);
void Color4b(signed char r, signed char g, signed char b, signed char a) {
  glColor4b(r, g, b, a);
}


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

x86 assembly (clang, -O2):
<Color4b>:
jmp    1030 <glColor4b@plt>

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

LLVM IR (-O2):
define void @Color4b(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = tail call i32 @glColor4b(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3)
ret void
}
/* Variables and functions */
int op3(int, int);
int test_3(void) { return op3(1, -1); }


x86 assembly (clang, -O0):
<test_3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <op3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_3>:
mov    $0x1,%edi
mov    $0xffffffff,%esi
jmp    1030 <op3@plt>

LLVM IR (-O0):
define i32 @test_3() {
%1 = call i32 @op3(i32 1, i32 -1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @test_3() {
%1 = tail call i32 @op3(i32 1, i32 -1)
ret i32 %1
}
/* Variables and functions */
double f(double, double);
double fPrima(double);
double siguientePaso(double x, double num) {
  return x - (f(x, num) / fPrima(x));
}


x86 assembly (clang, -O0):
<siguientePaso>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <f@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fPrima@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<siguientePaso>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <f@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <fPrima@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @siguientePaso(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %4
%8 = call double @f(double %6, double %7)
%9 = load double, double* %3
%10 = call double @fPrima(double %9)
%11 = fdiv double %8, %10
%12 = fsub double %5, %11
ret double %12
}

LLVM IR (-O2):
define double @siguientePaso(double %0, double %1) {
%3 = tail call double @f(double %0, double %1)
%4 = tail call double @fPrima(double %0)
%5 = fdiv double %3, %4
%6 = fsub double %0, %5
ret double %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ hello();
int main(int argc, char *argv[]) {
  hello();
  return EXIT_SUCCESS;
}


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 <hello@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@EXIT_SUCCESS = 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 (...) @hello()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @hello()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
int listContains(int *haystack, int size, int needle) {
  int i;
  for (i = 0; i < size; i++) {
    if (haystack[i] == needle)
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<listContains>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <listContains+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1140 <listContains+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <listContains+0x5a>
jmp    1145 <listContains+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <listContains+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<listContains>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <listContains+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <listContains+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <listContains+0x10>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @listContains(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%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 0, i32* %8
br label %9
9: ; preds = %24, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = load i32*, i32** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %7
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = load i32, i32* %8
store i32 %22, i32* %4
br label %28
23: ; preds = %13
br label %24
24: ; preds = %23
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %9
27: ; preds = %9
store i32 -1, i32* %4
br label %28
28: ; preds = %27, %21
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @listContains(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
char *basename(name) const char *name;
{
  const char *base;
  for (base = name; *name; name++) {
    if (*name == '/') {
      base = name + 1;
    }
  }
  return (char *)base;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114f <basename+0x4f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1139 <basename+0x39>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113e <basename+0x3e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <basename+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
mov    %rdi,%rax
lea    0x1(%rdi),%rcx
jmp    1117 <basename+0x17>
nopl   0x0(%rax)
mov    %rcx,%rax
add    $0x1,%rcx
movzbl -0x1(%rcx),%edx
cmp    $0x2f,%dl
je     1110 <basename+0x10>
test   %dl,%dl
jne    1113 <basename+0x13>
ret

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

LLVM IR (-O2):
define i8* @basename(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ %0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 47, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void sleep_test() { usleep(1000000); }


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

x86 assembly (clang, -O2):
<sleep_test>:
mov    $0xf4240,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @sleep_test() {
%1 = call i32 @usleep(i32 1000000)
ret void
}

LLVM IR (-O2):
define void @sleep_test() {
%1 = tail call i32 @usleep(i32 1000000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wyswietl();
void Zmianarozmiarow(int width, int height) { wyswietl(); }


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

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

LLVM IR (-O0):
define void @Zmianarozmiarow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @wyswietl()
ret void
}

LLVM IR (-O2):
define void @Zmianarozmiarow(i32 %0, i32 %1) {
%3 = tail call i32 (...) @wyswietl()
ret void
}
int gys(int a, int b) {
  if (b == 0)
    return a;
  if (a > b)
    return gys(b, a % b);
  else
    return gys(a, b % a);
}


x86 assembly (clang, -O0):
<gys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <gys+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116c <gys+0x5c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1158 <gys+0x48>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gys@plt>
mov    %eax,-0x4(%rbp)
jmp    116c <gys+0x5c>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <gys@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gys>:
test   %esi,%esi
je     113d <gys+0x3d>
mov    %esi,%edx
mov    %edx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %ecx,%edi
jg     1130 <gys+0x30>
mov    %ecx,%eax
cltd
idiv   %edi
mov    %edx,%ecx
test   %edx,%edx
jne    1110 <gys+0x10>
jmp    113d <gys+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
mov    %ecx,%edi
test   %edx,%edx
jne    1106 <gys+0x6>
jmp    113f <gys+0x3f>
mov    %edi,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gys(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %16, label %4
4: ; preds = %2, %10
%5 = phi i32 [ %11, %10 ], [ %1, %2 ]
%6 = phi i32 [ %8, %10 ], [ %0, %2 ]
br label %7
7: ; preds = %4, %13
%8 = phi i32 [ %5, %4 ], [ %14, %13 ]
%9 = icmp sgt i32 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = srem i32 %6, %8
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %4
13: ; preds = %7
%14 = srem i32 %8, %6
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %10, %13, %2
%17 = phi i32 [ %0, %2 ], [ %6, %13 ], [ %8, %10 ]
ret i32 %17
}
int hostapd_ubus_handle_event(struct hostapd_data *hapd,
                              struct hostapd_ubus_request *req) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.hostapd_data = type opaque
%struct.hostapd_ubus_request = type opaque
define i32 @hostapd_ubus_handle_event(%struct.hostapd_data* %0, %struct.hostapd_ubus_request* %1) {
%3 = alloca %struct.hostapd_data*
%4 = alloca %struct.hostapd_ubus_request*
store %struct.hostapd_data* %0, %struct.hostapd_data** %3
store %struct.hostapd_ubus_request* %1, %struct.hostapd_ubus_request** %4
ret i32 0
}

LLVM IR (-O2):
%struct.hostapd_data = type opaque
%struct.hostapd_ubus_request = type opaque
define i32 @hostapd_ubus_handle_event(%struct.hostapd_data* nocapture readnone %0, %struct.hostapd_ubus_request* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
void *mempool_malloc(size_t size) { return (malloc(size)); }


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

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

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

LLVM IR (-O2):
define noalias i8* @mempool_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
sizeString(char *str) {
  int size = 0;
  while (str[size] != '\0') {
    size++;
  }
  return size;
}


x86 assembly (clang, -O0):
<sizeString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <sizeString+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <sizeString+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sizeString>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <sizeString+0x10>
ret

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

LLVM IR (-O2):
define i32 @sizeString(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
scalar_t__ CallBack2(int, void *, char *);
int GetIndexedIgorColorTableName(int index, char name[31 + 1]) {
  *name = 0;
  return (int)CallBack2(164, (void *)index, name);
}


x86 assembly (clang, -O0):
<GetIndexedIgorColorTableName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movslq -0x4(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0xa4,%edi
call   1030 <CallBack2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetIndexedIgorColorTableName>:
mov    %rsi,%rdx
movb   $0x0,(%rsi)
movslq %edi,%rsi
mov    $0xa4,%edi
jmp    1030 <CallBack2@plt>

LLVM IR (-O0):
define i32 @GetIndexedIgorColorTableName(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
store i8 0, i8* %5
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = load i8*, i8** %4
%10 = call i64 @CallBack2(i32 164, i8* %8, i8* %9)
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @GetIndexedIgorColorTableName(i32 %0, i8* %1) {
store i8 0, i8* %1
%3 = sext i32 %0 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @CallBack2(i32 164, i8* %4, i8* %1)
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double file_time() {
  double tseconds = 0.0;
  struct timeval mytime;
  gettimeofday(&mytime, NULL);
  tseconds = (double)mytime.tv_sec + (double)mytime.tv_usec * 1.0e-6;
  return (tseconds);
}


x86 assembly (clang, -O0):
<file_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x10(%rbp),%xmm1
cvtsi2sdq -0x18(%rbp),%xmm0
movsd  0xebf(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @file_time() {
%1 = alloca double
%2 = alloca %struct.timeval
store double 0.000000e+00, double* %1
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
store double %10, double* %1
%11 = load double, double* %1
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @file_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 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}
/* Variables and functions */
scalar_t__ __a_cas(int, int, int volatile *);
void a_or(volatile int *p, int v) {
  int old;
  do
    old = *p;
  while (__a_cas(old, old | v, p));
}


x86 assembly (clang, -O0):
<a_or>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
or     -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <__a_cas@plt>
cmp    $0x0,%rax
jne    111f <a_or+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_or>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edi
mov    %edi,%esi
or     %ebp,%esi
mov    %rbx,%rdx
call   1030 <__a_cas@plt>
test   %rax,%rax
jne    1120 <a_or+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @a_or(i32* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i32, i32* %0
%5 = or i32 %4, %1
%6 = tail call i64 @__a_cas(i32 %4, i32 %5, i32* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret void
}
void test13(int x) {
  switch (x) {
  case 42:
    test13(97);
  case 11:
    break;
  default:
    test13(42);
    break;
  }
}


x86 assembly (clang, -O0):
<test13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xb,%eax
je     114a <test13+0x3a>
jmp    112f <test13+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2a,%eax
jne    114f <test13+0x3f>
jmp    1140 <test13+0x30>
mov    $0x61,%edi
call   1030 <test13@plt>
jmp    1159 <test13+0x49>
mov    $0x2a,%edi
call   1030 <test13@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test13>:
mov    %edi,%eax
mov    $0x61,%edi
cmp    $0x2a,%eax
je     1100 <test13>
cmp    $0xb,%eax
je     1118 <test13+0x18>
mov    $0x2a,%edi
jmp    1100 <test13>
ret

LLVM IR (-O0):
define void @test13(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %6 [
i32 42, label %4
i32 11, label %5
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
br label %7
6: ; preds = %1
br label %7
7: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @test13(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i32 [ %0, %1 ], [ %6, %5 ]
switch i32 %3, label %4 [
i32 42, label %5
i32 11, label %7
]
4: ; preds = %2
br label %5
5: ; preds = %4, %2
%6 = phi i32 [ 42, %4 ], [ 97, %2 ]
br label %2
7: ; preds = %2
ret void
}
int leastBitPos(int n) {}


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

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

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

LLVM IR (-O2):
define i32 @leastBitPos(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int vn(unsigned char const *, unsigned char const *, int);
int crypto_verify_32_tweet(const unsigned char *x, const unsigned char *y) {
  return vn(x, y, 32);
}


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

x86 assembly (clang, -O2):
<crypto_verify_32_tweet>:
mov    $0x20,%edx
jmp    1030 <vn@plt>

LLVM IR (-O0):
define i32 @crypto_verify_32_tweet(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 = call i32 @vn(i8* %5, i8* %6, i32 32)
ret i32 %7
}

LLVM IR (-O2):
define i32 @crypto_verify_32_tweet(i8* %0, i8* %1) {
%3 = tail call i32 @vn(i8* %0, i8* %1, i32 32)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void assert(int a) {
  if (!a)
    abort();
}


x86 assembly (clang, -O0):
<assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112c <assert+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert>:
test   %edi,%edi
je     1115 <assert+0x5>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @assert(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @assert(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
void lh_num_items(void) {}


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

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

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

LLVM IR (-O2):
define void @lh_num_items() {
ret void
}
int test_imm_39int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x39 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_39int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x39,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_39int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 57
%7 = icmp ne i64 %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_39int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 3735552
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int task_flag_asserted(int, int);
int task_fifo_asserted(int id) { return task_flag_asserted(id, (1 << 4)); }


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

x86 assembly (clang, -O2):
<task_fifo_asserted>:
mov    $0x10,%esi
jmp    1030 <task_flag_asserted@plt>

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

LLVM IR (-O2):
define i32 @task_fifo_asserted(i32 %0) {
%2 = tail call i32 @task_flag_asserted(i32 %0, i32 16)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void sigterm_callback_handler(int signum) { exit(signum); }


x86 assembly (clang, -O0):
<sigterm_callback_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sigterm_callback_handler>:
push   %rax
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @sigterm_callback_handler(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
void rq_term() {}


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

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

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

LLVM IR (-O2):
define void @rq_term() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_ext_device_restore_save_formats() {
  printf("NOT IMPLEMENTED:"
         "pa_ext_device_restore_save_formats"
         "\n");
}


x86 assembly (clang, -O0):
<pa_ext_device_restore_save_formats>:
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_ext_device_restore_save_formats>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [51 x i8] c"NOT IMPLEMENTED:pa_ext_device_restore_save_formats\00"
define i32 @pa_ext_device_restore_save_formats() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
scalar_t__ malloc(int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strdup(char *str) {
  char *new_str = (char *)malloc(sizeof(char) * strlen(str));
  strncpy(new_str, str, strlen(str));
  return new_str;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = sext i32 %5 to i64
%7 = mul i64 1, %6
%8 = trunc i64 %7 to i32
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = load i8*, i8** %2
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @strncpy(i8* %11, i8* %12, i32 %14)
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %5)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ org_trifort_setlong(char *, int, long long);
char *org_trifort_gc_init(char *gc_info_space, long long *to_space,
                          long long to_space_free_ptr, long long space_size) {
  org_trifort_setlong(gc_info_space, 0, (long long)to_space);
  org_trifort_setlong(gc_info_space, 8, to_space_free_ptr);
  org_trifort_setlong(gc_info_space, 16, space_size);
  return (char *)gc_info_space;
}


x86 assembly (clang, -O0):
<org_trifort_gc_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <org_trifort_setlong@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8,%esi
call   1030 <org_trifort_setlong@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x10,%esi
call   1030 <org_trifort_setlong@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<org_trifort_gc_init>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rdx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <org_trifort_setlong@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r15,%rdx
call   1030 <org_trifort_setlong@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %r14,%rdx
call   1030 <org_trifort_setlong@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @org_trifort_gc_init(i8* %0, i64* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %5
store i64* %1, i64** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i64*, i64** %6
%11 = ptrtoint i64* %10 to i64
%12 = call i32 @org_trifort_setlong(i8* %9, i32 0, i64 %11)
%13 = load i8*, i8** %5
%14 = load i64, i64* %7
%15 = call i32 @org_trifort_setlong(i8* %13, i32 8, i64 %14)
%16 = load i8*, i8** %5
%17 = load i64, i64* %8
%18 = call i32 @org_trifort_setlong(i8* %16, i32 16, i64 %17)
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @org_trifort_gc_init(i8* returned %0, i64* %1, i64 %2, i64 %3) {
%5 = ptrtoint i64* %1 to i64
%6 = tail call i32 @org_trifort_setlong(i8* %0, i32 0, i64 %5)
%7 = tail call i32 @org_trifort_setlong(i8* %0, i32 8, i64 %2)
%8 = tail call i32 @org_trifort_setlong(i8* %0, i32 16, i64 %3)
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ closeFile(int /*<<< orphan*/ *);
int /*<<< orphan*/ *openFile(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ readFile(int /*<<< orphan*/ *);
int main() {
  FILE *fp1;
  fp1 = openFile(fp1, "num.txt", "r");
  readFile(fp1);
  closeFile(fp1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
lea    0xeb7(%rip),%rdx
call   1030 <openFile@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <readFile@plt>
mov    -0x10(%rbp),%rdi
call   1040 <closeFile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rsi
lea    0xec9(%rip),%rdx
call   1030 <openFile@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <readFile@plt>
mov    %rbx,%rdi
call   1040 <closeFile@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"num.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = load i32*, i32** %2
%4 = call i32* @openFile(i32* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @readFile(i32* %5)
%7 = load i32*, i32** %2
%8 = call i32 @closeFile(i32* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"num.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = tail call i32* @openFile(i32* undef, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @readFile(i32* %1)
%3 = tail call i32 @closeFile(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ die_if_readerr(int, size_t);
int read(int, void *, size_t);
int sread(int fd, void *buf, size_t size) {
  int ret = read(fd, buf, size);
  die_if_readerr(ret, size);
  return ret;
}


x86 assembly (clang, -O0):
<sread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <die_if_readerr@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sread>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
call   1030 <read@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <die_if_readerr@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sread(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @read(i32 %8, i8* %9, i64 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i64, i64* %6
%14 = call i32 @die_if_readerr(i32 %12, i64 %13)
%15 = load i32, i32* %7
ret i32 %15
}

LLVM IR (-O2):
define i32 @sread(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%5 = tail call i32 @die_if_readerr(i32 %4, i64 %2)
ret i32 %4
}
void TIM8_BRK_TIM12_IRQHandler() {}


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

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

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

LLVM IR (-O2):
define void @TIM8_BRK_TIM12_IRQHandler() {
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
void setScaledValue(uint8_t *encodedValue, int value) {
  int valueToEncode;
  if (value < 0)
    valueToEncode = value + 65536;
  else
    valueToEncode = value;
  encodedValue[0] = (uint8_t)(valueToEncode % 256);
  encodedValue[1] = (uint8_t)(valueToEncode / 256);
}


x86 assembly (clang, -O0):
<setScaledValue>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1125 <setScaledValue+0x25>
mov    -0xc(%rbp),%eax
add    $0x10000,%eax
mov    %eax,-0x10(%rbp)
jmp    112b <setScaledValue+0x2b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setScaledValue>:
lea    0x10000(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
mov    %ecx,%edx
and    $0xffffff00,%edx
sub    %edx,%eax
cltq
mov    %rax,(%rdi)
sar    $0x8,%ecx
movslq %ecx,%rax
mov    %rax,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @setScaledValue(i64* nocapture writeonly %0, i32 %1) {
%3 = icmp slt i32 %1, 0
%4 = add nsw i32 %1, 65536
%5 = select i1 %3, i32 %4, i32 %1
%6 = srem i32 %5, 256
%7 = sext i32 %6 to i64
store i64 %7, i64* %0
%8 = sdiv i32 %5, 256
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %9, i64* %10
ret void
}