xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int i2c_init(int busno) {
  char name[256];
  sprintf(name, "/dev/i2c-%d", busno);
  return open(name, O_RDWR);
}


x86 assembly (clang, -O0):
<i2c_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec1(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_init>:
push   %rbx
sub    $0x100,%rsp
mov    %edi,%edx
lea    0xecf(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <open@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/i2c-%d\00"
@O_RDWR = global i32 0
define i32 @i2c_init(i32 %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* @O_RDWR
%9 = call i32 @open(i8* %7, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/i2c-%d\00"
@O_RDWR = global i32 0
define i32 @i2c_init(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i32, i32* @O_RDWR
%6 = call i32 @open(i8* %3, i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  uint16_t test1 = 1 << 15;
  uint16_t test2 = test1;
  uint16_t sum = test1 + test2;
  printf(" sum: %u ", sum);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c" sum: %u \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 65536)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *setmntent(const char *name, const char *mode) {
  return fopen(name, mode);
}


x86 assembly (clang, -O0):
<setmntent>:
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 <fopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setmntent>:
jmp    1030 <fopen@plt>

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

LLVM IR (-O2):
define noalias i32* @setmntent(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
void sprint_movx_to_atDPTR(char *str) {
  sprintf(str, "MOVX  @DPTR, A                  ");
}


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

x86 assembly (clang, -O2):
<sprint_movx_to_atDPTR>:
movups 0xf09(%rip),%xmm0
movups %xmm0,0x10(%rdi)
movups 0xeee(%rip),%xmm0
movups %xmm0,(%rdi)
movb   $0x0,0x20(%rdi)
ret

LLVM IR (-O0):
@.str = [33 x i8] c"MOVX @DPTR, A \00"
define void @sprint_movx_to_atDPTR(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"MOVX @DPTR, A \00"
define void @sprint_movx_to_atDPTR(i8* nocapture writeonly %0) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(33) %0, i8* align 1 dereferenceable(33) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 33, i1 false)
ret void
}
/* Variables and functions */
int rand();
int getRandomInt(int min, int max) {
  unsigned int rand_int;
  if (min > max) {
    return 0;
  }
  rand_int = min + (rand() % (max - min + 1));
  return rand_int;
}


x86 assembly (clang, -O0):
<getRandomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1136 <getRandomInt+0x26>
movl   $0x0,-0x4(%rbp)
jmp    115d <getRandomInt+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
xor    %eax,%eax
sub    %edi,%ebp
jl     112e <getRandomInt+0x1e>
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
add    $0x1,%ebp
cltd
idiv   %ebp
mov    %edx,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getRandomInt(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, %0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 (...) @rand()
%6 = sub i32 1, %0
%7 = add i32 %6, %1
%8 = srem i32 %5, %7
%9 = add nsw i32 %8, %0
br label %10
10: ; preds = %2, %4
%11 = phi i32 [ %9, %4 ], [ 0, %2 ]
ret i32 %11
}
/* Variables and functions */
int lee(int, unsigned char *, int, int);
unsigned char lee_mensaje(int s_cliente, int segundos, int *fin) {
  unsigned char buf = 0;
  *fin = lee(s_cliente, &buf, 1, segundos);
  return buf;
}


x86 assembly (clang, -O0):
<lee_mensaje>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1030 <lee@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movzbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lee_mensaje>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %esi,%ecx
movb   $0x0,0xf(%rsp)
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
call   1030 <lee@plt>
mov    %eax,(%rbx)
mov    0xf(%rsp),%al
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define zeroext i8 @lee_mensaje(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = alloca i8
store i8 0, i8* %4
%5 = call i32 @lee(i32 %0, i8* %4, i32 1, i32 %1)
store i32 %5, i32* %2
%6 = load i8, i8* %4
ret i8 %6
}
/* Variables and functions */
scalar_t__ array_size_check(char **, int, int);
void vtkParse_AddStringToArray(const char ***valueArray, int *count,
                               const char *value) {
  *valueArray = (const char **)array_size_check((char **)*valueArray,
                                                sizeof(const char *), *count);
  (*valueArray)[(*count)++] = value;
}


x86 assembly (clang, -O0):
<vtkParse_AddStringToArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    $0x8,%esi
call   1030 <array_size_check@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rsi
mov    (%rsi),%ecx
mov    %ecx,%edi
add    $0x1,%edi
mov    %edi,(%rsi)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vtkParse_AddStringToArray>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rdi),%rdi
mov    (%rsi),%edx
mov    $0x8,%esi
call   1030 <array_size_check@plt>
mov    %rax,(%r15)
movslq (%rbx),%rcx
lea    0x1(%rcx),%edx
mov    %edx,(%rbx)
mov    %r14,(%rax,%rcx,8)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @vtkParse_AddStringToArray(i8*** nocapture %0, i32* nocapture %1, i8* %2) {
%4 = load i8**, i8*** %0
%5 = load i32, i32* %1
%6 = tail call i64 @array_size_check(i8** %4, i32 8, i32 %5)
%7 = inttoptr i64 %6 to i8**
store i8** %7, i8*** %0
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8*, i8** %7, i64 %10
store i8* %2, i8** %11
ret void
}
int cfunc(int input) { return -input; }


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

x86 assembly (clang, -O2):
<cfunc>:
mov    %edi,%eax
neg    %eax
ret

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

LLVM IR (-O2):
define i32 @cfunc(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
int test_imm_71uint16_reg(unsigned short val) {
  return ((val) & (-0x71 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_71uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -113
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t le32toh(uint8_t *in) {
  return in[0] | (in[1] << 8) | (in[2] << 16) | (in[3] << 24);
}


x86 assembly (clang, -O0):
<le32toh>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<le32toh>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @le32toh(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %5, %9
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32, i32* %12
%14 = shl i32 %13, 16
%15 = or i32 %10, %14
%16 = load i32*, i32** %2
%17 = getelementptr inbounds i32, i32* %16, i64 3
%18 = load i32, i32* %17
%19 = shl i32 %18, 24
%20 = or i32 %15, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @le32toh(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = or i32 %6, %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = or i32 %10, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ fputc(int, void *);
void f_putc(void *data, int ch) { fputc(ch, data); }


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

x86 assembly (clang, -O2):
<f_putc>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
define void @f_putc(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @fputc(i32 %1, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int write(int, char *, int);
void write_client(int clnt_fd, char *buff2) {
  int err;
  err = write(clnt_fd, buff2, 40);
  if (err < 0) {
    printf("Error in write()\n Goodbye!!\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<write_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x28,%edx
call   1030 <write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1173 <write_client+0x43>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_client>:
push   %rax
mov    $0x28,%edx
call   1040 <write@plt>
test   %eax,%eax
js     1141 <write_client+0x11>
pop    %rax
ret
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Error in write()\0A Goodbye!!\0A\00"
define void @write_client(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = load i8*, i8** %4
%8 = call i32 @write(i32 %6, i8* %7, i32 40)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"Error in write()\0A Goodbye!!\00"
define void @write_client(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @write(i32 %0, i8* %1, i32 40)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ init(int, char const **);
int /*<<< orphan*/ moo_main();
int main(int argc, const char **argv) {
  init(argc, argv);
  moo_main();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <init@plt>
mov    $0x0,%al
call   1030 <moo_main@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @init(i32 %6, i8** %7)
%9 = call i32 (...) @moo_main()
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @init(i32 %0, i8** %1)
%4 = tail call i32 (...) @moo_main()
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
short int shortint_ignoring_signedchar(short int x, signed char y) { return x; }


x86 assembly (clang, -O0):
<shortint_ignoring_signedchar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shortint_ignoring_signedchar>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i16 @shortint_ignoring_signedchar(i16 signext %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @shortint_ignoring_signedchar(i16 returned signext %0, i8 signext %1) {
ret i16 %0
}
/* Variables and functions */
int /*<<< orphan*/ uart_puts(char const *);
void log_warning(const char *msg) {
  uart_puts(msg);
  uart_puts("\n");
}


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

x86 assembly (clang, -O2):
<log_warning>:
push   %rax
call   1030 <uart_puts@plt>
lea    0xee3(%rip),%rdi
pop    %rax
jmp    1030 <uart_puts@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @log_warning(i8* %0) {
%2 = tail call i32 @uart_puts(i8* %0)
%3 = tail call i32 @uart_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void mensagem() {
  printf("======================\n");
  printf("Digite múltiplos de 5.\n");
  printf("======================\n");
}


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

x86 assembly (clang, -O2):
<mensagem>:
push   %rbx
lea    0xf00(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"======================\0A\00"
@.str.1 = [25 x i8] c"Digite m\C3\BAltiplos de 5.\0A\00"
define void @mensagem() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str.2 = [24 x i8] c"Digite m\C3\BAltiplos de 5.\00"
@str.3 = [23 x i8] c"======================\00"
define void @mensagem() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
ret void
}
void reset_ncommon(int *Ncommon, int N) {
  for (int i = 0; i < N; i++)
    Ncommon[i] = 0;
}


x86 assembly (clang, -O0):
<reset_ncommon>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <reset_ncommon+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <reset_ncommon+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_ncommon>:
test   %esi,%esi
jle    1126 <reset_ncommon+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @reset_ncommon(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t l2cap_event_channel_opened_get_remote_cid(const uint8_t *event) {
  return little_endian_read_16(event, 15);
}


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

x86 assembly (clang, -O2):
<l2cap_event_channel_opened_get_remote_cid>:
mov    $0xf,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @l2cap_event_channel_opened_get_remote_cid(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 15)
ret i32 %2
}
void EVP_EncryptInit(void) {}


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

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

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

LLVM IR (-O2):
define void @EVP_EncryptInit() {
ret void
}
struct Person *Person_create(int age, int height, int weight) {
  struct Person *who = 0;
  return who;
}


x86 assembly (clang, -O0):
<Person_create>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Person = type opaque
define %struct.Person* @Person_create(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.Person*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store %struct.Person* null, %struct.Person** %7
%8 = load %struct.Person*, %struct.Person** %7
ret %struct.Person* %8
}

LLVM IR (-O2):
%struct.Person = type opaque
define noalias %struct.Person* @Person_create(i32 %0, i32 %1, i32 %2) {
ret %struct.Person* null
}
/* Type definitions */
struct sequence_store_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ array_print(int *, int);
void seq_print_callback(struct sequence_store_t *stor, int *seq, int len,
                        void *closure) {
  array_print(seq, len);
}


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

x86 assembly (clang, -O2):
<seq_print_callback>:
mov    %rsi,%rdi
mov    %edx,%esi
jmp    1030 <array_print@plt>

LLVM IR (-O0):
%struct.sequence_store_t = type { i32 }
define void @seq_print_callback(%struct.sequence_store_t* %0, i32* %1, i32 %2, i8* %3) {
%5 = alloca %struct.sequence_store_t*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
store %struct.sequence_store_t* %0, %struct.sequence_store_t** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32*, i32** %6
%10 = load i32, i32* %7
%11 = call i32 @array_print(i32* %9, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.sequence_store_t = type { i32 }
define void @seq_print_callback(%struct.sequence_store_t* nocapture readnone %0, i32* %1, i32 %2, i8* nocapture readnone %3) {
%5 = tail call i32 @array_print(i32* %1, i32 %2)
ret void
}
const char *Get_Definition(void) {
  return "struct Get {\n"
         "  var  (*get)(var, var);\n"
         "  void (*set)(var, var, var);\n"
         "  bool (*mem)(var, var);\n"
         "  void (*rem)(var, var);\n"
         "  var (*key_type)(var);\n"
         "  var (*val_type)(var);\n"
         "};\n";
}


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

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

LLVM IR (-O0):
@.str = [170 x i8] c"struct Get {\0A var (*get)(var, var);\0A void (*set)(var, var, var);\0A bool (*mem)(var, var);\0A void (*rem)(var, var);\0A var (*key_type)(var);\0A var (*val_type)(var);\0A};\0A\00"
define i8* @Get_Definition() {
ret i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [170 x i8] c"struct Get {\0A var (*get)(var, var);\0A void (*set)(var, var, var);\0A bool (*mem)(var, var);\0A void (*rem)(var, var);\0A var (*key_type)(var);\0A var (*val_type)(var);\0A};\0A\00"
define i8* @Get_Definition() {
ret i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
char *tfgets(char *, int, int /*<<< orphan*/);
int main(void) {
  char buf[BUFSIZ];
  char *bufp;
  bufp = tfgets(buf, sizeof(buf), stdin);
  printf("bufp: %p\n", bufp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    %eax,%esi
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
call   1040 <tfgets@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdi
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdi
mov    %rdi,%rsp
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
call   1040 <tfgets@plt>
lea    0xeaa(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@stdin = global i32 0
@.str = [10 x i8] c"bufp: %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i32 0, i32* %1
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %2
%8 = alloca i8, i64 %6
store i64 %6, i64* %3
%9 = trunc i64 %6 to i32
%10 = load i32, i32* @stdin
%11 = call i8* @tfgets(i8* %8, i32 %9, i32 %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 0, i32* %1
%14 = load i8*, i8** %2
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@stdin = global i32 0
@.str = [10 x i8] c"bufp: %p\0A\00"
define i32 @main() {
%1 = load i32, i32* @BUFSIZ
%2 = zext i32 %1 to i64
%3 = alloca i8, i64 %2
%4 = load i32, i32* @stdin
%5 = call i8* @tfgets(i8* %3, i32 %1, i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
void gpio_set_function(unsigned gpio, int mode) { return; }


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

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

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

LLVM IR (-O2):
define void @gpio_set_function(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CloseSyslog();
int OpenSyslog(char *);
int /*<<< orphan*/ WriteSyslog(char *);
int write_syslog(char *msg) {
  int rv;
  rv = OpenSyslog("ipmiutil");
  if (rv == 0) {
    WriteSyslog(msg);
    CloseSyslog();
  }
  return (rv);
}


x86 assembly (clang, -O0):
<write_syslog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1050 <OpenSyslog@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1165 <write_syslog+0x35>
mov    -0x8(%rbp),%rdi
call   1030 <WriteSyslog@plt>
mov    $0x0,%al
call   1040 <CloseSyslog@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_syslog>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xec2(%rip),%rdi
call   1050 <OpenSyslog@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1158 <write_syslog+0x28>
mov    %r14,%rdi
call   1030 <WriteSyslog@plt>
xor    %eax,%eax
call   1040 <CloseSyslog@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"ipmiutil\00"
define i32 @write_syslog(i8* %0) {
%2 = tail call i32 @OpenSyslog(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @WriteSyslog(i8* %0)
%6 = tail call i32 (...) @CloseSyslog()
br label %7
7: ; preds = %4, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ rb_vm_change_state();
void rb_clear_cache(void) { rb_vm_change_state(); }


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

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

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

LLVM IR (-O2):
define void @rb_clear_cache() {
%1 = tail call i32 (...) @rb_vm_change_state()
ret void
}
int lib2t22(void) { return 4; }


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

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

LLVM IR (-O0):
define i32 @lib2t22() {
ret i32 4
}

LLVM IR (-O2):
define i32 @lib2t22() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ LBA_REG(void *, int);
int apollo_ropes(void *phys_addr) {
  if (!LBA_REG(phys_addr, 0x0610))
    return 4;
  else if (!LBA_REG(phys_addr, 0x0610))
    return 2;
  else
    return 1;
}


x86 assembly (clang, -O0):
<apollo_ropes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x610,%esi
call   1030 <LBA_REG@plt>
cmp    $0x0,%eax
jne    113f <apollo_ropes+0x2f>
movl   $0x4,-0x4(%rbp)
jmp    1169 <apollo_ropes+0x59>
mov    -0x10(%rbp),%rdi
mov    $0x610,%esi
call   1030 <LBA_REG@plt>
cmp    $0x0,%eax
jne    1162 <apollo_ropes+0x52>
movl   $0x2,-0x4(%rbp)
jmp    1169 <apollo_ropes+0x59>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apollo_ropes>:
push   %rbx
mov    %rdi,%rbx
mov    $0x610,%esi
call   1030 <LBA_REG@plt>
test   %eax,%eax
je     113c <apollo_ropes+0x2c>
mov    %rbx,%rdi
mov    $0x610,%esi
call   1030 <LBA_REG@plt>
cmp    $0x1,%eax
mov    $0x1,%eax
adc    $0x0,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @apollo_ropes(i8* %0) {
%2 = tail call i32 @LBA_REG(i8* %0, i32 1552)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @LBA_REG(i8* %0, i32 1552)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 2, i32 1
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 4, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun3() { printf("In fun3\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"In fun3\00"
define void @fun3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}
int do_977() { return 977; }


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

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

LLVM IR (-O0):
define i32 @do_977() {
ret i32 977
}

LLVM IR (-O2):
define i32 @do_977() {
ret i32 977
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage() {
  printf("BasicMail %s, a simple message exchange suite.\n", "1.0");
  printf("\tUsage: basicmail <server|client|help> [OPTIONS]\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf0e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf01(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"BasicMail %s, a simple message exchange suite.\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [50 x i8] c"\09Usage: basicmail <server|client|help> [OPTIONS]\0A\00"
define void @usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"BasicMail %s, a simple message exchange suite.\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@str = [49 x i8] c"\09Usage: basicmail <server|client|help> [OPTIONS]\00"
define void @usage() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
ret void
}
int SupportedLength(int hashbitlen) {
  if (hashbitlen != 224 && hashbitlen != 256 && hashbitlen != 384 &&
      hashbitlen != 512)
    return 0;
  if (hashbitlen > 256)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<SupportedLength>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xe0,-0x8(%rbp)
je     1147 <SupportedLength+0x47>
cmpl   $0x100,-0x8(%rbp)
je     1147 <SupportedLength+0x47>
cmpl   $0x180,-0x8(%rbp)
je     1147 <SupportedLength+0x47>
cmpl   $0x200,-0x8(%rbp)
je     1147 <SupportedLength+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1167 <SupportedLength+0x67>
cmpl   $0x100,-0x8(%rbp)
jle    1160 <SupportedLength+0x60>
movl   $0x0,-0x4(%rbp)
jmp    1167 <SupportedLength+0x67>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SupportedLength>:
lea    -0xe0(%rdi),%ecx
rol    $0x1b,%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
ja     1125 <SupportedLength+0x25>
mov    $0x223,%edx
bt     %ecx,%edx
jae    1125 <SupportedLength+0x25>
xor    %eax,%eax
cmp    $0x101,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @SupportedLength(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 224
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 256
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 384
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 512
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 0, i32* %2
br label %21
16: ; preds = %12, %9, %6, %1
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 256
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 0, i32* %2
br label %21
20: ; preds = %16
store i32 1, i32* %2
br label %21
21: ; preds = %20, %19, %15
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @SupportedLength(i32 %0) {
%2 = add i32 %0, -224
%3 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 27)
switch i32 %3, label %7 [
i32 9, label %4
i32 5, label %4
i32 1, label %4
i32 0, label %4
]
4: ; preds = %1, %1, %1, %1
%5 = icmp slt i32 %0, 257
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %4, %1
%8 = phi i32 [ 0, %1 ], [ %6, %4 ]
ret i32 %8
}
double munge_regular(double a, double b) { return a + b; }


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

x86 assembly (clang, -O2):
<munge_regular>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @munge_regular(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @munge_regular(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ init_rand55(long);
int /*<<< orphan*/ printdat();
int main(int argc, char **arglist) {
  init_rand55(9999999L);
  printdat();
  return 0;
}


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    $0x98967f,%edi
call   1030 <init_rand55@plt>
mov    $0x0,%al
call   1040 <printdat@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x98967f,%edi
call   1030 <init_rand55@plt>
xor    %eax,%eax
call   1040 <printdat@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @init_rand55(i64 9999999)
%7 = call i32 (...) @printdat()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @init_rand55(i64 9999999)
%4 = tail call i32 (...) @printdat()
ret i32 0
}
/* Type definitions */
struct ln_dms {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ln_deg_to_dms(double, struct ln_dms *);
double ln_rad_to_deg(double);
void ln_rad_to_dms(double radians, struct ln_dms *dms) {
  double degrees = ln_rad_to_deg(radians);
  ln_deg_to_dms(degrees, dms);
}


x86 assembly (clang, -O0):
<ln_rad_to_dms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <ln_rad_to_deg@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <ln_deg_to_dms@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_rad_to_dms>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ln_rad_to_deg@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <ln_deg_to_dms@plt>

LLVM IR (-O0):
%struct.ln_dms = type { i32 }
define void @ln_rad_to_dms(double %0, %struct.ln_dms* %1) {
%3 = alloca double
%4 = alloca %struct.ln_dms*
%5 = alloca double
store double %0, double* %3
store %struct.ln_dms* %1, %struct.ln_dms** %4
%6 = load double, double* %3
%7 = call double @ln_rad_to_deg(double %6)
store double %7, double* %5
%8 = load double, double* %5
%9 = load %struct.ln_dms*, %struct.ln_dms** %4
%10 = call i32 @ln_deg_to_dms(double %8, %struct.ln_dms* %9)
ret void
}

LLVM IR (-O2):
%struct.ln_dms = type { i32 }
define void @ln_rad_to_dms(double %0, %struct.ln_dms* %1) {
%3 = tail call double @ln_rad_to_deg(double %0)
%4 = tail call i32 @ln_deg_to_dms(double %3, %struct.ln_dms* %1)
ret void
}
/* Type definitions */
struct in_addr {
  int dummy;
};

/* Variables and functions */
int memcmp(void const *, void const *, int);
int in_addr_cmp(const void *elt1, const void *elt2) {
  return memcmp(elt1, elt2, sizeof(struct in_addr));
}


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

x86 assembly (clang, -O2):
<in_addr_cmp>:
mov    $0x4,%edx
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @in_addr_cmp(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 4)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
void read_h(void *addr, size_t size) { printf("*** read %p\n", addr); }


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

x86 assembly (clang, -O2):
<read_h>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"*** read %p\0A\00"
define void @read_h(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"*** read %p\0A\00"
define void @read_h(i8* %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
const char *elf_endian(unsigned char code) {
  if (code == 1)
    return "little endian";
  else if (code == 2)
    return "big endian";
  else
    return "Unkown";
}


x86 assembly (clang, -O0):
<elf_endian>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x1,%eax
jne    1127 <elf_endian+0x27>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114f <elf_endian+0x4f>
movzbl -0x9(%rbp),%eax
cmp    $0x2,%eax
jne    1144 <elf_endian+0x44>
lea    0xed3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114f <elf_endian+0x4f>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<elf_endian>:
cmp    $0x2,%dil
lea    0xf03(%rip),%rax
lea    0xf07(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x1,%dil
lea    0xedf(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"little endian\00"
@.str.1 = [11 x i8] c"big endian\00"
@.str.2 = [7 x i8] c"Unkown\00"
define i8* @elf_endian(i8 zeroext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %14
13: ; preds = %8
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %14
14: ; preds = %13, %12, %7
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [14 x i8] c"little endian\00"
@.str.1 = [11 x i8] c"big endian\00"
@.str.2 = [7 x i8] c"Unkown\00"
define i8* @elf_endian(i8 zeroext %0) {
%2 = icmp eq i8 %0, 2
%3 = select i1 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i8 %0, 1
%5 = select i1 %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}