xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void compound_test() {
  int a = 10;
  printf("a=%d\n", a);
  {
    int a = 20;
    printf("a=%d\n", a);
    {
      int a = 30;
      printf("a=%d\n", a);
    }
    printf("a=%d\n", a);
  }
  printf("a=%d\n", a);
}


x86 assembly (clang, -O0):
<compound_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x14,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1e,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compound_test>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"a=%d\0A\00"
define void @compound_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 10, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 20, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 30, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"a=%d\0A\00"
define void @compound_test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 30)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 20)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void I2SStop(uint32_t ui32Base) {
  ;
  (*((volatile unsigned long *)(0x40021000 + 0x00000004))) = 0x00;
}


x86 assembly (clang, -O0):
<I2SStop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x40021004,%eax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SStop>:
movq   $0x0,0x40021004
ret

LLVM IR (-O0):
define void @I2SStop(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store volatile i64 0, i64* inttoptr (i64 1073876996 to i64*)
ret void
}

LLVM IR (-O2):
define void @I2SStop(i32 %0) {
store volatile i64 0, i64* inttoptr (i64 1073876996 to i64*)
ret void
}
__attribute__((always_)) int eal_is_little_endian(void) {
  unsigned short ed = 0x0001;
  return (char)ed;
}


x86 assembly (clang, -O0):
<eal_is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movw   $0x1,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @eal_is_little_endian() {
%1 = alloca i16
store i16 1, i16* %1
%2 = load i16, i16* %1
%3 = trunc i16 %2 to i8
%4 = sext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @eal_is_little_endian() {
ret i32 1
}
void BN_CTX_init(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_CTX_init() {
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int dict_eq_string(const char **key1, const char **key2) {
  return strcmp(*key1, *key2) == 0;
}


x86 assembly (clang, -O0):
<dict_eq_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dict_eq_string>:
push   %rax
mov    (%rdi),%rdi
mov    (%rsi),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dict_eq_string(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** %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = call i64 @strcmp(i8* %6, i8* %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @dict_eq_string(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i64 @strcmp(i8* %3, i8* %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
void zeroarray(int *numbers, int count) {
  for (int x = 0; x < count; x++)
    numbers[x] = 0;
}


x86 assembly (clang, -O0):
<zeroarray>:
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 <zeroarray+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 <zeroarray+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeroarray>:
test   %esi,%esi
jle    1126 <zeroarray+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 @zeroarray(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 @zeroarray(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
}
int fallar_al_copiar(void *dst, const void *src) { return 42; }


x86 assembly (clang, -O0):
<fallar_al_copiar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2a,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fallar_al_copiar(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 42
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t i_f(float f) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @i_f(float %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DUART_PUTC(int /*<<< orphan*/);
int puts(const char *s) {
  while (*s) {
    DUART_PUTC(*s++);
  }
  return 0;
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <puts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <DUART_PUTC@plt>
jmp    111c <puts+0xc>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <DUART_PUTC@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <puts+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @DUART_PUTC(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ system(char *);
void mail_tim(char *message) {
  char buffer[1024];
  sprintf(buffer,
          "echo \"%s\" 				|"
          "mail timriley@appahost.com		",
          message);
  if (system(buffer)) {
  }
}


x86 assembly (clang, -O0):
<mail_tim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     1161 <mail_tim+0x41>
jmp    1161 <mail_tim+0x41>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mail_tim>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rdx
lea    0xece(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"echo \22%s\22 \09\09\09\09|mail timriley@appahost.com\09\09\00"
define void @mail_tim(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i64 @system(i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %1
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"echo \22%s\22 \09\09\09\09|mail timriley@appahost.com\09\09\00"
define void @mail_tim(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i64 @system(i8* %3)
ret void
}
long int labs(long int x) {
  if (x < 0)
    return (-x);
  else
    return x;
}


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112a <labs+0x2a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64, i64* %3
%8 = sub nsw i64 0, %7
store i64 %8, i64* %2
br label %11
9: ; preds = %1
%10 = load i64, i64* %3
store i64 %10, i64* %2
br label %11
11: ; preds = %9, %6
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, ...);
int syscall(int, int /*<<< orphan*/, int /*<<< orphan*/);
int kfork() {
  int child, pid;
  pid = getpid();
  printf("proc %d enter kernel to kfork a child\n", pid);
  child = syscall(3, 0, 0);
  printf("proc %d kforked a child %d\n", pid, child);
}


x86 assembly (clang, -O0):
<kfork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x3,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <syscall@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kfork>:
push   %rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
lea    0xebf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <syscall@plt>
lea    0xec8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"proc %d enter kernel to kfork a child\0A\00"
@.str.1 = [28 x i8] c"proc %d kforked a child %d\0A\00"
define i32 @kfork() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @getpid()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @syscall(i32 3, i32 0, i32 0)
store i32 %7, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [39 x i8] c"proc %d enter kernel to kfork a child\0A\00"
@.str.1 = [28 x i8] c"proc %d kforked a child %d\0A\00"
define i32 @kfork() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @syscall(i32 3, i32 0, i32 0)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %3)
ret i32 undef
}
const char *Range_Brief(void) { return "Integer Sequence"; }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Integer Sequence\00"
define i8* @Range_Brief() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"Integer Sequence\00"
define i8* @Range_Brief() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
int intSize() {
  int intArray[10];
  int *intPtr1;
  int *intPtr2;
  intPtr1 = &intArray[0];
  intPtr2 = &intArray[1];
  return (long int)intPtr2 - (long int)intPtr1;
}


x86 assembly (clang, -O0):
<intSize>:
push   %rbp
mov    %rsp,%rbp
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @intSize() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = alloca i32*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32* %4, i32** %2
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = ptrtoint i32* %6 to i64
%8 = load i32*, i32** %2
%9 = ptrtoint i32* %8 to i64
%10 = sub nsw i64 %7, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @intSize() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
char *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
char *strs(int length) {
  assert(length > 0);
  char *s = malloc(length * sizeof(char));
  memset(s, ' ', length);
  s[-1] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<strs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movslq -0x4(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x20,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,-0x1(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strs>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %edi,%edi
test   %ebp,%ebp
setg   %dil
call   1040 <assert@plt>
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x20,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
movb   $0x0,-0x1(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @strs(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 1
%11 = trunc i64 %10 to i32
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = load i32, i32* %2
%15 = call i32 @memset(i8* %13, i8 signext 32, i32 %14)
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 -1
store i8 0, i8* %17
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @strs(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @malloc(i32 %0)
%6 = tail call i32 @memset(i8* %5, i8 signext 32, i32 %0)
%7 = getelementptr inbounds i8, i8* %5, i64 -1
store i8 0, i8* %7
ret i8* %5
}
/* Variables and functions */
int f_d();
int f_b() {
  int ret;
  ret = f_d();
  ret -= f_d();
  ret *= f_d();
  return ret;
}


x86 assembly (clang, -O0):
<f_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <f_d@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f_d@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f_d@plt>
imul   -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_b>:
push   %rbx
xor    %eax,%eax
call   1030 <f_d@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <f_d@plt>
sub    %eax,%ebx
xor    %eax,%eax
call   1030 <f_d@plt>
imul   %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f_b() {
%1 = alloca i32
%2 = call i32 (...) @f_d()
store i32 %2, i32* %1
%3 = call i32 (...) @f_d()
%4 = load i32, i32* %1
%5 = sub nsw i32 %4, %3
store i32 %5, i32* %1
%6 = call i32 (...) @f_d()
%7 = load i32, i32* %1
%8 = mul nsw i32 %7, %6
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @f_b() {
%1 = tail call i32 (...) @f_d()
%2 = tail call i32 (...) @f_d()
%3 = sub nsw i32 %1, %2
%4 = tail call i32 (...) @f_d()
%5 = mul nsw i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t const);
char *sql_xmalloc(int);
size_t strlen(char const *);
char *sql_xstrdup(const char *s) {
  if (NULL == s) {
    return NULL;
  } else {
    const size_t l = strlen(s);
    char *cpy = sql_xmalloc(1 + l);
    memcpy(cpy, s, l);
    *(cpy + l) = 0;
    return cpy;
  }
}


x86 assembly (clang, -O0):
<sql_xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1155 <sql_xstrdup+0x25>
movq   $0x0,-0x8(%rbp)
jmp    119a <sql_xstrdup+0x6a>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %eax,%edi
call   1030 <sql_xmalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sql_xstrdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1165 <sql_xstrdup+0x35>
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%edi
call   1030 <sql_xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
jmp    1167 <sql_xstrdup+0x37>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @sql_xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* null, %6
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %24
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
store i64 %11, i64* %4
%12 = load i64, i64* %4
%13 = add i64 1, %12
%14 = trunc i64 %13 to i32
%15 = call i8* @sql_xmalloc(i32 %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = call i32 @memcpy(i8* %16, i8* %17, i64 %18)
%20 = load i8*, i8** %5
%21 = load i64, i64* %4
%22 = getelementptr inbounds i8, i8* %20, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %5
store i8* %23, i8** %2
br label %24
24: ; preds = %9, %8
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
define i8* @sql_xstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = trunc i64 %4 to i32
%6 = add i32 %5, 1
%7 = tail call i8* @sql_xmalloc(i32 %6)
%8 = tail call i32 @memcpy(i8* %7, i8* %0, i64 %4)
%9 = getelementptr inbounds i8, i8* %7, i64 %4
store i8 0, i8* %9
br label %10
10: ; preds = %1, %3
%11 = phi i8* [ %7, %3 ], [ null, %1 ]
ret i8* %11
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
int is_uninitialized(struct timespec *ts) {
  return ts->tv_sec == 0 && ts->tv_nsec == 0;
}


x86 assembly (clang, -O0):
<is_uninitialized>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x9(%rbp)
jne    112a <is_uninitialized+0x2a>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_uninitialized>:
xor    %eax,%eax
cmpq   $0x0,(%rdi)
je     1109 <is_uninitialized+0x9>
ret
xor    %eax,%eax
cmpq   $0x0,0x8(%rdi)
sete   %al
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @is_uninitialized(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load %struct.timespec*, %struct.timespec** %2
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = icmp eq i64 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define i32 @is_uninitialized(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ emulate_vpos();
int /*<<< orphan*/ push_int(int /*<<< orphan*/);
void fn_vpos(void) { push_int(emulate_vpos()); }


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

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

LLVM IR (-O0):
define void @fn_vpos() {
%1 = call i32 (...) @emulate_vpos()
%2 = call i32 @push_int(i32 %1)
ret void
}

LLVM IR (-O2):
define void @fn_vpos() {
%1 = tail call i32 (...) @emulate_vpos()
%2 = tail call i32 @push_int(i32 %1)
ret void
}
int hashaddr_ascii(char *key) {
  char *p;
  int addr, c;
  p = key;
  addr = *p;
  p++;
  while (*p) {
    c = *p - ' ';
    addr <<= 1;
    addr ^= c;
    p++;
  }
  return addr;
}


x86 assembly (clang, -O0):
<hashaddr_ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <hashaddr_ascii+0x63>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x20,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1126 <hashaddr_ascii+0x26>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashaddr_ascii>:
movsbl (%rdi),%eax
mov    0x1(%rdi),%cl
test   %cl,%cl
je     1125 <hashaddr_ascii+0x25>
add    $0x2,%rdi
xchg   %ax,%ax
movsbl %cl,%ecx
add    $0xffffffe0,%ecx
add    %eax,%eax
xor    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hashaddr_ascii+0x10>
ret

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

LLVM IR (-O2):
define i32 @hashaddr_ascii(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %1, %7
%8 = phi i8 [ %16, %7 ], [ %5, %1 ]
%9 = phi i8* [ %15, %7 ], [ %4, %1 ]
%10 = phi i32 [ %14, %7 ], [ %3, %1 ]
%11 = sext i8 %8 to i32
%12 = add nsw i32 %11, -32
%13 = shl i32 %10, 1
%14 = xor i32 %12, %13
%15 = getelementptr inbounds i8, i8* %9, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %1
%19 = phi i32 [ %3, %1 ], [ %14, %7 ]
ret i32 %19
}
/* Variables and functions */
int map(int, int /*<<< orphan*/, int, int /*<<< orphan*/, int);
int remap(int val) { return map(val, 0, 255, 0, 4094); }


x86 assembly (clang, -O0):
<remap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %ecx,%ecx
mov    $0xff,%edx
mov    $0xffe,%r8d
mov    %ecx,%esi
call   1030 <map@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remap>:
xor    %esi,%esi
mov    $0xff,%edx
xor    %ecx,%ecx
mov    $0xffe,%r8d
jmp    1030 <map@plt>

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

LLVM IR (-O2):
define i32 @remap(i32 %0) {
%2 = tail call i32 @map(i32 %0, i32 0, i32 255, i32 0, i32 4094)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
void set_yesno_string(char *str, int yesno) {
  if (yesno)
    sprintf(str, "Yes");
  else
    sprintf(str, "No");
}


x86 assembly (clang, -O0):
<set_yesno_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113e <set_yesno_string+0x2e>
mov    -0x8(%rbp),%rdi
lea    0xecc(%rip),%rsi
call   1030 <sprintf@plt>
jmp    114e <set_yesno_string+0x3e>
mov    -0x8(%rbp),%rdi
lea    0xebb(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_yesno_string>:
test   %esi,%esi
je     110b <set_yesno_string+0xb>
movl   $0x736559,(%rdi)
ret
movb   $0x0,0x2(%rdi)
movw   $0x6f4e,(%rdi)
ret

LLVM IR (-O0):
@.str = [4 x i8] c"Yes\00"
@.str.1 = [3 x i8] c"No\00"
define void @set_yesno_string(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"No\00"
define void @set_yesno_string(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = bitcast i8* %0 to i32*
store i32 7562585, i32* %5
br label %7
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 3, i1 false)
br label %7
7: ; preds = %6, %4
ret void
}
int ft_tolower(int c) {
  if (c >= 'A' && c <= 'Z')
    return (c - 'A' + 'a');
  return (c);
}


x86 assembly (clang, -O0):
<ft_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     112c <ft_tolower+0x2c>
cmpl   $0x5a,-0x8(%rbp)
jg     112c <ft_tolower+0x2c>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <ft_tolower+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_tolower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @ft_tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 65
%12 = add nsw i32 %11, 97
store i32 %12, i32* %2
br label %15
13: ; preds = %6, %1
%14 = load i32, i32* %3
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @ft_tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
q() { return 5; }


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

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

LLVM IR (-O0):
define i32 @q() {
ret i32 5
}

LLVM IR (-O2):
define i32 @q() {
ret i32 5
}
double drand_(flag)
unsigned long *flag;
{
  if (*flag)
    my_srandom((unsigned)*flag);
  return ((double)my_random()) * 4.6566128752458e-10;
}


x86 assembly (clang, -O0):
<drand_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114a <drand_+0x2a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%edi
mov    $0x0,%al
call   1040 <my_srandom@plt>
mov    $0x0,%al
call   1030 <my_random@plt>
cvtsi2sd %eax,%xmm0
movsd  0xea3(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand_>:
push   %rax
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1130 <drand_+0x10>
xor    %eax,%eax
call   1040 <my_srandom@plt>
xor    %eax,%eax
call   1030 <my_random@plt>
cvtsi2sd %eax,%xmm0
mulsd  0xebd(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @drand_(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i64*, i64** %2
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = call i32 (i32, ...) bitcast (i32 (...)* @my_srandom to i32 (i32, ...)*)(i32 %9)
br label %11
11: ; preds = %6, %1
%12 = call i32 (...) @my_random()
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 0x3E00000000200003
ret double %14
}

LLVM IR (-O2):
define double @drand_(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = trunc i64 %2 to i32
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @my_srandom to i32 (i32, ...)*)(i32 %5)
br label %7
7: ; preds = %4, %1
%8 = tail call i32 (...) @my_random()
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 0x3E00000000200003
ret double %10
}
/* Variables and functions */
int atoi(char *);
int my_atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%d\n", my_atoi(argv[1]));
  printf("%d\n", atoi(argv[1]));
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <my_atoi@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <my_atoi@plt>
lea    0xeb9(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @my_atoi(i8* %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = tail call i32 @atoi(i8* %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int tid_verify(const pid_t pid) {
  int found = 0;
  char buf[64];
  DIR *dir;
  snprintf(buf, sizeof(buf) - 1, "/proc/%d", (int)pid);
  dir = opendir(buf);
  if (dir != NULL) {
    found = 1;
    closedir(dir);
  }
  return found;
}


x86 assembly (clang, -O0):
<tid_verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    $0x3f,%esi
lea    0xea7(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x50(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     1186 <tid_verify+0x56>
movl   $0x1,-0xc(%rbp)
mov    -0x58(%rbp),%rdi
call   1050 <closedir@plt>
mov    -0xc(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tid_verify>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rcx
lea    0xec1(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <opendir@plt>
test   %rax,%rax
je     116b <tid_verify+0x3b>
mov    %rax,%rdi
call   1050 <closedir@plt>
mov    $0x1,%eax
jmp    116d <tid_verify+0x3d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"/proc/%d\00"
define i32 @tid_verify(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca [64 x i8]
%5 = alloca i32*
store i64 %0, i64* %2
store i32 0, i32* %3
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%7 = load i64, i64* %2
%8 = trunc i64 %7 to i32
%9 = call i32 @snprintf(i8* %6, i32 63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%11 = call i32* @opendir(i8* %10)
store i32* %11, i32** %5
%12 = load i32*, i32** %5
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %1
store i32 1, i32* %3
%15 = load i32*, i32** %5
%16 = call i32 @closedir(i32* %15)
br label %17
17: ; preds = %14, %1
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [9 x i8] c"/proc/%d\00"
define i32 @tid_verify(i64 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = trunc i64 %0 to i32
%5 = call i32 @snprintf(i8* %3, i32 63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32* @opendir(i8* %3)
%7 = icmp eq i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @closedir(i32* %6)
br label %10
10: ; preds = %8, %1
%11 = phi i32 [ 1, %8 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ ft_memset(void *, char, int /*<<< orphan*/);
int /*<<< orphan*/ ft_strlen(char *);
void ft_strclr(char *s) {
  if (s && *s)
    s = (char *)ft_memset((void *)s, '\0', ft_strlen(s));
}


x86 assembly (clang, -O0):
<ft_strclr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1169 <ft_strclr+0x49>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1169 <ft_strclr+0x49>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1040 <ft_memset@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strclr>:
push   %rbx
test   %rdi,%rdi
je     1143 <ft_strclr+0x23>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1143 <ft_strclr+0x23>
mov    %rbx,%rdi
call   1030 <ft_strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <ft_memset@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_strclr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %16
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @ft_strlen(i8* %12)
%14 = call i64 @ft_memset(i8* %11, i8 signext 0, i32 %13)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %2
br label %16
16: ; preds = %10, %5, %1
ret void
}

LLVM IR (-O2):
define void @ft_strclr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @ft_strlen(i8* %0)
%8 = tail call i64 @ft_memset(i8* %0, i8 signext 0, i32 %7)
br label %9
9: ; preds = %6, %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PL_install_readline();
void install_readline(int argc, char **argv) { PL_install_readline(); }


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

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

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

LLVM IR (-O2):
define void @install_readline(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @PL_install_readline()
ret void
}
void waitVsync() {
  unsigned int *volatile iesr = (unsigned int *)(0x80000000U + (4 * 2));
  while (!(*iesr & (1 << 0)))
    ;
  printf("Vsync ready\n");
}


x86 assembly (clang, -O0):
<waitVsync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x80000008,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113f <waitVsync+0x2f>
jmp    1144 <waitVsync+0x34>
jmp    1121 <waitVsync+0x11>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitVsync>:
mov    $0x80000008,%eax
mov    %rax,-0x8(%rsp)
nopw   0x0(%rax,%rax,1)
mov    -0x8(%rsp),%rax
testb  $0x1,(%rax)
je     1120 <waitVsync+0x10>
lea    0xecf(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Vsync ready\0A\00"
define void @waitVsync() {
%1 = alloca i32*
store volatile i32* inttoptr (i64 2147483656 to i32*), i32** %1
br label %2
2: ; preds = %8, %0
%3 = load volatile i32*, i32** %1
%4 = load i32, i32* %3
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %2
br label %2
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"Vsync ready\00"
define void @waitVsync() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
store volatile i32* inttoptr (i64 2147483656 to i32*), i32** %1
br label %3
3: ; preds = %3, %0
%4 = load volatile i32*, i32** %1
%5 = load i32, i32* %4
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %3, label %8
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ qreset();
void qreset_() { qreset(); }


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

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

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

LLVM IR (-O2):
define void @qreset_() {
%1 = tail call i32 (...) @qreset()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void testit(int x) {
  if (x != 20)
    abort();
}


x86 assembly (clang, -O0):
<testit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x14,-0x4(%rbp)
je     112c <testit+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testit>:
cmp    $0x14,%edi
jne    1116 <testit+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @testit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 20
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @testit(i32 %0) {
%2 = icmp eq i32 %0, 20
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
int inreg(int channel, int reg) {
  int val;
  val =
      *((volatile unsigned char *)0xBD000000 + (channel * 0x20) + (reg * 0x4));
  return val;
}


x86 assembly (clang, -O0):
<inreg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x5,%eax
movslq %eax,%rcx
mov    $0xbd000000,%eax
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inreg>:
movslq %edi,%rax
shl    $0x5,%rax
movslq %esi,%rcx
lea    (%rax,%rcx,4),%rax
mov    $0xbd000000,%ecx
movzbl (%rcx,%rax,1),%eax
ret

LLVM IR (-O0):
define i32 @inreg(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = mul nsw i32 %6, 32
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* inttoptr (i64 3170893824 to i8*), i64 %8
%10 = load i32, i32* %4
%11 = mul nsw i32 %10, 4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load volatile i8, i8* %13
%15 = zext i8 %14 to i32
store i32 %15, i32* %5
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @inreg(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 5
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* inttoptr (i64 3170893824 to i8*), i64 %4
%6 = shl nsw i32 %1, 2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load volatile i8, i8* %8
%10 = zext i8 %9 to i32
ret i32 %10
}
void gtk_ruler_get_type() {}


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

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

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

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

/* Variables and functions */
int one_if_z64(int, int);
__attribute__((always_)) int64_t calculate_dispatches(uint64_t size) {
  size <<= (3);
  size |= (one_if_z64(size, (~(0x7f))) - 1);
  return (int64_t)(size & (0x7f));
}


x86 assembly (clang, -O0):
<calculate_dispatches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xffffff80,%esi
call   1030 <one_if_z64@plt>
sub    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_dispatches>:
push   %rbx
lea    0x0(,%rdi,8),%ebx
mov    %ebx,%edi
mov    $0xffffff80,%esi
call   1030 <one_if_z64@plt>
add    $0xffffffff,%eax
or     %ebx,%eax
and    $0x7f,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @calculate_dispatches(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 3
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @one_if_z64(i32 %5, i32 -128)
%7 = sub nsw i32 %6, 1
%8 = load i32, i32* %2
%9 = or i32 %8, %7
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = and i32 %10, 127
ret i32 %11
}

LLVM IR (-O2):
define i32 @calculate_dispatches(i32 %0) {
%2 = shl i32 %0, 3
%3 = tail call i32 @one_if_z64(i32 %2, i32 -128)
%4 = add i32 %3, 127
%5 = or i32 %4, %2
%6 = and i32 %5, 127
ret i32 %6
}