xunge/DecIR huggingface dataset:
/* Type definitions */
struct i2c_client {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int i2c_master_send(struct i2c_client *, void const *, int);
struct i2c_client *to_i2c_client(struct device *);
int ft5x0x_i2c_send(struct device *dev, const void *buf, int len) {
  struct i2c_client *client = to_i2c_client(dev);
  int count = i2c_master_send(client, buf, len);
  return count < 0 ? count : 0;
}


x86 assembly (clang, -O0):
<ft5x0x_i2c_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <to_i2c_client@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <i2c_master_send@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1168 <ft5x0x_i2c_send+0x48>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1172 <ft5x0x_i2c_send+0x52>
xor    %eax,%eax
mov    %eax,-0x28(%rbp)
jmp    1172 <ft5x0x_i2c_send+0x52>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft5x0x_i2c_send>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <to_i2c_client@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <i2c_master_send@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
and    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.device = type { i32 }
%struct.i2c_client = type { i32 }
define i32 @ft5x0x_i2c_send(%struct.device* %0, i8* %1, i32 %2) {
%4 = alloca %struct.device*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.i2c_client*
%8 = alloca i32
store %struct.device* %0, %struct.device** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load %struct.device*, %struct.device** %4
%10 = call %struct.i2c_client* @to_i2c_client(%struct.device* %9)
store %struct.i2c_client* %10, %struct.i2c_client** %7
%11 = load %struct.i2c_client*, %struct.i2c_client** %7
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i32 @i2c_master_send(%struct.i2c_client* %11, i8* %12, i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = load i32, i32* %8
br label %20
19: ; preds = %3
br label %20
20: ; preds = %19, %17
%21 = phi i32 [ %18, %17 ], [ 0, %19 ]
ret i32 %21
}

LLVM IR (-O2):
%struct.device = type { i32 }
%struct.i2c_client = type { i32 }
define i32 @ft5x0x_i2c_send(%struct.device* %0, i8* %1, i32 %2) {
%4 = tail call %struct.i2c_client* @to_i2c_client(%struct.device* %0)
%5 = tail call i32 @i2c_master_send(%struct.i2c_client* %4, i8* %1, i32 %2)
%6 = icmp slt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
ret i32 %7
}
/* Variables and functions */
unsigned char *malloc(int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *, int);
int strlen(char *);
unsigned char *bufdup(const unsigned char *buf) {
  unsigned char *new = NULL;
  if (buf) {
    int len = strlen((char *)buf);
    new = malloc(len + 1);
    memcpy(new, buf, len + 1);
  }
  return new;
}


x86 assembly (clang, -O0):
<bufdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     117d <bufdup+0x4d>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bufdup>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     115d <bufdup+0x2d>
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
jmp    1160 <bufdup+0x30>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @bufdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i8* null, i8** %3
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = call i32 @memcpy(i8* %13, i8* %14, i32 %16)
br label %18
18: ; preds = %7, %1
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
define i8* @bufdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = tail call i8* @malloc(i32 %5)
%7 = tail call i32 @memcpy(i8* %6, i8* %0, i32 %5)
br label %8
8: ; preds = %3, %1
%9 = phi i8* [ %6, %3 ], [ null, %1 ]
ret i8* %9
}
int test_imm_02uint16_mem(unsigned short *val) {
  return ((*val) & (0x02 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_02uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 2
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned long long my_rdtsc() {
  unsigned int lo, hi;
  __asm__ __volatile__("xorl %%eax,%%eax \n        cpuid" ::
                           : "%rax", "%rbx", "%rcx", "%rdx");
  __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
  return (unsigned long long)hi << 32 | lo;
}


x86 assembly (clang, -O0):
<my_rdtsc>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
xor    %eax,%eax
cpuid
rdtsc
mov    %eax,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x20,%rax
mov    -0xc(%rbp),%ecx
or     %rcx,%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_rdtsc>:
push   %rbx
xor    %eax,%eax
cpuid
rdtsc
shl    $0x20,%rdx
mov    %eax,%eax
or     %rdx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @my_rdtsc() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = shl i64 %7, 32
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = or i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @my_rdtsc() {
tail call void asm sideeffect "xorl %eax,%eax \0A cpuid", "~{rax},~{rbx},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"()
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 %4, 32
%6 = zext i32 %2 to i64
%7 = or i64 %5, %6
ret i64 %7
}
__typeof__(mempcpy(1, 1, "")) test_mempcpy_121(void) {
  return mempcpy(1, 1, "");
}


x86 assembly (clang, -O0):
<test_mempcpy_121>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%esi
lea    0xee0(%rip),%rdx
mov    %rsi,%rdi
call   1030 <memcpy@plt>
mov    $0x1,%eax
lea    0xecc(%rip),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mempcpy_121>:
lea    0xefa(%rip),%rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @test_mempcpy_121() {
ret i8* getelementptr inbounds (i8, i8* inttoptr (i64 1 to i8*), i64 ptrtoint ([1 x i8]* @.str to i64))
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @test_mempcpy_121() {
ret i8* getelementptr inbounds (i8, i8* inttoptr (i64 1 to i8*), i64 ptrtoint ([1 x i8]* @.str to i64))
}
/* Variables and functions */
int /*<<< orphan*/ pad_set(int, int);
int(cmd_up)(int c, char **v) {
  pad_set((0x04), v[0][0] == '+');
  return 0;
}


x86 assembly (clang, -O0):
<cmd_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
mov    $0x4,%edi
call   1030 <pad_set@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_up>:
push   %rax
mov    (%rsi),%rax
xor    %esi,%esi
cmpb   $0x2b,(%rax)
sete   %sil
mov    $0x4,%edi
call   1030 <pad_set@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @cmd_up(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 43
%6 = zext i1 %5 to i32
%7 = tail call i32 @pad_set(i32 4, i32 %6)
ret i32 0
}
void start_demo(void) { {}; }


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

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

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

LLVM IR (-O2):
define void @start_demo() {
ret void
}
/* Variables and functions */
int fib2(int);
int fib1(int x) { return fib2(x); }


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

x86 assembly (clang, -O2):
<fib1>:
jmp    1030 <fib2@plt>

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

LLVM IR (-O2):
define i32 @fib1(i32 %0) {
%2 = tail call i32 @fib2(i32 %0)
ret i32 %2
}
/* Variables and functions */
float min_ff(float, float);
float min_fff(float a, float b, float c) { return min_ff(min_ff(a, b), c); }


x86 assembly (clang, -O0):
<min_fff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <min_ff@plt>
movss  -0xc(%rbp),%xmm1
call   1030 <min_ff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_fff>:
push   %rax
movss  %xmm2,0x4(%rsp)
call   1030 <min_ff@plt>
movss  0x4(%rsp),%xmm1
pop    %rax
jmp    1030 <min_ff@plt>

LLVM IR (-O0):
define float @min_fff(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = call float @min_ff(float %7, float %8)
%10 = load float, float* %6
%11 = call float @min_ff(float %9, float %10)
ret float %11
}

LLVM IR (-O2):
define float @min_fff(float %0, float %1, float %2) {
%4 = tail call float @min_ff(float %0, float %1)
%5 = tail call float @min_ff(float %4, float %2)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ GLboolean;

/* Variables and functions */
int /*<<< orphan*/ GL_FALSE;
int /*<<< orphan*/ GL_TRUE;
scalar_t__ strstr(char *, char *);
GLboolean match(char *arg, char *t) {
  if (strstr(t, arg))
    return GL_TRUE;
  else
    return GL_FALSE;
}


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1148 <match+0x38>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <match+0x44>
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strstr@plt>
test   %rax,%rax
jne    112d <match+0x1d>
mov    0x2ebd(%rip),%rax
jmp    1134 <match+0x24>
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @match(i8* %0, i8* %1) {
%3 = tail call i64 @strstr(i8* %1, i8* %0)
%4 = icmp eq i64 %3, 0
%5 = load i32, i32* @GL_FALSE
%6 = load i32, i32* @GL_TRUE
%7 = select i1 %4, i32 %5, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
int main(int argc, char *argv[]) {
  int i = 0;
  while (i < argc) {
    printf("%d: %s\n", i, argv[i]);
    i++;
  }
  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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1162 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <main+0x37>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
void *_OSSwapInt32(int);
uint64_t _OSSwapInt64(uint64_t data) {
  union {
    uint64_t ull;
    uint32_t ul[2];
  } u;
  u.ul[0] = data >> 32;
  u.ul[1] = data & 0xffffffff;
  u.ul[0] = _OSSwapInt32(u.ul[0]);
  u.ul[1] = _OSSwapInt32(u.ul[1]);
  return u.ull;
}


x86 assembly (clang, -O0):
<_OSSwapInt64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <_OSSwapInt32@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <_OSSwapInt32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_OSSwapInt64>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1030 <_OSSwapInt32@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <_OSSwapInt32@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%union.anon = type { [2 x i32] }
define i32 @_OSSwapInt64(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 32
%6 = bitcast %union.anon* %3 to [2 x i32]*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %5, i32* %7
%8 = load i32, i32* %2
%9 = and i32 %8, -1
%10 = bitcast %union.anon* %3 to [2 x i32]*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
store i32 %9, i32* %11
%12 = bitcast %union.anon* %3 to [2 x i32]*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%14 = load i32, i32* %13
%15 = call i8* @_OSSwapInt32(i32 %14)
%16 = ptrtoint i8* %15 to i32
%17 = bitcast %union.anon* %3 to [2 x i32]*
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 0
store i32 %16, i32* %18
%19 = bitcast %union.anon* %3 to [2 x i32]*
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %19, i64 0, i64 1
%21 = load i32, i32* %20
%22 = call i8* @_OSSwapInt32(i32 %21)
%23 = ptrtoint i8* %22 to i32
%24 = bitcast %union.anon* %3 to [2 x i32]*
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %24, i64 0, i64 1
store i32 %23, i32* %25
%26 = bitcast %union.anon* %3 to i32*
%27 = load i32, i32* %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @_OSSwapInt64(i32 %0) {
%2 = tail call i8* @_OSSwapInt32(i32 poison)
%3 = ptrtoint i8* %2 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i8* @_OSSwapInt32(i32 %0)
ret i32 %4
}
/* Variables and functions */
unsigned int startHandleMessages(void *, char *, int, unsigned int *,
                                 unsigned int **, void **, unsigned int *);
unsigned int startRetractFacts(void *handle, char *messages,
                               unsigned int *resultsLength,
                               unsigned int **results, void **rulesBinding,
                               unsigned int *replyCount) {
  return startHandleMessages(handle, messages, 7, resultsLength, results,
                             rulesBinding, replyCount);
}


x86 assembly (clang, -O0):
<startRetractFacts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    $0x7,%edx
mov    %rax,(%rsp)
call   1030 <startHandleMessages@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startRetractFacts>:
push   %rax
mov    %r8,%rax
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %r9,(%rsp)
mov    $0x7,%edx
mov    %rax,%r9
call   1030 <startHandleMessages@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @startRetractFacts(i8* %0, i8* %1, i32* %2, i32** %3, i8** %4, i32* %5) {
%7 = tail call i32 @startHandleMessages(i8* %0, i8* %1, i32 7, i32* %2, i32** %3, i8** %4, i32* %5)
ret i32 %7
}
/* Variables and functions */
int arrayread(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  char *arr = (char *)malloc(1024 * 1024 * 1024);
  int r = arrayread(arr);
  printf("r = %d\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40000000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <arrayread@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x40000000,%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
call   1040 <arrayread@plt>
lea    0xeb6(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"r = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @malloc(i32 1073741824)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @arrayread(i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"r = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 1073741824)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @arrayread(i8* %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void plugin_set_downlink_frequency(double frequency) {
  printf("Downlink Frequency: %f kHz\n", frequency);
}


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"Downlink Frequency: %f kHz\0A\00"
define void @plugin_set_downlink_frequency(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Downlink Frequency: %f kHz\0A\00"
define void @plugin_set_downlink_frequency(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
void wx11fg() {}


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

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

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

LLVM IR (-O2):
define void @wx11fg() {
ret void
}
/* Variables and functions */
void *CRYPTO_malloc(size_t, char const *, int);
void *CRYPTO_secure_malloc(size_t num, const char *file, int line) {
  return CRYPTO_malloc(num, file, line);
}


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

x86 assembly (clang, -O2):
<CRYPTO_secure_malloc>:
jmp    1030 <CRYPTO_malloc@plt>

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

LLVM IR (-O2):
define i8* @CRYPTO_secure_malloc(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @CRYPTO_malloc(i64 %0, i8* %1, i32 %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ write(int, int /*<<< orphan*/ *, int);
ssize_t i2c_write_addr_data8(int fd, uint8_t addr, uint8_t data) {
  uint8_t buffer[2];
  buffer[0] = addr;
  buffer[1] = data;
  return write(fd, buffer, 2);
}


x86 assembly (clang, -O0):
<i2c_write_addr_data8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_write_addr_data8>:
push   %rax
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @i2c_write_addr_data8(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %6
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %10, i32* %11
%12 = load i32, i32* %4
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%14 = call i32 @write(i32 %12, i32* %13, i32 2)
ret i32 %14
}

LLVM IR (-O2):
define i32 @i2c_write_addr_data8(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 %1, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %2, i32* %7
%8 = call i32 @write(i32 %0, i32* %6, i32 2)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("AZY TA SOEUR ELLE CROIT QU'UNE ERREUR 808 C'EST 2 ERREURS 404 !\n");
  return 42;
}


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

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

LLVM IR (-O0):
@.str = [65 x i8] c"AZY TA SOEUR ELLE CROIT QU'UNE ERREUR 808 C'EST 2 ERREURS 404 !\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
ret i32 42
}

LLVM IR (-O2):
@str = [64 x i8] c"AZY TA SOEUR ELLE CROIT QU'UNE ERREUR 808 C'EST 2 ERREURS 404 !\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
ret i32 42
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void write(char *name, char *permission, char *body) {
  if (name == NULL || permission == NULL || body == NULL) {
    return;
  }
  FILE *file;
  file = fopen(name, permission);
  fprintf(file, body);
  fclose(file);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1165 <write+0x35>
cmpq   $0x0,-0x10(%rbp)
je     1165 <write+0x35>
cmpq   $0x0,-0x18(%rbp)
jne    116a <write+0x3a>
jmp    1191 <write+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1168 <write+0x38>
test   %rsi,%rsi
je     1168 <write+0x38>
mov    %rdx,%r14
test   %rdx,%rdx
je     1168 <write+0x38>
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @write(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
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = icmp eq i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i8*, i8** %6
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %13, %10, %3
br label %26
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = call i32* @fopen(i8* %18, i8* %19)
store i32* %20, i32** %7
%21 = load i32*, i32** %7
%22 = load i8*, i8** %6
%23 = call i32 @fprintf(i32* %21, i8* %22)
%24 = load i32*, i32** %7
%25 = call i32 @fclose(i32* %24)
br label %26
26: ; preds = %17, %16
ret void
}

LLVM IR (-O2):
define void @write(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i8* %1, null
%6 = or i1 %4, %5
%7 = icmp eq i8* %2, null
%8 = or i1 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %3
%10 = tail call i32* @fopen(i8* %0, i8* %1)
%11 = tail call i32 @fprintf(i32* %10, i8* %2)
%12 = tail call i32 @fclose(i32* %10)
br label %13
13: ; preds = %3, %9
ret void
}
/* Variables and functions */
void *malloc(int);
void *CRYPTO_malloc_locked(int num, const char *file, int line) {
  if (num <= 0)
    return NULL;
  return malloc(num);
}


x86 assembly (clang, -O0):
<CRYPTO_malloc_locked>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1139 <CRYPTO_malloc_locked+0x29>
movq   $0x0,-0x8(%rbp)
jmp    1145 <CRYPTO_malloc_locked+0x35>
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRYPTO_malloc_locked>:
test   %edi,%edi
jle    1119 <CRYPTO_malloc_locked+0x9>
jmp    1030 <malloc@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @CRYPTO_malloc_locked(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = icmp slt i32 %0, 1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i8* @malloc(i32 %0)
br label %7
7: ; preds = %3, %5
%8 = phi i8* [ %6, %5 ], [ null, %3 ]
ret i8* %8
}
/* Variables and functions */
scalar_t__ is_lws(char const);
int __lws_len(const char *s) {
  int l;
  for (l = 0; is_lws(*s); l++)
    s++;
  return l;
}


x86 assembly (clang, -O0):
<__lws_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_lws@plt>
cmp    $0x0,%rax
je     1153 <__lws_len+0x43>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <__lws_len+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lws_len>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movsbl (%rdi),%edi
call   1030 <is_lws@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1144 <__lws_len+0x34>
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%r14,%rbx,1),%edi
call   1030 <is_lws@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1130 <__lws_len+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @__lws_len(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @is_lws(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 0, %1 ]
%7 = phi i8* [ %8, %5 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = add nuw nsw i32 %6, 1
%10 = load i8, i8* %8
%11 = tail call i64 @is_lws(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %1
%14 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %14
}
int C_Utils_compare_ushort_ptr(const unsigned short *item1,
                               const unsigned short *item2) {
  unsigned short i1 = *item1;
  unsigned short i2 = *item2;
  if (i1 == i2)
    return 0;
  return i1 < i2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<C_Utils_compare_ushort_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ax
mov    %ax,-0x1a(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ax
mov    %ax,-0x1c(%rbp)
movzwl -0x1a(%rbp),%eax
movzwl -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jne    113e <C_Utils_compare_ushort_ptr+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1158 <C_Utils_compare_ushort_ptr+0x58>
movzwl -0x1a(%rbp),%edx
movzwl -0x1c(%rbp),%esi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_Utils_compare_ushort_ptr>:
movzwl (%rdi),%eax
xor    %ecx,%ecx
xor    %edx,%edx
cmp    (%rsi),%ax
setae  %dl
lea    -0x1(%rdx,%rdx,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @C_Utils_compare_ushort_ptr(i16* nocapture %0, i16* nocapture %1) {
%3 = load i16, i16* %0
%4 = load i16, i16* %1
%5 = icmp eq i16 %3, %4
%6 = icmp ult i16 %3, %4
%7 = select i1 %6, i32 -1, i32 1
%8 = select i1 %5, i32 0, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void echo(char param[]) {
  printf("echo command \n");
  printf("parameters = %s \n", param);
  return;
}


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

x86 assembly (clang, -O2):
<echo>:
push   %rbx
mov    %rdi,%rbx
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"echo command \0A\00"
@.str.1 = [18 x i8] c"parameters = %s \0A\00"
define void @echo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"parameters = %s \0A\00"
@str = [14 x i8] c"echo command \00"
define void @echo(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printLog(int /*<<< orphan*/, char *, char *, int, int);
int /*<<< orphan*/ stderr;
void *checkPointerError(void *data, char *msg, char *file, int line,
                        int exit_status) {
  if (!data) {
    printLog(stderr, msg, file, line, exit_status);
  }
  return data;
}


x86 assembly (clang, -O0):
<checkPointerError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <checkPointerError+0x43>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <printLog@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPointerError>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1127 <checkPointerError+0x17>
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <printLog@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
define i8* @checkPointerError(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %20, label %13
13: ; preds = %5
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = call i32 @printLog(i32 %14, i8* %15, i8* %16, i32 %17, i32 %18)
br label %20
20: ; preds = %13, %5
%21 = load i8*, i8** %6
ret i8* %21
}

LLVM IR (-O2):
@stderr = global i32 0
define i8* @checkPointerError(i8* readnone returned %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = icmp eq i8* %0, null
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = load i32, i32* @stderr
%9 = tail call i32 @printLog(i32 %8, i8* %1, i8* %2, i32 %3, i32 %4)
br label %10
10: ; preds = %7, %5
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char const *, int);
int serial_write(int fd, const char *buffer, int len) {
  write(fd, buffer, len);
}


x86 assembly (clang, -O0):
<serial_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_write>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @serial_write(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 undef
}
int float_int_overflow(float f) { return f; }


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

x86 assembly (clang, -O2):
<float_int_overflow>:
cvttss2si %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @float_int_overflow(float %0) {
%2 = fptosi float %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(int argc, char *argv[]) { exit(EXIT_FAILURE); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ setup_cmdline_tag(char *);
int /*<<< orphan*/ setup_core_tag(void *, int);
int /*<<< orphan*/ setup_end_tag();
int /*<<< orphan*/ setup_mem_tag(int, int);
void setup_tags(void *mem) {
  setup_core_tag(mem, 4096);
  setup_mem_tag(0xa0000000, 0x04000000);
  setup_mem_tag(0xc0000000, 0x04000000);
  setup_cmdline_tag("root=179:2 rootdelay=3 rw init=/sbin/init");
  setup_end_tag();
}


x86 assembly (clang, -O0):
<setup_tags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1000,%esi
call   1050 <setup_core_tag@plt>
mov    $0xa0000000,%edi
mov    $0x4000000,%esi
call   1040 <setup_mem_tag@plt>
mov    $0xc0000000,%edi
mov    $0x4000000,%esi
call   1040 <setup_mem_tag@plt>
lea    0xe81(%rip),%rdi
call   1060 <setup_cmdline_tag@plt>
mov    $0x0,%al
call   1030 <setup_end_tag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_tags>:
push   %rax
mov    $0x1000,%esi
call   1050 <setup_core_tag@plt>
mov    $0xa0000000,%edi
mov    $0x4000000,%esi
call   1040 <setup_mem_tag@plt>
mov    $0xc0000000,%edi
mov    $0x4000000,%esi
call   1040 <setup_mem_tag@plt>
lea    0xe90(%rip),%rdi
call   1060 <setup_cmdline_tag@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <setup_end_tag@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"root=179:2 rootdelay=3 rw init=/sbin/init\00"
define void @setup_tags(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @setup_core_tag(i8* %3, i32 4096)
%5 = call i32 @setup_mem_tag(i32 -1610612736, i32 67108864)
%6 = call i32 @setup_mem_tag(i32 -1073741824, i32 67108864)
%7 = call i32 @setup_cmdline_tag(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @setup_end_tag()
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"root=179:2 rootdelay=3 rw init=/sbin/init\00"
define void @setup_tags(i8* %0) {
%2 = tail call i32 @setup_core_tag(i8* %0, i32 4096)
%3 = tail call i32 @setup_mem_tag(i32 -1610612736, i32 67108864)
%4 = tail call i32 @setup_mem_tag(i32 -1073741824, i32 67108864)
%5 = tail call i32 @setup_cmdline_tag(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @setup_end_tag()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void write() {
  FILE *tFile = fopen("test.txt", "w");
  fprintf(tFile, "Hello world!\n");
  fclose(tFile);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [14 x i8] c"Hello world!\0A\00"
define void @write() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32*, i32** %1
%6 = call i32 @fclose(i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [14 x i8] c"Hello world!\0A\00"
define void @write() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i64 13, i64 1, i32* %1)
%3 = tail call i32 @fclose(i32* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ lk_set_digit(int, int /*<<< orphan*/);
void lk_set_4digits(uint8_t value_0, uint8_t value_1, uint8_t value_2,
                    uint8_t value_3) {
  lk_set_digit(0, value_0);
  lk_set_digit(1, value_1);
  lk_set_digit(2, value_2);
  lk_set_digit(3, value_3);
}


x86 assembly (clang, -O0):
<lk_set_4digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <lk_set_digit@plt>
mov    -0x8(%rbp),%esi
mov    $0x1,%edi
call   1030 <lk_set_digit@plt>
mov    -0xc(%rbp),%esi
mov    $0x2,%edi
call   1030 <lk_set_digit@plt>
mov    -0x10(%rbp),%esi
mov    $0x3,%edi
call   1030 <lk_set_digit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lk_set_4digits>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%esi
xor    %edi,%edi
call   1030 <lk_set_digit@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1030 <lk_set_digit@plt>
mov    $0x2,%edi
mov    %ebp,%esi
call   1030 <lk_set_digit@plt>
mov    $0x3,%edi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <lk_set_digit@plt>

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

LLVM IR (-O2):
define void @lk_set_4digits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @lk_set_digit(i32 0, i32 %0)
%6 = tail call i32 @lk_set_digit(i32 1, i32 %1)
%7 = tail call i32 @lk_set_digit(i32 2, i32 %2)
%8 = tail call i32 @lk_set_digit(i32 3, i32 %3)
ret void
}