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

/* Variables and functions */
int EACCES;
int errno;
int /*<<< orphan*/ swap_path(char *, int);
scalar_t__ swapoff(char *);
int swap_switch_off(void) {
  char path[256];
  if (!swap_path(path, sizeof(path)))
    return EACCES;
  return (swapoff(path) ? errno : 0);
}


x86 assembly (clang, -O0):
<swap_switch_off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1030 <swap_path@plt>
cmp    $0x0,%eax
jne    1156 <swap_switch_off+0x36>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <swap_switch_off+0x76>
lea    -0x110(%rbp),%rdi
call   1040 <swapoff@plt>
cmp    $0x0,%rax
je     1180 <swap_switch_off+0x60>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x114(%rbp)
jmp    118d <swap_switch_off+0x6d>
xor    %eax,%eax
mov    %eax,-0x114(%rbp)
jmp    118d <swap_switch_off+0x6d>
mov    -0x114(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_switch_off>:
sub    $0x108,%rsp
mov    %rsp,%rdi
mov    $0x100,%esi
call   1030 <swap_path@plt>
test   %eax,%eax
je     1153 <swap_switch_off+0x33>
mov    %rsp,%rdi
call   1040 <swapoff@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     115c <swap_switch_off+0x3c>
mov    0x2e87(%rip),%rax
jmp    115a <swap_switch_off+0x3a>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
@EACCES = global i32 0
@errno = global i32 0
define i32 @swap_switch_off() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @swap_path(i8* %3, i32 256)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = load i32, i32* @EACCES
store i32 %7, i32* %1
br label %17
8: ; preds = %0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%10 = call i64 @swapoff(i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = load i32, i32* @errno
br label %15
14: ; preds = %8
br label %15
15: ; preds = %14, %12
%16 = phi i32 [ %13, %12 ], [ 0, %14 ]
store i32 %16, i32* %1
br label %17
17: ; preds = %15, %6
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@EACCES = global i32 0
@errno = global i32 0
define i32 @swap_switch_off() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @swap_path(i8* %2, i32 256)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i32, i32* @EACCES
br label %12
7: ; preds = %0
%8 = call i64 @swapoff(i8* %2)
%9 = icmp eq i64 %8, 0
%10 = load i32, i32* @errno
%11 = select i1 %9, i32 0, i32 %10
br label %12
12: ; preds = %7, %5
%13 = phi i32 [ %11, %7 ], [ %6, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ *strstr(char *, char *);
int AT_EXP_OK(const unsigned char *RESP) {
  if (RESP == NULL)
    return (0);
  if (strstr((char *)RESP, "OK") != NULL) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<AT_EXP_OK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <AT_EXP_OK+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1160 <AT_EXP_OK+0x50>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1159 <AT_EXP_OK+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1160 <AT_EXP_OK+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT_EXP_OK>:
test   %rdi,%rdi
je     1132 <AT_EXP_OK+0x22>
push   %rax
lea    0xee3(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"OK\00"
define i32 @AT_EXP_OK(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32* @strstr(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
define i32 @AT_EXP_OK(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32* @strstr(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ RTint_Init();
void _M2_RTint_init(__attribute__((unused)) int argc,
                    __attribute__((unused)) char *argv[]) {
  RTint_Init();
}


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

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

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

LLVM IR (-O2):
define void @_M2_RTint_init(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @RTint_Init()
ret void
}
int dos_release(struct dosparam *params) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.dosparam = type opaque
define i32 @dos_release(%struct.dosparam* nocapture readnone %0) {
ret i32 0
}
void do_some_work() {
  int i;
  for (i = 0; i < 0x2000; i++)
    i = i * 10.0 / 5 / 2;
}


x86 assembly (clang, -O0):
<do_some_work>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x2000,-0x4(%rbp)
jge    1156 <do_some_work+0x56>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeeb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <do_some_work+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @do_some_work() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 8192
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 1.000000e+01
%9 = fdiv double %8, 5.000000e+00
%10 = fdiv double %9, 2.000000e+00
%11 = fptosi double %10 to i32
store i32 %11, i32* %1
br label %12
12: ; preds = %5
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %2
15: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @do_some_work() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
void gen_unsigned_greater_or_equal(void) {
  gen_pop();
  gen_call("_uge");
}


x86 assembly (clang, -O0):
<gen_unsigned_greater_or_equal>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xece(%rip),%rdi
call   1040 <gen_call@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_unsigned_greater_or_equal>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"_uge\00"
define void @gen_unsigned_greater_or_equal() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
void *returning_any(void *data) { return (data); }


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

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

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

LLVM IR (-O2):
define i8* @returning_any(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double val = 0.0001;
  printf("%g\n", val);
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 1.000000e-04, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.000000e-04)
ret i32 0
}
int fun450() { return 450; }


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

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

LLVM IR (-O0):
define i32 @fun450() {
ret i32 450
}

LLVM IR (-O2):
define i32 @fun450() {
ret i32 450
}
/* Variables and functions */
int pop2(int *);
int pop() {
  int v2;
  return pop2(&v2);
}


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

x86 assembly (clang, -O2):
<pop>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <pop2@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pop() {
%1 = alloca i32
%2 = call i32 @pop2(i32* %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @pop() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @pop2(i32* %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int read(int, long *, int);
int /*<<< orphan*/ syserr(char *, int);
long readLong(int readDescriptor) {
  long *value = (long *)malloc(sizeof(long));
  if (read(readDescriptor, value, sizeof(long)) != sizeof(long)) {
    syserr("read from %d\n", readDescriptor);
  }
  return *value;
}


x86 assembly (clang, -O0):
<readLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <read@plt>
cltq
cmp    $0x8,%rax
je     1175 <readLong+0x45>
mov    -0x4(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1030 <syserr@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readLong>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
mov    $0x8,%edx
call   1040 <read@plt>
cmp    $0x8,%eax
je     1164 <readLong+0x34>
lea    0xea3(%rip),%rdi
mov    %ebp,%esi
call   1030 <syserr@plt>
mov    (%rbx),%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"read from %d\0A\00"
define i64 @readLong(i32 %0) {
%2 = alloca i32
%3 = alloca i64*
store i32 %0, i32* %2
%4 = call i64 @malloc(i32 8)
%5 = inttoptr i64 %4 to i64*
store i64* %5, i64** %3
%6 = load i32, i32* %2
%7 = load i64*, i64** %3
%8 = call i32 @read(i32 %6, i64* %7, i32 8)
%9 = sext i32 %8 to i64
%10 = icmp ne i64 %9, 8
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i32, i32* %2
%13 = call i32 @syserr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %1
%15 = load i64*, i64** %3
%16 = load i64, i64* %15
ret i64 %16
}

LLVM IR (-O2):
@.str = [14 x i8] c"read from %d\0A\00"
define i64 @readLong(i32 %0) {
%2 = tail call i64 @malloc(i32 8)
%3 = inttoptr i64 %2 to i64*
%4 = tail call i32 @read(i32 %0, i64* %3, i32 8)
%5 = icmp eq i32 %4, 8
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @syserr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %1
%9 = load i64, i64* %3
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ GCSTelemetryStatsHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void GCSTelemetryStatsLogging() { UAVObjLogging(GCSTelemetryStatsHandle()); }


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

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

LLVM IR (-O0):
define void @GCSTelemetryStatsLogging() {
%1 = call i32 (...) @GCSTelemetryStatsHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GCSTelemetryStatsLogging() {
%1 = tail call i32 (...) @GCSTelemetryStatsHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
__attribute__((no)) int fce2(int x, int y) {
  int tmp;
  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }
  return x / y;
}


x86 assembly (clang, -O0):
<fce2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1128 <fce2+0x28>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fce2>:
mov    %edi,%eax
cmp    %esi,%edi
mov    %esi,%ecx
cmovl  %edi,%ecx
cmovl  %esi,%eax
cltd
idiv   %ecx
ret

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

LLVM IR (-O2):
define i32 @fce2(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
%5 = select i1 %3, i32 %1, i32 %0
%6 = sdiv i32 %5, %4
ret i32 %6
}
/* Type definitions */
struct stream {
  int dummy;
};

/* Variables and functions */
int decode_atom_format_6_1(unsigned char const *, struct stream *);
int decode_atom_format_6_8(const unsigned char *pkt, struct stream *stream) {
  return decode_atom_format_6_1(pkt, stream);
}


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

x86 assembly (clang, -O2):
<decode_atom_format_6_8>:
jmp    1030 <decode_atom_format_6_1@plt>

LLVM IR (-O0):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_8(i8* %0, %struct.stream* %1) {
%3 = alloca i8*
%4 = alloca %struct.stream*
store i8* %0, i8** %3
store %struct.stream* %1, %struct.stream** %4
%5 = load i8*, i8** %3
%6 = load %struct.stream*, %struct.stream** %4
%7 = call i32 @decode_atom_format_6_1(i8* %5, %struct.stream* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stream = type { i32 }
define i32 @decode_atom_format_6_8(i8* %0, %struct.stream* %1) {
%3 = tail call i32 @decode_atom_format_6_1(i8* %0, %struct.stream* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ Sys_failure(char *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_mutex_lock(int /*<<< orphan*/ *);
void Pthread_mutex_lock(pthread_mutex_t *mutex) {
  int retval;
  assert(mutex != NULL);
  retval = pthread_mutex_lock(mutex);
  if (retval != 0)
    Sys_failure("pthread_mutex_lock");
}


x86 assembly (clang, -O0):
<Pthread_mutex_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pthread_mutex_lock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1170 <Pthread_mutex_lock+0x40>
lea    0xe95(%rip),%rdi
call   1040 <Sys_failure@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_mutex_lock>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <pthread_mutex_lock@plt>
test   %eax,%eax
je     115b <Pthread_mutex_lock+0x2b>
lea    0xeab(%rip),%rdi
pop    %rbx
jmp    1040 <Sys_failure@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"pthread_mutex_lock\00"
define void @Pthread_mutex_lock(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32*, i32** %2
%9 = call i32 @pthread_mutex_lock(i32* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @Sys_failure(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"pthread_mutex_lock\00"
define void @Pthread_mutex_lock(i32* %0) {
%2 = icmp ne i32* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @pthread_mutex_lock(i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @Sys_failure(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xf9() {
  Assert_real((isbdigit(249) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              1250, ("isbdigit should be 0 for 0xf9"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0xf9>:
push   %rax
mov    $0xf9,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x4e2,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xf9\00"
define void @t_isbdigit_0xf9() {
%1 = call i64 @isbdigit(i32 249)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1250, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xf9\00"
define void @t_isbdigit_0xf9() {
%1 = tail call i64 @isbdigit(i32 249)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1250, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void fail(char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define void @fail(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
void packet_unpack_reg_req(const char *packet, char *name, char *password) {
  int len = (4 + 2);
  memcpy(name, packet + len, 32);
  len += 32;
  memcpy(password, packet + len, 32);
  len += 32;
}


x86 assembly (clang, -O0):
<packet_unpack_reg_req>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x6,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    $0x20,%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    $0x20,%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x1c(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packet_unpack_reg_req>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0x6(%rdi),%rsi
mov    %rax,%rdi
mov    $0x20,%edx
call   1030 <memcpy@plt>
add    $0x26,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @packet_unpack_reg_req(i8* %0, i8* %1, i8* %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 6
%5 = tail call i32 @memcpy(i8* %1, i8* %4, i32 32)
%6 = getelementptr inbounds i8, i8* %0, i64 38
%7 = tail call i32 @memcpy(i8* %2, i8* %6, i32 32)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
main() { echo(""); }


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = call i32 @echo(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_utils(void) { return 54; }


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

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

LLVM IR (-O0):
define i32 @test_utils() {
ret i32 54
}

LLVM IR (-O2):
define i32 @test_utils() {
ret i32 54
}
int d_le_cr2(double a1) { return !(((100) <= (a1))); }


x86 assembly (clang, -O0):
<d_le_cr2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_le_cr2>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
setb   %al
ret

LLVM IR (-O0):
define i32 @d_le_cr2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ole double 1.000000e+02, %3
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @d_le_cr2(double %0) {
%2 = fcmp ult double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void areaConfHeader(FILE *fp) {
  fprintf(fp, "# xmin  xmax  ymin  ymax  divshift area_number\n");
}


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

x86 assembly (clang, -O2):
<areaConfHeader>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"# xmin xmax ymin ymax divshift area_number\0A\00"
define void @areaConfHeader(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"# xmin xmax ymin ymax divshift area_number\0A\00"
define void @areaConfHeader(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i64 47, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(int argc, char **argv) {
  char *c = NULL;
  char a;
  a = *c;
  printf("%c", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
lea    0xec2(%rip),%rdi
movsbl -0x19(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext undef)
ret i32 0
}
/* Variables and functions */
char *strrchr(char *, char);
void remove_newline(char *str) {
  char *nl = NULL;
  char termchar = '\0';
  nl = strrchr(str, '\n');
  if (nl != NULL) {
    *nl = termchar;
  }
  return;
}


x86 assembly (clang, -O0):
<remove_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114e <remove_newline+0x3e>
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_newline>:
push   %rax
mov    $0xa,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1123 <remove_newline+0x13>
movb   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @remove_newline(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %2
store i8* null, i8** %3
store i8 0, i8* %4
%5 = load i8*, i8** %2
%6 = call i8* @strrchr(i8* %5, i8 signext 10)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8, i8* %4
%11 = load i8*, i8** %3
store i8 %10, i8* %11
br label %12
12: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
define void @remove_newline(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret void
}
/* Variables and functions */
int ___get_netmask(int);
int ___ip_switch(int);
int zget_network(int ip, int masklen) {
  int nip = ___ip_switch(ip);
  int mask = ___get_netmask(masklen);
  return ___ip_switch(nip & mask);
}


x86 assembly (clang, -O0):
<zget_network>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <___ip_switch@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <___get_netmask@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
and    -0x10(%rbp),%edi
call   1030 <___ip_switch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zget_network>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <___ip_switch@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <___get_netmask@plt>
and    %eax,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <___ip_switch@plt>

LLVM IR (-O0):
define i32 @zget_network(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i32 @___ip_switch(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @___get_netmask(i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = and i32 %11, %12
%14 = call i32 @___ip_switch(i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @zget_network(i32 %0, i32 %1) {
%3 = tail call i32 @___ip_switch(i32 %0)
%4 = tail call i32 @___get_netmask(i32 %1)
%5 = and i32 %4, %3
%6 = tail call i32 @___ip_switch(i32 %5)
ret i32 %6
}
/* Variables and functions */
void I_InitMusic(void) {}


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

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

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

LLVM IR (-O2):
define void @I_InitMusic() {
ret void
}
void power_supply_remove_attrs(struct power_supply *psy) {}


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

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

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

LLVM IR (-O2):
%struct.power_supply = type opaque
define void @power_supply_remove_attrs(%struct.power_supply* nocapture %0) {
ret void
}
int lbracket(char c) { return c == '['; }


x86 assembly (clang, -O0):
<lbracket>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lbracket>:
xor    %eax,%eax
cmp    $0x5b,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @lbracket(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 91
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @lbracket(i8 signext %0) {
%2 = icmp eq i8 %0, 91
%3 = zext i1 %2 to i32
ret i32 %3
}
int test_imm_EAint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xEA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EAint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 15335424
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned pin_to_bank(unsigned pin) { return pin / 32; }


x86 assembly (clang, -O0):
<pin_to_bank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pin_to_bank>:
mov    %edi,%eax
shr    $0x5,%eax
ret

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

LLVM IR (-O2):
define i32 @pin_to_bank(i32 %0) {
%2 = lshr i32 %0, 5
ret i32 %2
}
__attribute__((no, noclone)) int f1(unsigned char x, unsigned char y) {
  return (x - y) & 0x2ff;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
sub    %ecx,%eax
and    $0x2ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    %edi,%eax
sub    %esi,%eax
and    $0x2ff,%eax
ret

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

LLVM IR (-O2):
define i32 @f1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = zext i8 %1 to i32
%5 = sub nsw i32 %3, %4
%6 = and i32 %5, 767
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int sub(int, int);
int main(void) {
  printf("hello %s, add:%d.\n", "world", sub(6, 4));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
mov    $0x4,%esi
call   1040 <sub@plt>
mov    %eax,%edx
lea    0xeb9(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
mov    $0x4,%esi
call   1040 <sub@plt>
lea    0xec9(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"hello %s, add:%d.\0A\00"
@.str.1 = [6 x i8] c"world\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sub(i32 6, i32 4)
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"hello %s, add:%d.\0A\00"
@.str.1 = [6 x i8] c"world\00"
define i32 @main() {
%1 = tail call i32 @sub(i32 6, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ incr_count();
void doit(int i, int j) {
  if (i > j)
    incr_count();
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1131 <doit+0x21>
mov    $0x0,%al
call   1030 <incr_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
cmp    %esi,%edi
jle    111b <doit+0xb>
xor    %eax,%eax
jmp    1030 <incr_count@plt>
ret

LLVM IR (-O0):
define void @doit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @incr_count()
br label %10
10: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @doit(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @incr_count()
br label %6
6: ; preds = %4, %2
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int x;
};
struct TYPE_4__ {
  TYPE_1__ xconfigurerequest;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xconfigurerequest_x(void *_p, int _v) {
  ((XEvent *)_p)->xconfigurerequest.x = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xconfigurerequest_x>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xconfigurerequest_x(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xconfigurerequest_x(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sca3000_writereg(int, int);
void sca3000_unlock(void) {
  sca3000_writereg(0x1e, 0x00);
  sca3000_writereg(0x1e, 0x50);
  sca3000_writereg(0x1e, 0xA0);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x1e,%edi
xor    %esi,%esi
call   1030 <sca3000_writereg@plt>
mov    $0x1e,%edi
mov    $0x50,%esi
call   1030 <sca3000_writereg@plt>
mov    $0x1e,%edi
mov    $0xa0,%esi
call   1030 <sca3000_writereg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
mov    $0x1e,%edi
xor    %esi,%esi
call   1030 <sca3000_writereg@plt>
mov    $0x1e,%edi
mov    $0x50,%esi
call   1030 <sca3000_writereg@plt>
mov    $0x1e,%edi
mov    $0xa0,%esi
pop    %rax
jmp    1030 <sca3000_writereg@plt>

LLVM IR (-O0):
define void @sca3000_unlock() {
%1 = call i32 @sca3000_writereg(i32 30, i32 0)
%2 = call i32 @sca3000_writereg(i32 30, i32 80)
%3 = call i32 @sca3000_writereg(i32 30, i32 160)
ret void
}

LLVM IR (-O2):
define void @sca3000_unlock() {
%1 = tail call i32 @sca3000_writereg(i32 30, i32 0)
%2 = tail call i32 @sca3000_writereg(i32 30, i32 80)
%3 = tail call i32 @sca3000_writereg(i32 30, i32 160)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void catch_sig(int signo) { write(1, "CAUGHT SIGNAL!\n", 15); }


x86 assembly (clang, -O0):
<catch_sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
lea    0xed9(%rip),%rsi
mov    $0xf,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catch_sig>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0xf,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"CAUGHT SIGNAL!\0A\00"
define void @catch_sig(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"CAUGHT SIGNAL!\0A\00"
define void @catch_sig(i32 %0) {
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
ret void
}
/* Variables and functions */
int readCharactersFromFile(char *, int, char **, double **);
int loadCharacters(char *charactersFile, int dimensionality, char **characters,
                   double **characterWeights) {
  int characterCount = 0;
  char *tempCharacters;
  double *tempCharacterWeights;
  characterCount = readCharactersFromFile(
      charactersFile, dimensionality, &tempCharacters, &tempCharacterWeights);
  *characters = tempCharacters;
  *characterWeights = tempCharacterWeights;
  return characterCount;
}


x86 assembly (clang, -O0):
<loadCharacters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   1030 <readCharactersFromFile@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadCharacters>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <readCharactersFromFile@plt>
mov    0x10(%rsp),%rcx
mov    %rcx,(%rbx)
mov    0x8(%rsp),%rcx
mov    %rcx,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @loadCharacters(i8* %0, i32 %1, i8** nocapture writeonly %2, double** nocapture writeonly %3) {
%5 = alloca i8*
%6 = alloca double*
%7 = bitcast i8** %5 to i8*
%8 = bitcast double** %6 to i8*
%9 = call i32 @readCharactersFromFile(i8* %0, i32 %1, i8** %5, double** %6)
%10 = load i8*, i8** %5
store i8* %10, i8** %2
%11 = load double*, double** %6
store double* %11, double** %3
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_ror_epi32(int /*<<< orphan*/, int);
__attribute__((always_)) __m128i rot16_128(__m128i x) {
  return _mm_ror_epi32(x, 16);
}


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

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

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

LLVM IR (-O2):
define i32 @rot16_128(i32 %0) {
%2 = tail call i32 @_mm_ror_epi32(i32 %0, i32 16)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ refresh();
void warning(char *message) {
  move(22, 0);
  printw("*** %s\n", message);
  refresh();
}


x86 assembly (clang, -O0):
<warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x16,%edi
xor    %esi,%esi
call   1050 <move@plt>
mov    -0x8(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warning>:
push   %rbx
mov    %rdi,%rbx
mov    $0x16,%edi
xor    %esi,%esi
call   1050 <move@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printw@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <refresh@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"*** %s\0A\00"
define void @warning(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @move(i32 22, i32 0)
%4 = load i8*, i8** %2
%5 = call i32 @printw(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"*** %s\0A\00"
define void @warning(i8* %0) {
%2 = tail call i32 @move(i32 22, i32 0)
%3 = tail call i32 @printw(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
double copysign(int, double const);
int /*<<< orphan*/ fabs(double const);
double minf(int /*<<< orphan*/, int /*<<< orphan*/);
double minmod(const double a, const double b) {
  return 0.5 * (copysign(1, a) + copysign(1, b)) * minf(fabs(a), fabs(b));
}


x86 assembly (clang, -O0):
<minmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%edi
call   1040 <copysign@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%edi
call   1040 <copysign@plt>
movsd  -0x28(%rbp),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe8a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1050 <minf@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minmod>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%edi
call   1040 <copysign@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%edi
movsd  0x10(%rsp),%xmm0
call   1040 <copysign@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe91(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1030 <fabs@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <minf@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @minmod(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double @copysign(i32 1, double %5)
%7 = load double, double* %4
%8 = call double @copysign(i32 1, double %7)
%9 = fadd double %6, %8
%10 = fmul double 5.000000e-01, %9
%11 = load double, double* %3
%12 = call i32 @fabs(double %11)
%13 = load double, double* %4
%14 = call i32 @fabs(double %13)
%15 = call double @minf(i32 %12, i32 %14)
%16 = fmul double %10, %15
ret double %16
}

LLVM IR (-O2):
define double @minmod(double %0, double %1) {
%3 = tail call double @copysign(i32 1, double %0)
%4 = tail call double @copysign(i32 1, double %1)
%5 = fadd double %3, %4
%6 = fmul double %5, 5.000000e-01
%7 = tail call i32 @fabs(double %0)
%8 = tail call i32 @fabs(double %1)
%9 = tail call double @minf(i32 %7, i32 %8)
%10 = fmul double %6, %9
ret double %10
}