xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ atol(char *);
int bench_stat(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc == 1 + 1) {
    return -bench_stat(atol(argv[1]));
  } else {
    printf("USAGE : bench_stat count\n");
    return 7;
  }
}


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)
cmpl   $0x2,-0x8(%rbp)
jne    1172 <main+0x42>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
call   1040 <bench_stat@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <main+0x55>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movl   $0x7,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    114a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
call   1040 <bench_stat@plt>
neg    %eax
pop    %rcx
ret
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x7,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"USAGE : bench_stat count\0A\00"
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 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atol(i8* %11)
%13 = call i32 @bench_stat(i32 %12)
%14 = sub nsw i32 0, %13
store i32 %14, i32* %3
br label %17
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 7, i32* %3
br label %17
17: ; preds = %15, %8
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@str = [25 x i8] c"USAGE : bench_stat count\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atol(i8* %6)
%8 = tail call i32 @bench_stat(i32 %7)
%9 = sub nsw i32 0, %8
br label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %4
%13 = phi i32 [ %9, %4 ], [ 7, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ sin(int /*<<< orphan*/);
int /*<<< orphan*/ wPopNumber();
int /*<<< orphan*/ wPushNumber(int /*<<< orphan*/);
void wBasSin() { wPushNumber(sin(wPopNumber())); }


x86 assembly (clang, -O0):
<wBasSin>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <wPopNumber@plt>
mov    %eax,%edi
call   1050 <sin@plt>
mov    %eax,%edi
call   1030 <wPushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasSin>:
push   %rax
xor    %eax,%eax
call   1040 <wPopNumber@plt>
mov    %eax,%edi
call   1050 <sin@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <wPushNumber@plt>

LLVM IR (-O0):
define void @wBasSin() {
%1 = call i32 (...) @wPopNumber()
%2 = call i32 @sin(i32 %1)
%3 = call i32 @wPushNumber(i32 %2)
ret void
}

LLVM IR (-O2):
define void @wBasSin() {
%1 = tail call i32 (...) @wPopNumber()
%2 = tail call i32 @sin(i32 %1)
%3 = tail call i32 @wPushNumber(i32 %2)
ret void
}
int ice_cmp_int(const void *a, const void *b) {
  const int *ia = (const int *)a;
  const int *ib = (const int *)b;
  return *ia - *ib;
}


x86 assembly (clang, -O0):
<ice_cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ice_cmp_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @ice_cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int main() {
  int c;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t')
      putchar('\n');
    else {
      putchar(c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1178 <main+0x58>
cmpl   $0x20,-0x8(%rbp)
je     115c <main+0x3c>
cmpl   $0x9,-0x8(%rbp)
jne    116b <main+0x4b>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1173 <main+0x53>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
jmp    114c <main+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1163 <main+0x43>
mov    $0xa,%edi
cmp    $0x9,%eax
je     1140 <main+0x20>
cmp    $0x20,%eax
je     1140 <main+0x20>
mov    %eax,%edi
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %18, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 32
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 9
br i1 %12, label %13, label %15
13: ; preds = %10, %7
%14 = call i32 @putchar(i32 10)
br label %18
15: ; preds = %10
%16 = load i32, i32* %2
%17 = call i32 @putchar(i32 %16)
br label %18
18: ; preds = %15, %13
br label %3
19: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %7
%5 = phi i32 [ %10, %7 ], [ %1, %0 ]
switch i32 %5, label %6 [
i32 32, label %7
i32 9, label %7
]
6: ; preds = %4
br label %7
7: ; preds = %4, %4, %6
%8 = phi i32 [ %5, %6 ], [ 10, %4 ], [ 10, %4 ]
%9 = tail call i32 @putchar(i32 %8)
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %7, %0
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void sys_clk_init() {
  uint32_t val;
  val = 0x1;
  (*(volatile uint32_t *)((0x40048000 + 0x078)) = (val & 0xff));
  val = 0x1;
  (*(volatile uint32_t *)((0x40048000 + 0x094)) = (val & 0xff));
  val = (*(volatile uint32_t *)((0x40048000 + 0x080)));
  val |= (1 << 14);
  (*(volatile uint32_t *)((0x40048000 + 0x080)) = (val));
}


x86 assembly (clang, -O0):
<sys_clk_init>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    $0x40048078,%eax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    $0x40048094,%eax
mov    %ecx,(%rax)
mov    $0x40048080,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x40048080,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_clk_init>:
movl   $0x1,0x40048078
movl   $0x1,0x40048094
orl    $0x4000,0x40048080
ret

LLVM IR (-O0):
define void @sys_clk_init() {
%1 = alloca i32
store i32 1, i32* %1
%2 = load i32, i32* %1
%3 = and i32 %2, 255
store volatile i32 %3, i32* inttoptr (i64 1074036856 to i32*)
store i32 1, i32* %1
%4 = load i32, i32* %1
%5 = and i32 %4, 255
store volatile i32 %5, i32* inttoptr (i64 1074036884 to i32*)
%6 = load volatile i32, i32* inttoptr (i64 1074036864 to i32*)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = or i32 %7, 16384
store i32 %8, i32* %1
%9 = load i32, i32* %1
store volatile i32 %9, i32* inttoptr (i64 1074036864 to i32*)
ret void
}

LLVM IR (-O2):
define void @sys_clk_init() {
store volatile i32 1, i32* inttoptr (i64 1074036856 to i32*)
store volatile i32 1, i32* inttoptr (i64 1074036884 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 1074036864 to i32*)
%2 = or i32 %1, 16384
store volatile i32 %2, i32* inttoptr (i64 1074036864 to i32*)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ chars;
};
typedef TYPE_1__ XwcTextItem;

/* Variables and functions */
void *get_XwcTextItem_chars(void *_p) {
  return (void *)((XwcTextItem *)_p)->chars;
}


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

x86 assembly (clang, -O2):
<get_XwcTextItem_chars>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i8* @get_XwcTextItem_chars(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_XwcTextItem_chars(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int MatchByteMode(int, int);
int /*<<< orphan*/ memcpy(int *, char *, int);
int RightByteMode(void) {
  int sigl1 = 0x44434241;
  int sigl2;
  memcpy(&sigl2, "ABCD", 4);
  return MatchByteMode(sigl1, sigl2);
}


x86 assembly (clang, -O0):
<RightByteMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x44434241,-0x4(%rbp)
lea    0xeca(%rip),%rsi
lea    -0x8(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <MatchByteMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RightByteMode>:
push   %rax
lea    0xed8(%rip),%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%esi
mov    $0x44434241,%edi
call   1040 <MatchByteMode@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"ABCD\00"
define i32 @RightByteMode() {
%1 = alloca i32
%2 = alloca i32
store i32 1145258561, i32* %1
%3 = call i32 @memcpy(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @MatchByteMode(i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"ABCD\00"
define i32 @RightByteMode() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @memcpy(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = load i32, i32* %1
%5 = call i32 @MatchByteMode(i32 1145258561, i32 %4)
ret i32 %5
}
long long double_to_long_long(double d) {
  union {
    double d;
    long long ll;
  } c;
  c.d = d;
  return c.ll;
}


x86 assembly (clang, -O0):
<double_to_long_long>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_to_long_long>:
movq   %xmm0,%rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define i64 @double_to_long_long(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast %union.anon* %3 to double*
store double %4, double* %5
%6 = bitcast %union.anon* %3 to i64*
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @double_to_long_long(double %0) {
%2 = bitcast double %0 to i64
ret i64 %2
}
void test__tolower_macro(void) {
  int i, j;
  for (i = -127; i < 256;)
    j = i, printf("%s: %d -> %d\n", __FUNCTION__, j, _tolower(i++));
}


x86 assembly (clang, -O0):
<test__tolower_macro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffff81,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1179 <test__tolower_macro+0x59>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <_tolower@plt>
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xe9a(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <test__tolower_macro+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test__tolower_macro>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffff81,%ebx
lea    0xecd(%rip),%r14
lea    0xed4(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <_tolower@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%ebx
cmp    $0x100,%ebp
jne    1140 <test__tolower_macro+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test__tolower_macro = [20 x i8] c"test__tolower_macro\00"
define void @test__tolower_macro() {
%1 = alloca i32
%2 = alloca i32
store i32 -127, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 (i32, ...) bitcast (i32 (...)* @_tolower to i32 (i32, ...)*)(i32 %9)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__FUNCTION__.test__tolower_macro, i64 0, i64 0), i32 %8, i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test__tolower_macro = [20 x i8] c"test__tolower_macro\00"
define void @test__tolower_macro() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ -127, %0 ], [ %3, %1 ]
%3 = add nsw i32 %2, 1
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @_tolower to i32 (i32, ...)*)(i32 %2)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__FUNCTION__.test__tolower_macro, i64 0, i64 0), i32 %2, i32 %4)
%6 = icmp eq i32 %3, 256
br i1 %6, label %7, label %1
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dtoi(float);
int /*<<< orphan*/ g2_set_auto_flush(int /*<<< orphan*/, int /*<<< orphan*/);
void g2_set_auto_flush_(float *dev, float *on_off) {
  g2_set_auto_flush(dtoi(*dev), dtoi(*on_off));
}


x86 assembly (clang, -O0):
<g2_set_auto_flush_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <dtoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <dtoi@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1040 <g2_set_auto_flush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2_set_auto_flush_>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
movss  (%rdi),%xmm0
call   1030 <dtoi@plt>
mov    %eax,%ebp
movss  (%rbx),%xmm0
call   1030 <dtoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <g2_set_auto_flush@plt>

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

LLVM IR (-O2):
define void @g2_set_auto_flush_(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = tail call i32 @dtoi(float %3)
%5 = load float, float* %1
%6 = tail call i32 @dtoi(float %5)
%7 = tail call i32 @g2_set_auto_flush(i32 %4, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strtol(char const *, char **, int);
int /*<<< orphan*/ strtoll(char const *, char **, int);
int /*<<< orphan*/ strtoul(char const *, char **, int);
int /*<<< orphan*/ strtoull(char const *, char **, int);
void uninivar_strtol(void) {
  const char *s;
  char **endp;
  int base;
  (void)strtol(s, endp, base);
  (void)strtoll(s, endp, base);
  (void)strtoul(s, endp, base);
  (void)strtoull(s, endp, base);
}


x86 assembly (clang, -O0):
<uninivar_strtol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <strtol@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <strtoll@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <strtoul@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strtoull@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninivar_strtol>:
push   %rax
call   1050 <strtol@plt>
call   1040 <strtoll@plt>
call   1060 <strtoul@plt>
pop    %rax
jmp    1030 <strtoull@plt>

LLVM IR (-O0):
define void @uninivar_strtol() {
%1 = alloca i8*
%2 = alloca i8**
%3 = alloca i32
%4 = load i8*, i8** %1
%5 = load i8**, i8*** %2
%6 = load i32, i32* %3
%7 = call i32 @strtol(i8* %4, i8** %5, i32 %6)
%8 = load i8*, i8** %1
%9 = load i8**, i8*** %2
%10 = load i32, i32* %3
%11 = call i32 @strtoll(i8* %8, i8** %9, i32 %10)
%12 = load i8*, i8** %1
%13 = load i8**, i8*** %2
%14 = load i32, i32* %3
%15 = call i32 @strtoul(i8* %12, i8** %13, i32 %14)
%16 = load i8*, i8** %1
%17 = load i8**, i8*** %2
%18 = load i32, i32* %3
%19 = call i32 @strtoull(i8* %16, i8** %17, i32 %18)
ret void
}

LLVM IR (-O2):
define void @uninivar_strtol() {
%1 = tail call i32 @strtol(i8* undef, i8** undef, i32 undef)
%2 = tail call i32 @strtoll(i8* undef, i8** undef, i32 undef)
%3 = tail call i32 @strtoul(i8* undef, i8** undef, i32 undef)
%4 = tail call i32 @strtoull(i8* undef, i8** undef, i32 undef)
ret void
}
int test_imm_06uint16_reg(unsigned short val) {
  return ((val) & (-0x06 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_06uint16_reg>:
test   $0xfffa,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_06uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -6
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, int);
void sumProd(int n) {
  int sum = 0;
  int prod = 1;
  for (int i = 1; i <= n; i++) {
    sum = sum + i;
    prod = prod * i;
    foo(sum, prod);
  }
}


x86 assembly (clang, -O0):
<sumProd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1168 <sumProd+0x58>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <foo@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <sumProd+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumProd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1153 <sumProd+0x43>
mov    %edi,%r14d
neg    %r14d
xor    %r15d,%r15d
mov    $0x1,%ebp
mov    $0x1,%ebx
xchg   %ax,%ax
add    %ebp,%r15d
imul   %ebp,%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   1030 <foo@plt>
lea    (%r14,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1130 <sumProd+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @sumProd(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %4
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %11, %4 ], [ 1, %1 ]
%6 = phi i32 [ %9, %4 ], [ 1, %1 ]
%7 = phi i32 [ %8, %4 ], [ 0, %1 ]
%8 = add nuw nsw i32 %5, %7
%9 = mul nuw nsw i32 %5, %6
%10 = tail call i32 @foo(i32 %8, i32 %9)
%11 = add nuw i32 %5, 1
%12 = icmp eq i32 %5, %0
br i1 %12, label %3, label %4
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ BIO_puts(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void message(BIO *out, char *m) {
  fprintf(stderr, "test %s\n", m);
  BIO_puts(out, "print \"test ");
  BIO_puts(out, m);
  BIO_puts(out, "\\n\"\n");
}


x86 assembly (clang, -O0):
<message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <BIO_puts@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <BIO_puts@plt>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <BIO_puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<message>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <BIO_puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <BIO_puts@plt>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <BIO_puts@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"test %s\0A\00"
@.str.1 = [13 x i8] c"print \22test \00"
@.str.2 = [5 x i8] c"\\n\22\0A\00"
define void @message(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32*, i32** %3
%9 = call i32 @BIO_puts(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32*, i32** %3
%11 = load i8*, i8** %4
%12 = call i32 @BIO_puts(i32* %10, i8* %11)
%13 = load i32*, i32** %3
%14 = call i32 @BIO_puts(i32* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"test %s\0A\00"
@.str.1 = [13 x i8] c"print \22test \00"
@.str.2 = [5 x i8] c"\\n\22\0A\00"
define void @message(i32* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = tail call i32 @BIO_puts(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @BIO_puts(i32* %0, i8* %1)
%7 = tail call i32 @BIO_puts(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void isr_ac_bus_tx_process_post(struct voip_dsp_s *this) {}


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

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

LLVM IR (-O0):
%struct.voip_dsp_s = type opaque
define void @isr_ac_bus_tx_process_post(%struct.voip_dsp_s* %0) {
%2 = alloca %struct.voip_dsp_s*
store %struct.voip_dsp_s* %0, %struct.voip_dsp_s** %2
ret void
}

LLVM IR (-O2):
%struct.voip_dsp_s = type opaque
define void @isr_ac_bus_tx_process_post(%struct.voip_dsp_s* nocapture %0) {
ret void
}
int moins(int *a, int b) {
  return (*a = (((*a) > (b)) ? ((*a) - (b)) : ((b) - (*a))));
}


x86 assembly (clang, -O0):
<moins>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jle    112b <moins+0x2b>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <moins+0x37>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<moins>:
mov    (%rdi),%eax
mov    %eax,%ecx
sub    %esi,%ecx
neg    %ecx
sub    %esi,%eax
cmovle %ecx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @moins(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* %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = load i32, i32* %4
%13 = sub nsw i32 %11, %12
br label %19
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i32*, i32** %3
%17 = load i32, i32* %16
%18 = sub nsw i32 %15, %17
br label %19
19: ; preds = %14, %9
%20 = phi i32 [ %13, %9 ], [ %18, %14 ]
%21 = load i32*, i32** %3
store i32 %20, i32* %21
ret i32 %20
}

LLVM IR (-O2):
define i32 @moins(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = icmp sgt i32 %3, %1
%5 = sub nsw i32 %3, %1
%6 = sub nsw i32 %1, %3
%7 = select i1 %4, i32 %5, i32 %6
store i32 %7, i32* %0
ret i32 %7
}
double MidVal(double x1, double x2, double bisect) {
  double val;
  val = ((x2 - x1) * bisect) + x1;
  return (val);
}


x86 assembly (clang, -O0):
<MidVal>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MidVal>:
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @MidVal(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = load double, double* %6
%12 = load double, double* %4
%13 = call double @llvm.fmuladd.f64(double %10, double %11, double %12)
store double %13, double* %7
%14 = load double, double* %7
ret double %14
}

LLVM IR (-O2):
define double @MidVal(double %0, double %1, double %2) {
%4 = fsub double %1, %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %0)
ret double %5
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int getHeightIfBalanced(struct TreeNode *);
bool isBalanced(struct TreeNode *root) {
  if (getHeightIfBalanced(root) == -100) {
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<isBalanced>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getHeightIfBalanced@plt>
cmp    $0xffffff9c,%eax
jne    113a <isBalanced+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1141 <isBalanced+0x31>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBalanced>:
push   %rax
call   1030 <getHeightIfBalanced@plt>
xor    %ecx,%ecx
cmp    $0xffffff9c,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define i32 @isBalanced(%struct.TreeNode* %0) {
%2 = alloca i32
%3 = alloca %struct.TreeNode*
store %struct.TreeNode* %0, %struct.TreeNode** %3
%4 = load %struct.TreeNode*, %struct.TreeNode** %3
%5 = call i32 @getHeightIfBalanced(%struct.TreeNode* %4)
%6 = icmp eq i32 %5, -100
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 1, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @isBalanced(%struct.TreeNode* %0) {
%2 = tail call i32 @getHeightIfBalanced(%struct.TreeNode* %0)
%3 = icmp ne i32 %2, -100
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello World\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void pcp_print_swap_stats(struct activity *a, int curr) {}


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

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

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

LLVM IR (-O2):
%struct.activity = type opaque
define void @pcp_print_swap_stats(%struct.activity* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *progname) {
  fprintf(stderr, "Usage: %s <port>\n", progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
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):
<usage>:
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 = [18 x i8] c"Usage: %s <port>\0A\00"
define void @usage(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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <port>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_E7uint8_mem(unsigned char *val) {
  return ((*val) & (-0xE7 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E7uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 25
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalpha(int);
void t_isalpha_0x4d() {
  Assert_real((isalpha(77)),
              "/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_isalpha.c",
              390, ("isalpha should be 1 for M"));
}


x86 assembly (clang, -O0):
<t_isalpha_0x4d>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4d,%edi
call   1030 <isalpha@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x186,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0x4d>:
push   %rax
mov    $0x4d,%edi
call   1030 <isalpha@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x186,%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_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for M\00"
define void @t_isalpha_0x4d() {
%1 = call i32 @isalpha(i32 77)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 390, i8* getelementptr inbounds ([26 x i8], [26 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_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for M\00"
define void @t_isalpha_0x4d() {
%1 = tail call i32 @isalpha(i32 77)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 390, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned long hash(const char *s) {
  const unsigned char *str = (const unsigned char *)s;
  unsigned long hash = 5381;
  int c = 0;
  while ((c = *str++)) {
    hash = ((hash << 5) + hash) + c;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x1505,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     1159 <hash+0x59>
mov    -0x18(%rbp),%rax
shl    $0x5,%rax
add    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    111f <hash+0x1f>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <hash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = mul i64 %6, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
void touch_simple(char *addr) {
  if (*addr != 0xf) {
    ;
    *addr = 0xf;
  } else {
    ;
    *addr = 0x00;
  }
}


x86 assembly (clang, -O0):
<touch_simple>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xf,%eax
je     1124 <touch_simple+0x24>
mov    -0x8(%rbp),%rax
movb   $0xf,(%rax)
jmp    112b <touch_simple+0x2b>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_simple>:
xor    %eax,%eax
cmpb   $0xf,(%rdi)
mov    $0xf,%ecx
cmove  %eax,%ecx
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @touch_simple(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 15
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8*, i8** %2
store i8 15, i8* %8
br label %11
9: ; preds = %1
%10 = load i8*, i8** %2
store i8 0, i8* %10
br label %11
11: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
define void @touch_simple(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 15
%4 = select i1 %3, i8 0, i8 15
store i8 %4, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int sayi;
  int sonuc;
  printf("sayi giriniz: ");
  scanf("%d", &sayi);
  sonuc = sayi % 5;
  printf("sonuc = %d", sonuc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"sayi giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"sonuc = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = srem i32 %6, 5
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"sayi giriniz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"sonuc = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = srem i32 %5, 5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
unsigned int discreet_log2(unsigned int val) {
  unsigned int log = 0;
  while (val >>= 1)
    log++;
  return log;
}


x86 assembly (clang, -O0):
<discreet_log2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     112e <discreet_log2+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <discreet_log2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<discreet_log2>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     111c <discreet_log2+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <discreet_log2+0x10>
ret

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

LLVM IR (-O2):
define i32 @discreet_log2(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 4
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
float LerpAngleFromCurrent(float from, float to, float current, float frac) {
  float a;
  if (to - current > 180) {
    to -= 360;
  }
  if (to - current < -180) {
    to += 360;
  }
  a = from + frac * (to - from);
  return a;
}


x86 assembly (clang, -O0):
<LerpAngleFromCurrent>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  0xed6(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1149 <LerpAngleFromCurrent+0x49>
movss  -0x8(%rbp),%xmm0
movss  0xec4(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
movss  0xead(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1176 <LerpAngleFromCurrent+0x76>
movss  0xe98(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<LerpAngleFromCurrent>:
movaps %xmm1,%xmm4
subss  %xmm2,%xmm4
movss  0xef1(%rip),%xmm5
addss  %xmm1,%xmm5
movss  0xee9(%rip),%xmm6
cmpltss %xmm4,%xmm6
andps  %xmm6,%xmm5
andnps %xmm1,%xmm6
orps   %xmm5,%xmm6
movaps %xmm6,%xmm1
subss  %xmm2,%xmm1
movaps %xmm6,%xmm2
addss  0xecd(%rip),%xmm2
cmpltss 0xec8(%rip),%xmm1
andps  %xmm1,%xmm2
andnps %xmm6,%xmm1
orps   %xmm2,%xmm1
subss  %xmm0,%xmm1
mulss  %xmm3,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @LerpAngleFromCurrent(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%10 = load float, float* %6
%11 = load float, float* %7
%12 = fsub float %10, %11
%13 = fcmp ogt float %12, 1.800000e+02
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = load float, float* %6
%16 = fsub float %15, 3.600000e+02
store float %16, float* %6
br label %17
17: ; preds = %14, %4
%18 = load float, float* %6
%19 = load float, float* %7
%20 = fsub float %18, %19
%21 = fcmp olt float %20, -1.800000e+02
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load float, float* %6
%24 = fadd float %23, 3.600000e+02
store float %24, float* %6
br label %25
25: ; preds = %22, %17
%26 = load float, float* %5
%27 = load float, float* %8
%28 = load float, float* %6
%29 = load float, float* %5
%30 = fsub float %28, %29
%31 = call float @llvm.fmuladd.f32(float %27, float %30, float %26)
store float %31, float* %9
%32 = load float, float* %9
ret float %32
}

LLVM IR (-O2):
define float @LerpAngleFromCurrent(float %0, float %1, float %2, float %3) {
%5 = fsub float %1, %2
%6 = fcmp ogt float %5, 1.800000e+02
%7 = fadd float %1, -3.600000e+02
%8 = select i1 %6, float %7, float %1
%9 = fsub float %8, %2
%10 = fcmp olt float %9, -1.800000e+02
%11 = fadd float %8, 3.600000e+02
%12 = select i1 %10, float %11, float %8
%13 = fsub float %12, %0
%14 = tail call float @llvm.fmuladd.f32(float %3, float %13, float %0)
ret float %14
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_readlinkat;
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int, char const *, char *,
                           size_t);
__attribute__((always_)) ssize_t
_syscall_readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) {
  return syscall(__NR_readlinkat, dirfd, pathname, buf, bufsiz);
}


x86 assembly (clang, -O0):
<_syscall_readlinkat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_syscall_readlinkat>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_readlinkat = global i32 0
define i32 @_syscall_readlinkat(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i32, i32* @__NR_readlinkat
%10 = load i32, i32* %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i64, i64* %8
%14 = call i32 @syscall(i32 %9, i32 %10, i8* %11, i8* %12, i64 %13)
ret i32 %14
}

LLVM IR (-O2):
@__NR_readlinkat = global i32 0
define i32 @_syscall_readlinkat(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = load i32, i32* @__NR_readlinkat
%6 = tail call i32 @syscall(i32 %5, i32 %0, i8* %1, i8* %2, i64 %3)
ret i32 %6
}