xunge/DecIR huggingface dataset:
int StopDeviceDiscoveryService() {}


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

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

LLVM IR (-O0):
define i32 @StopDeviceDiscoveryService() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @StopDeviceDiscoveryService() {
ret i32 undef
}
/* Variables and functions */
int SPI_In();
int /*<<< orphan*/ SPI_Out(int);
int readcode(int addr) {
  SPI_Out(0x01 | ((addr >> 5) & 0xF8) | ((addr >> 11) & 0x04));
  SPI_Out(addr & 0xFF);
  return SPI_In();
}


x86 assembly (clang, -O0):
<readcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x5,%edi
and    $0xf8,%edi
or     $0x1,%edi
mov    -0x4(%rbp),%eax
sar    $0xb,%eax
and    $0x4,%eax
or     %eax,%edi
call   1040 <SPI_Out@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1040 <SPI_Out@plt>
mov    $0x0,%al
call   1030 <SPI_In@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readcode>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
shr    $0x5,%eax
and    $0xf8,%eax
mov    %edi,%ecx
shr    $0xb,%ecx
and    $0x4,%ecx
lea    (%rcx,%rax,1),%edi
add    $0x1,%edi
call   1040 <SPI_Out@plt>
movzbl %bl,%edi
call   1040 <SPI_Out@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <SPI_In@plt>

LLVM IR (-O0):
define i32 @readcode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 5
%5 = and i32 %4, 248
%6 = or i32 1, %5
%7 = load i32, i32* %2
%8 = ashr i32 %7, 11
%9 = and i32 %8, 4
%10 = or i32 %6, %9
%11 = call i32 @SPI_Out(i32 %10)
%12 = load i32, i32* %2
%13 = and i32 %12, 255
%14 = call i32 @SPI_Out(i32 %13)
%15 = call i32 (...) @SPI_In()
ret i32 %15
}

LLVM IR (-O2):
define i32 @readcode(i32 %0) {
%2 = lshr i32 %0, 5
%3 = and i32 %2, 248
%4 = lshr i32 %0, 11
%5 = and i32 %4, 4
%6 = or i32 %5, %3
%7 = or i32 %6, 1
%8 = tail call i32 @SPI_Out(i32 %7)
%9 = and i32 %0, 255
%10 = tail call i32 @SPI_Out(i32 %9)
%11 = tail call i32 (...) @SPI_In()
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ do_test(unsigned long long *);
int main() {
  unsigned long long r = 0x8000000000000001ull;
  do_test(&r);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x8000000000000001,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <do_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 -9223372036854775807, i64* %2
%3 = call i32 @do_test(i64* %2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 -9223372036854775807, i64* %1
%3 = call i32 @do_test(i64* %1)
ret i32 0
}
/* Variables and functions */
double mode_hclock(int /*<<< orphan*/);
int /*<<< orphan*/ video_current_mode();
double video_hclock(void) { return mode_hclock(video_current_mode()); }


x86 assembly (clang, -O0):
<video_hclock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <video_current_mode@plt>
mov    %eax,%edi
call   1030 <mode_hclock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<video_hclock>:
push   %rax
xor    %eax,%eax
call   1040 <video_current_mode@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <mode_hclock@plt>

LLVM IR (-O0):
define double @video_hclock() {
%1 = call i32 (...) @video_current_mode()
%2 = call double @mode_hclock(i32 %1)
ret double %2
}

LLVM IR (-O2):
define double @video_hclock() {
%1 = tail call i32 (...) @video_current_mode()
%2 = tail call double @mode_hclock(i32 %1)
ret double %2
}
unsigned test1(unsigned x) { return x & 0x00FF00FF; }


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
mov    %edi,%eax
and    $0xff00ff,%eax
ret

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

LLVM IR (-O2):
define i32 @test1(i32 %0) {
%2 = and i32 %0, 16711935
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ parseInput();
void main() { parseInput(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @parseInput()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
foo() { printf("signal received\n"); }


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

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

LLVM IR (-O2):
@str = [16 x i8] c"signal received\00"
define i32 @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
scalar_t__ stdin;
void *c_stdin(void) { return (void *)stdin; }


x86 assembly (clang, -O0):
<c_stdin>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_stdin>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
@stdin = global i64 0
define i8* @c_stdin() {
%1 = load i64, i64* @stdin
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}

LLVM IR (-O2):
@stdin = global i64 0
define i8* @c_stdin() {
%1 = load i64, i64* @stdin
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}
void put_a(a, N) int *a;
const int N;
{
  for (int i = 0; i < N; i++) {
    printf("a[%d] = %d \n", i, a[i]);
  }
}


x86 assembly (clang, -O0):
<put_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115c <put_a+0x4c>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <put_a+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_a>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1149 <put_a+0x39>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xed7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <put_a+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"a[%d] = %d \0A\00"
define void @put_a(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 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"a[%d] = %d \0A\00"
define void @put_a(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %13, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = trunc i64 %8 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %10)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int open_write(char const *);
int writesync(int, void const *, long long);
int savesync(const char *fn, const void *x, long long xlen) {
  int fd;
  int r;
  fd = open_write(fn);
  if (fd == -1)
    return -1;
  r = writesync(fd, x, xlen);
  close(fd);
  return r;
}


x86 assembly (clang, -O0):
<savesync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <open_write@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1166 <savesync+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <savesync+0x57>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <writesync@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <close@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<savesync>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
call   1050 <open_write@plt>
cmp    $0xffffffff,%eax
je     1160 <savesync+0x30>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <writesync@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <close@plt>
mov    %ebx,%eax
jmp    1165 <savesync+0x35>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @savesync(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @open_write(i8* %0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @writesync(i32 %4, i8* %1, i64 %2)
%8 = tail call i32 @close(i32 %4)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ %7, %6 ], [ -1, %3 ]
ret i32 %10
}
/* Variables and functions */
scalar_t__ LOCK_SH;
int main() { return !(LOCK_SH != 0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0x2ed6(%rip),%rax
cmpq   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
sete   %al
ret

LLVM IR (-O0):
@LOCK_SH = global i64 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i64, i64* @LOCK_SH
%3 = icmp ne i64 %2, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
@LOCK_SH = global i64 0
define i32 @main() {
%1 = load i64, i64* @LOCK_SH
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
int main(void) {
  bar(10);
foo:
  bar(-9);
  bar(9);
baz:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <bar@plt>
mov    $0xfffffff7,%edi
call   1030 <bar@plt>
mov    $0x9,%edi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <bar@plt>
mov    $0xfffffff7,%edi
call   1030 <bar@plt>
mov    $0x9,%edi
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @bar(i32 10)
br label %3
3: ; preds = %0
%4 = call i32 @bar(i32 -9)
%5 = call i32 @bar(i32 9)
br label %6
6: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @bar(i32 10)
%2 = tail call i32 @bar(i32 -9)
%3 = tail call i32 @bar(i32 9)
ret i32 0
}
/* Variables and functions */
scalar_t__ ceil(double);
scalar_t__ floor(double);
scalar_t__ pow(int, int);
double sqrt(scalar_t__);
int get_hypotenuse(int a, int b) {
  double hyp = sqrt(pow(a, 2) + pow(b, 2));
  if (ceil(hyp) == floor(hyp))
    return (int)hyp;
  else
    return 0;
}


x86 assembly (clang, -O0):
<get_hypotenuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <floor@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    11b2 <get_hypotenuse+0x72>
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b9 <get_hypotenuse+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hypotenuse>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1050 <sqrt@plt>
movsd  %xmm0,(%rsp)
call   1030 <ceil@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
call   1060 <floor@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
cvttsd2si (%rsp),%eax
cmovne %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_hypotenuse(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = call i64 @pow(i32 %7, i32 2)
%9 = load i32, i32* %5
%10 = call i64 @pow(i32 %9, i32 2)
%11 = add nsw i64 %8, %10
%12 = call double @sqrt(i64 %11)
store double %12, double* %6
%13 = load double, double* %6
%14 = call i64 @ceil(double %13)
%15 = load double, double* %6
%16 = call i64 @floor(double %15)
%17 = icmp eq i64 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load double, double* %6
%20 = fptosi double %19 to i32
store i32 %20, i32* %3
br label %22
21: ; preds = %2
store i32 0, i32* %3
br label %22
22: ; preds = %21, %18
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @get_hypotenuse(i32 %0, i32 %1) {
%3 = tail call i64 @pow(i32 %0, i32 2)
%4 = tail call i64 @pow(i32 %1, i32 2)
%5 = add nsw i64 %4, %3
%6 = tail call double @sqrt(i64 %5)
%7 = tail call i64 @ceil(double %6)
%8 = tail call i64 @floor(double %6)
%9 = icmp eq i64 %7, %8
%10 = fptosi double %6 to i32
%11 = select i1 %9, i32 %10, i32 0
ret i32 %11
}
/* Variables and functions */
int sysapi_get_rand();
int sysapi_get_rand_range(int range) {
  int ret;
  ret = sysapi_get_rand();
  if (ret != -1) {
    if (ret < 0)
      ret *= -1;
    return ret % range;
  }
  return ret;
}


x86 assembly (clang, -O0):
<sysapi_get_rand_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <sysapi_get_rand@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     114f <sysapi_get_rand_range+0x3f>
cmpl   $0x0,-0xc(%rbp)
jge    1140 <sysapi_get_rand_range+0x30>
imul   $0xffffffff,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x4(%rbp)
jmp    1155 <sysapi_get_rand_range+0x45>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysapi_get_rand_range>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <sysapi_get_rand@plt>
cmp    $0xffffffff,%eax
je     112f <sysapi_get_rand_range+0x1f>
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    %ecx,%eax
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sysapi_get_rand_range(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 (...) @sysapi_get_rand()
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %18
8: ; preds = %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, -1
store i32 %13, i32* %4
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = srem i32 %15, %16
store i32 %17, i32* %2
br label %20
18: ; preds = %1
%19 = load i32, i32* %4
store i32 %19, i32* %2
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @sysapi_get_rand_range(i32 %0) {
%2 = tail call i32 (...) @sysapi_get_rand()
%3 = icmp eq i32 %2, -1
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @llvm.abs.i32(i32 %2, i1 true)
%6 = srem i32 %5, %0
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ -1, %1 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void apply_filter(void *arg, const uint64_t ts, const int w, const int h,
                  const uint8_t *const prev_frame,
                  const uint8_t *const current_frame, uint8_t *const result) {}


x86 assembly (clang, -O0):
<apply_filter>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @apply_filter(i8* %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
ret void
}

LLVM IR (-O2):
define void @apply_filter(i8* nocapture %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture %5, i32* nocapture %6) {
ret void
}
void RTNetIPv4IsUDPSizeValid(void) {}


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

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

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

LLVM IR (-O2):
define void @RTNetIPv4IsUDPSizeValid() {
ret void
}
void foo186(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo186(i32 %0) {
ret void
}
int test_imm_17uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x17 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_17uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 23
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_58() {
  Assert_real((isqrt(58) == 7),
              "/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/stdlib/isqrt.c",
              295, ("Integer square root of 58 should be 7"));
}


x86 assembly (clang, -O0):
<t_sqrt_58>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3a,%edi
call   1030 <isqrt@plt>
cmp    $0x7,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x127,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_58>:
push   %rax
mov    $0x3a,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x7,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x127,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 58 should be 7\00"
define void @t_sqrt_58() {
%1 = call i32 @isqrt(i32 58)
%2 = icmp eq i32 %1, 7
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 295, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 58 should be 7\00"
define void @t_sqrt_58() {
%1 = tail call i32 @isqrt(i32 58)
%2 = icmp eq i32 %1, 7
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 295, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int add2(int *a, int *b) { return (*a) + (*b); }


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

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

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

LLVM IR (-O2):
define i32 @add2(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
ret i32 %5
}
void ARGBSobelToPlane() {}


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

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

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

LLVM IR (-O2):
define void @ARGBSobelToPlane() {
ret void
}
int MADstrcmp(const char *dst, const char *src) {
  long i = 0;
  do {
    if (dst[i] != src[i])
      return -1;
  } while (src[i++]);
  return 0;
}


x86 assembly (clang, -O0):
<MADstrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1140 <MADstrcmp+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <MADstrcmp+0x69>
jmp    1145 <MADstrcmp+0x45>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
cmpb   $0x0,(%rax,%rcx,1)
jne    1114 <MADstrcmp+0x14>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MADstrcmp>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
cmp    (%rsi,%rax,1),%cl
jne    1124 <MADstrcmp+0x24>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <MADstrcmp+0x10>
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @MADstrcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %10, %2
%4 = phi i64 [ 0, %2 ], [ %11, %10 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %1, i64 %4
%8 = load i8, i8* %7
%9 = icmp eq i8 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = add nuw nsw i64 %4, 1
%12 = icmp eq i8 %6, 0
br i1 %12, label %13, label %3
13: ; preds = %10, %3
%14 = phi i32 [ -1, %3 ], [ 0, %10 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void LIBCFS_FREE(void *ptr, size_t s) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @LIBCFS_FREE(i8* nocapture %0, i64 %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void err_abort(char *str) {
  fprintf(stderr, " TCP Echo-Server: %s\n", str);
  fflush(stdout);
  fflush(stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<err_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<err_abort>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ea5(%rip),%rbx
mov    (%rbx),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c" TCP Echo-Server: %s\0A\00"
@stdout = global i32 0
define void @err_abort(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 ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fflush(i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c" TCP Echo-Server: %s\0A\00"
@stdout = global i32 0
define void @err_abort(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fflush(i32 %6)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ SA1Direct(int);
int /*<<< orphan*/ STX8(int /*<<< orphan*/);
void Op86X1(void) { STX8(SA1Direct(2)); }


x86 assembly (clang, -O0):
<Op86X1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <SA1Direct@plt>
mov    %eax,%edi
call   1040 <STX8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op86X1>:
push   %rax
mov    $0x2,%edi
call   1030 <SA1Direct@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <STX8@plt>

LLVM IR (-O0):
define void @Op86X1() {
%1 = call i32 @SA1Direct(i32 2)
%2 = call i32 @STX8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op86X1() {
%1 = tail call i32 @SA1Direct(i32 2)
%2 = tail call i32 @STX8(i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ n;

/* Variables and functions */
int /*<<< orphan*/ err(int, char *);
int ntohl(int);
scalar_t__ read(int, int *, int);
int _child_getint(int fd) {
  int n;
  if (read(fd, &n, sizeof(n)) < 0)
    err(1, "read");
  return ntohl(n);
}


x86 assembly (clang, -O0):
<_child_getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
cmp    $0x0,%rax
jge    1167 <_child_getint+0x37>
mov    $0x1,%edi
lea    0xe9e(%rip),%rsi
call   1040 <err@plt>
mov    -0x8(%rbp),%edi
call   1050 <ntohl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_child_getint>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
test   %rax,%rax
jns    1156 <_child_getint+0x26>
lea    0xeb4(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
mov    0x4(%rsp),%edi
pop    %rax
jmp    1050 <ntohl@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"read\00"
define i32 @_child_getint(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @read(i32 %0, i32* %2, i32 4)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = tail call i32 @ntohl(i32 %9)
ret i32 %10
}
void rop3_97_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = *D & S;
  stk3 = T | stk4;
  stk2 = S ^ stk3;
  stk1 = *D ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


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

x86 assembly (clang, -O2):
<rop3_97_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %sil,%cl
or     %cl,%dl
xor    %sil,%al
xor    %dl,%al
or     %sil,%al
not    %al
or     %cl,%al
mov    %al,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_97_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
%6 = or i8 %5, %2
%7 = xor i8 %4, %1
%8 = xor i8 %7, %6
%9 = or i8 %8, %1
%10 = xor i8 %9, -1
%11 = or i8 %5, %10
store i8 %11, i8* %0
ret void
}
/* Variables and functions */
void *malloc_or_die(char *, size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *zalloc_or_die(char *id, size_t size) {
  void *p;
  if (size == 0)
    size = 1;
  p = malloc_or_die(id, size);
  memset(p, 0, size);
  return p;
}


x86 assembly (clang, -O0):
<zalloc_or_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <zalloc_or_die+0x23>
movq   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <malloc_or_die@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zalloc_or_die>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
mov    $0x1,%ebx
cmovne %rsi,%rbx
mov    %rbx,%rsi
call   1040 <malloc_or_die@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @zalloc_or_die(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
%4 = select i1 %3, i64 1, i64 %1
%5 = tail call i8* @malloc_or_die(i8* %0, i64 %4)
%6 = tail call i32 @memset(i8* %5, i32 0, i64 %4)
ret i8* %5
}
void rec(int x) {
  char v;
  if (x) {
    v = 'a';
    rec(0);
  } else
    v = 'b';
}


x86 assembly (clang, -O0):
<rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1135 <rec+0x25>
movb   $0x61,-0x5(%rbp)
xor    %edi,%edi
call   1030 <rec@plt>
jmp    1139 <rec+0x29>
movb   $0x62,-0x5(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rec(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8 97, i8* %3
br label %8
7: ; preds = %1
store i8 98, i8* %3
br label %8
8: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
define void @rec(i32 %0) {
ret void
}
/* Variables and functions */
double solve(double (*)(double), double, int /*<<< orphan*/);
double solve_default(double (*fn)(double)) { return solve(fn, 0.5, 0); }


x86 assembly (clang, -O0):
<solve_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
movsd  0xed8(%rip),%xmm0
xor    %esi,%esi
call   1030 <solve@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_default>:
movsd  0xee8(%rip),%xmm0
xor    %esi,%esi
jmp    1030 <solve@plt>

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

LLVM IR (-O2):
define double @solve_default(double (double)* %0) {
%2 = tail call double @solve(double (double)* %0, double 5.000000e-01, i32 0)
ret double %2
}
void swap(char *s, int lh, int rh) {
  char tmp;
  tmp = s[lh];
  s[lh] = s[rh];
  s[rh] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%sil
movslq %edx,%rdx
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rax,1)
mov    %sil,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define void @swap(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8, i8* %7
%23 = load i8*, i8** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
ret void
}

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Variables and functions */
int *some_func();
void test2() {
  int *ptr;
  ptr = some_func();
}


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

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

LLVM IR (-O0):
define void @test2() {
%1 = alloca i32*
%2 = call i32* (...) @some_func()
store i32* %2, i32** %1
ret void
}

LLVM IR (-O2):
define void @test2() {
%1 = tail call i32* (...) @some_func()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atof(char *);
void nullPointer_atof(void) {
  char *c = 0;
  (void)atof(c);
  (void)atof(0);
}


x86 assembly (clang, -O0):
<nullPointer_atof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atof@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <atof@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nullPointer_atof() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @atof(i8* %2)
%4 = call i32 @atof(i8* null)
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ __builtin_popcountll(unsigned long long);
uint64_t chpl_bitops_popcount_64(unsigned long long x) {
  return __builtin_popcountll(x);
}


x86 assembly (clang, -O0):
<chpl_bitops_popcount_64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    %rcx,%rax
shr    %rax
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rax
sub    %rax,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
mov    %rcx,%rax
and    %rdx,%rax
shr    $0x2,%rcx
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rcx,%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
movabs $0x101010101010101,%rcx
01 01 01
imul   %rcx,%rax
shr    $0x38,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chpl_bitops_popcount_64>:
mov    %rdi,%rax
shr    %rax
movabs $0x5555555555555555,%rcx
55 55 55
and    %rax,%rcx
sub    %rcx,%rdi
movabs $0x3333333333333333,%rax
33 33 33
mov    %rdi,%rcx
and    %rax,%rcx
shr    $0x2,%rdi
and    %rdi,%rax
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rax,%rcx
movabs $0xf0f0f0f0f0f0f0f,%rdx
0f 0f 0f
and    %rcx,%rdx
movabs $0x101010101010101,%rax
01 01 01
imul   %rdx,%rax
shr    $0x38,%rax
ret

LLVM IR (-O0):
define i32 @chpl_bitops_popcount_64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @llvm.ctpop.i64(i64 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @chpl_bitops_popcount_64(i64 %0) {
%2 = tail call i64 @llvm.ctpop.i64(i64 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void Float32_To_UInt8_Clip(
    void *destinationBuffer, signed int destinationStride, void *sourceBuffer,
    signed int sourceStride, unsigned int count,
    struct PaUtilTriangularDitherGenerator *ditherGenerator) {
  float *src = (float *)sourceBuffer;
  unsigned char *dest = (unsigned char *)destinationBuffer;
  (void)ditherGenerator;
  while (count--) {
    src += sourceStride;
    dest += destinationStride;
  }
}


x86 assembly (clang, -O0):
<Float32_To_UInt8_Clip>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x20(%rbp)
cmp    $0x0,%eax
je     1169 <Float32_To_UInt8_Clip+0x69>
mov    -0x1c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
jmp    112a <Float32_To_UInt8_Clip+0x2a>
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.PaUtilTriangularDitherGenerator = type opaque
define void @Float32_To_UInt8_Clip(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, %struct.PaUtilTriangularDitherGenerator* %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.PaUtilTriangularDitherGenerator*
%13 = alloca float*
%14 = alloca i8*
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store %struct.PaUtilTriangularDitherGenerator* %5, %struct.PaUtilTriangularDitherGenerator** %12
%15 = load i8*, i8** %9
%16 = bitcast i8* %15 to float*
store float* %16, float** %13
%17 = load i8*, i8** %7
store i8* %17, i8** %14
%18 = load %struct.PaUtilTriangularDitherGenerator*, %struct.PaUtilTriangularDitherGenerator** %12
br label %19
19: ; preds = %23, %6
%20 = load i32, i32* %11
%21 = add i32 %20, -1
store i32 %21, i32* %11
%22 = icmp ne i32 %20, 0
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = load i32, i32* %10
%25 = load float*, float** %13
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds float, float* %25, i64 %26
store float* %27, float** %13
%28 = load i32, i32* %8
%29 = load i8*, i8** %14
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %29, i64 %30
store i8* %31, i8** %14
br label %19
32: ; preds = %19
ret void
}

LLVM IR (-O2):
%struct.PaUtilTriangularDitherGenerator = type opaque
define void @Float32_To_UInt8_Clip(i8* nocapture %0, i32 %1, i8* nocapture %2, i32 %3, i32 %4, %struct.PaUtilTriangularDitherGenerator* nocapture %5) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ *config_resolve_character_set(char *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/ *);
int config_resolve_character_set_wrapper(char **av) {
  char *value = av[2];
  wchar_t *output = config_resolve_character_set(value);
  printf("%ls\n", output);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<config_resolve_character_set_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <config_resolve_character_set@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_resolve_character_set_wrapper>:
push   %rax
mov    0x10(%rdi),%rdi
call   1040 <config_resolve_character_set@plt>
lea    0xecf(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ls\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @config_resolve_character_set_wrapper(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i32*
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = getelementptr inbounds i8*, i8** %5, i64 2
%7 = load i8*, i8** %6
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32* @config_resolve_character_set(i8* %8)
store i32* %9, i32** %4
%10 = load i32*, i32** %4
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ls\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @config_resolve_character_set_wrapper(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 2
%3 = load i8*, i8** %2
%4 = tail call i32* @config_resolve_character_set(i8* %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %4)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
int _default_auth_default_login_delay() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_default_auth_default_login_delay() {
ret i32 0
}