xunge/DecIR huggingface dataset:
/* Type definitions */
struct string_buffer {
  int dummy;
};
struct atom {
  int dummy;
};

/* Variables and functions */
struct atom *create_atom(struct string_buffer *);
struct string_buffer *create_string_buffer();
int /*<<< orphan*/ string_buffer_append_string(struct string_buffer *, char *);
struct atom *create_atom_from_string(char *string) {
  struct string_buffer *buffer = create_string_buffer();
  string_buffer_append_string(buffer, string);
  return create_atom(buffer);
}


x86 assembly (clang, -O0):
<create_atom_from_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <create_string_buffer@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <string_buffer_append_string@plt>
mov    -0x10(%rbp),%rdi
call   1030 <create_atom@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_atom_from_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <create_string_buffer@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <string_buffer_append_string@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <create_atom@plt>

LLVM IR (-O0):
%struct.atom = type { i32 }
%struct.string_buffer = type { i32 }
define %struct.atom* @create_atom_from_string(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.string_buffer*
store i8* %0, i8** %2
%4 = call %struct.string_buffer* (...) @create_string_buffer()
store %struct.string_buffer* %4, %struct.string_buffer** %3
%5 = load %struct.string_buffer*, %struct.string_buffer** %3
%6 = load i8*, i8** %2
%7 = call i32 @string_buffer_append_string(%struct.string_buffer* %5, i8* %6)
%8 = load %struct.string_buffer*, %struct.string_buffer** %3
%9 = call %struct.atom* @create_atom(%struct.string_buffer* %8)
ret %struct.atom* %9
}

LLVM IR (-O2):
%struct.atom = type { i32 }
%struct.string_buffer = type { i32 }
define %struct.atom* @create_atom_from_string(i8* %0) {
%2 = tail call %struct.string_buffer* (...) @create_string_buffer()
%3 = tail call i32 @string_buffer_append_string(%struct.string_buffer* %2, i8* %0)
%4 = tail call %struct.atom* @create_atom(%struct.string_buffer* %2)
ret %struct.atom* %4
}
double *hadamart(double *p, double *q, double *s) {
  s[0] = q[0] * p[0];
  s[1] = q[1] * p[1];
  return s;
}


x86 assembly (clang, -O0):
<hadamart>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hadamart>:
mov    %rdx,%rax
movsd  (%rsi),%xmm0
mulsd  (%rdi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rsi),%xmm0
mulsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rdx)
ret

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

LLVM IR (-O2):
define double* @hadamart(double* nocapture %0, double* nocapture %1, double* returned writeonly %2) {
%4 = load double, double* %1
%5 = load double, double* %0
%6 = fmul double %4, %5
store double %6, double* %2
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = fmul double %8, %10
%12 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %12
ret double* %2
}
void outbyte(unsigned char c) {
  unsigned short disr;
  for (;;) {
    ((disr) = *((volatile unsigned short *)((0xfffff300 + 0x0C))));
    if (disr & 0x0002)
      break;
  }
  disr = disr & ~0x0002;
  (*((volatile unsigned char *)((0xfffff300 + 0x20))) = (c));
  (*((volatile unsigned short *)((0xfffff300 + 0x0C))) = (disr));
}


x86 assembly (clang, -O0):
<outbyte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xfffff30c,%eax
mov    (%rax),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     112b <outbyte+0x2b>
jmp    1130 <outbyte+0x30>
jmp    110a <outbyte+0xa>
movzwl -0x4(%rbp),%eax
and    $0xfffffffd,%eax
mov    %ax,-0x4(%rbp)
mov    -0x1(%rbp),%cl
mov    $0xfffff320,%eax
mov    %cl,(%rax)
mov    -0x4(%rbp),%cx
mov    $0xfffff30c,%eax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outbyte>:
mov    $0xfffff30c,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movzwl (%rax),%ecx
test   $0x2,%cl
je     1110 <outbyte+0x10>
and    $0xfffd,%ecx
mov    %dil,0x14(%rax)
mov    %cx,(%rax)
ret

LLVM IR (-O0):
define void @outbyte(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i16
store i8 %0, i8* %2
br label %4
4: ; preds = %11, %1
%5 = load volatile i16, i16* inttoptr (i64 4294963980 to i16*)
store i16 %5, i16* %3
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = and i32 %7, 2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %4
br label %12
11: ; preds = %4
br label %4
12: ; preds = %10
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = and i32 %14, -3
%16 = trunc i32 %15 to i16
store i16 %16, i16* %3
%17 = load i8, i8* %2
store volatile i8 %17, i8* inttoptr (i64 4294964000 to i8*)
%18 = load i16, i16* %3
store volatile i16 %18, i16* inttoptr (i64 4294963980 to i16*)
ret void
}

LLVM IR (-O2):
define void @outbyte(i8 zeroext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i16, i16* inttoptr (i64 4294963980 to i16*)
%4 = and i16 %3, 2
%5 = icmp eq i16 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = and i16 %3, -3
store volatile i8 %0, i8* inttoptr (i64 4294964000 to i8*)
store volatile i16 %7, i16* inttoptr (i64 4294963980 to i16*)
ret void
}
int __attribute__((weak)) _lseek(int file, int ptr, int dir) { return 0; }


x86 assembly (clang, -O0):
<_lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define weak i32 @_lseek(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define weak i32 @_lseek(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int number_of_quaddobl_factors(int *nf) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(686, nf, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<number_of_quaddobl_factors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x2ae,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_quaddobl_factors>:
mov    %rdi,%rsi
mov    $0x2ae,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @number_of_quaddobl_factors(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = load i32*, i32** %3
%8 = load double*, double** %5
%9 = call i32 @_ada_use_c2phc4c(i32 686, i32* %6, i32* %7, double* %8, i32 0)
store i32 %9, i32* %4
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
define i32 @number_of_quaddobl_factors(i32* %0) {
%2 = tail call i32 @_ada_use_c2phc4c(i32 686, i32* %0, i32* undef, double* undef, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void write_char(int fd, char ch) { write(fd, &ch, 1); }


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

x86 assembly (clang, -O2):
<write_char>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @write_char(i32 %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @write(i32 %0, i8* %3, i32 1)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t h265nalst_get_type(uint8_t start) { return (start & 0x7e) >> 1; }


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

x86 assembly (clang, -O2):
<h265nalst_get_type>:
mov    %edi,%eax
shr    %eax
and    $0x3f,%eax
ret

LLVM IR (-O0):
define i32 @h265nalst_get_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 126
%5 = ashr i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @h265nalst_get_type(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 63
ret i32 %3
}
/* Variables and functions */
double sla_epb(double *);
double csla_epb(double date) { return sla_epb(&date); }


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

x86 assembly (clang, -O2):
<csla_epb>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <sla_epb@plt>
pop    %rax
ret

LLVM IR (-O0):
define double @csla_epb(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call double @sla_epb(double* %2)
ret double %3
}

LLVM IR (-O2):
define double @csla_epb(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call double @sla_epb(double* %2)
ret double %3
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int stat(const char *path, struct stat *buf) {
  (void)path;
  (void)buf;
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<stat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec4(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @stat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i8*, i8** %3
%6 = load %struct.stat*, %struct.stat** %4
%7 = load i32, i32* @EINVAL
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @stat(i8* nocapture readnone %0, %struct.stat* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ write(int, int /*<<< orphan*/, int);
void ft_putstr(char const *str) {
  while (*str)
    write(1, str++, 1);
}


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <ft_putstr+0x3b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %eax,%esi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    111c <ft_putstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     113e <ft_putstr+0x2e>
mov    %rdi,%rbx
lea    0x1(%rdi),%r14
mov    $0x1,%edi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x1,%ebx
cmpb   $0x0,(%r14)
lea    0x1(%r14),%r14
jne    1120 <ft_putstr+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ft_putstr(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 %12
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = ptrtoint i8* %8 to i32
%11 = call i32 @write(i32 1, i32 %10, i32 1)
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @ft_putstr(i8* %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* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = ptrtoint i8* %5 to i64
%8 = trunc i64 %7 to i32
%9 = tail call i32 @write(i32 1, i32 %8, i32 1)
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
void ERR_error_string_n(void) {}


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

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

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

LLVM IR (-O2):
define void @ERR_error_string_n() {
ret void
}
/* Variables and functions */
int set_clear_promisc(int);
int set_promisc() { return set_clear_promisc(1); }


x86 assembly (clang, -O0):
<set_promisc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <set_clear_promisc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_promisc>:
mov    $0x1,%edi
jmp    1030 <set_clear_promisc@plt>

LLVM IR (-O0):
define i32 @set_promisc() {
%1 = call i32 @set_clear_promisc(i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @set_promisc() {
%1 = tail call i32 @set_clear_promisc(i32 1)
ret i32 %1
}
/* Type definitions */
struct utmpx {
  int dummy;
};

/* Variables and functions */
struct utmpx *getutxent(void) {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.utmpx = type { i32 }
define %struct.utmpx* @getutxent() {
ret %struct.utmpx* null
}

LLVM IR (-O2):
%struct.utmpx = type { i32 }
define noalias %struct.utmpx* @getutxent() {
ret %struct.utmpx* null
}
/* Variables and functions */
int zmtp_dealer_tests();
int zmtp_msg_tests();
int main(int argc, char *argv[]) {
  ((void)argc);
  ((void)argv);
  int err = 0;
  err |= zmtp_msg_tests();
  err |= zmtp_dealer_tests();
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <zmtp_msg_tests@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <zmtp_dealer_tests@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <zmtp_msg_tests@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <zmtp_dealer_tests@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
store i32 0, i32* %6
%9 = call i32 (...) @zmtp_msg_tests()
%10 = load i32, i32* %6
%11 = or i32 %10, %9
store i32 %11, i32* %6
%12 = call i32 (...) @zmtp_dealer_tests()
%13 = load i32, i32* %6
%14 = or i32 %13, %12
store i32 %14, i32* %6
%15 = load i32, i32* %6
ret i32 %15
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @zmtp_msg_tests()
%4 = tail call i32 (...) @zmtp_dealer_tests()
%5 = or i32 %4, %3
ret i32 %5
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t ROL64(uint64_t x, unsigned int r) {
  __asm__("rolq %%cl, %0" : "=r"(x) : "0"(x), "c"(r));
  return x;
}


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

x86 assembly (clang, -O2):
<ROL64>:
mov    %esi,%ecx
mov    %rdi,%rax
rol    %cl,%rax
ret

LLVM IR (-O0):
define i8* @ROL64(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i8* asm "rolq %cl, $0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i8* %5, i32 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @ROL64(i8* readnone %0, i32 %1) {
%3 = tail call i8* asm "rolq %cl, $0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ get_data();
int /*<<< orphan*/ put_data();
int main(void) {
  get_data();
  put_data();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <get_data@plt>
mov    $0x0,%al
call   1030 <put_data@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <get_data@plt>
xor    %eax,%eax
call   1030 <put_data@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @get_data()
%2 = tail call i32 (...) @put_data()
ret i32 0
}
void xx_wrapper_free(void *pointer) {}


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

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

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

LLVM IR (-O2):
define void @xx_wrapper_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
long double powl(long double, long double);
long double sinl(long double);
long double g(long double x) { return powl(x - 3.0L, 4.0L) * sinl(x); }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
flds   0xec9(%rip)
faddp  %st,%st(1)
mov    %rsp,%rax
flds   0xec2(%rip)
fstpt  0x10(%rax)
fstpt  (%rax)
call   1040 <powl@plt>
fstpt  -0x1c(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sinl@plt>
fldt   -0x1c(%rbp)
fmulp  %st,%st(1)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
sub    $0x38,%rsp
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x2c(%rsp)
fadds  0xecc(%rip)
flds   0xeca(%rip)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1040 <powl@plt>
fstpt  0x20(%rsp)
fldt   0x2c(%rsp)
fstpt  (%rsp)
call   1030 <sinl@plt>
fldt   0x20(%rsp)
fmulp  %st,%st(1)
add    $0x38,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @g(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fsub x86_fp80 %3, 0xK4000C000000000000000
%5 = call x86_fp80 @powl(x86_fp80 %4, x86_fp80 0xK40018000000000000000)
%6 = load x86_fp80, x86_fp80* %2
%7 = call x86_fp80 @sinl(x86_fp80 %6)
%8 = fmul x86_fp80 %5, %7
ret x86_fp80 %8
}

LLVM IR (-O2):
define x86_fp80 @g(x86_fp80 %0) {
%2 = fadd x86_fp80 %0, 0xKC000C000000000000000
%3 = tail call x86_fp80 @powl(x86_fp80 %2, x86_fp80 0xK40018000000000000000)
%4 = tail call x86_fp80 @sinl(x86_fp80 %0)
%5 = fmul x86_fp80 %3, %4
ret x86_fp80 %5
}
unsigned char BSP_GPIO_GetPinState(unsigned int port, unsigned int pin) {
  unsigned int temp = (unsigned int)(volatile unsigned int *)0x56000004;
  volatile unsigned int *dataReg;
  unsigned int mask = 0x00000001;
  port = port << 4;
  dataReg = (volatile unsigned int *)(temp | port);
  mask = mask << pin;
  temp = *dataReg;
  if (mask & temp) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<BSP_GPIO_GetPinState>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x56000004,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
and    -0x10(%rbp),%eax
cmp    $0x0,%eax
je     115a <BSP_GPIO_GetPinState+0x5a>
movb   $0x1,-0x1(%rbp)
jmp    115e <BSP_GPIO_GetPinState+0x5e>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_GPIO_GetPinState>:
shl    $0x4,%edi
or     $0x56000004,%rdi
mov    (%rdi),%eax
bt     %esi,%eax
setb   %al
ret

LLVM IR (-O0):
define zeroext i8 @BSP_GPIO_GetPinState(i32 %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 ptrtoint (i32* inttoptr (i64 1442840580 to i32*) to i32), i32* %6
store i32 1, i32* %8
%9 = load i32, i32* %4
%10 = shl i32 %9, 4
store i32 %10, i32* %4
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = or i32 %11, %12
%14 = zext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %7
%16 = load i32, i32* %8
%17 = load i32, i32* %5
%18 = shl i32 %16, %17
store i32 %18, i32* %8
%19 = load i32*, i32** %7
%20 = load volatile i32, i32* %19
store i32 %20, i32* %6
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = and i32 %21, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %2
store i8 1, i8* %3
br label %27
26: ; preds = %2
store i8 0, i8* %3
br label %27
27: ; preds = %26, %25
%28 = load i8, i8* %3
ret i8 %28
}

LLVM IR (-O2):
define zeroext i8 @BSP_GPIO_GetPinState(i32 %0, i32 %1) {
%3 = shl i32 %0, 4
%4 = or i32 %3, 1442840580
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = shl nuw i32 1, %1
%8 = load volatile i32, i32* %6
%9 = and i32 %8, %7
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i8
ret i8 %11
}
int isspace(int c) {
  if (c == 0x20 || c == 0x09 || c == 0x0a || c == 0x0b || c == 0x0c ||
      c == 0x0d)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     1143 <isspace+0x43>
cmpl   $0x9,-0x8(%rbp)
je     1143 <isspace+0x43>
cmpl   $0xa,-0x8(%rbp)
je     1143 <isspace+0x43>
cmpl   $0xb,-0x8(%rbp)
je     1143 <isspace+0x43>
cmpl   $0xc,-0x8(%rbp)
je     1143 <isspace+0x43>
cmpl   $0xd,-0x8(%rbp)
jne    114f <isspace+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1156 <isspace+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
mov    $0x1,%eax
lea    -0x9(%rdi),%ecx
cmp    $0x5,%ecx
jae    110e <isspace+0xe>
ret
cmp    $0x20,%edi
je     110d <isspace+0xd>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %3
i32 13, label %3
i32 12, label %3
i32 11, label %3
i32 10, label %3
i32 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int calledFunction();
main() {
  int i;
  i = calledFunction();
  return (i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <calledFunction@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @calledFunction()
ret i32 %1
}
/* Variables and functions */
int get_fib(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  printf("Which Fibonacci number would you like to know? ");
  int target;
  scanf("%d", &target);
  printf("The #%d Fibonacci number is %d\n", target, get_fib(target));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <get_fib@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1050 <get_fib@plt>
lea    0xecd(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Which Fibonacci number would you like to know? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"The #%d Fibonacci number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @get_fib(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"Which Fibonacci number would you like to know? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"The #%d Fibonacci number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @get_fib(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gdb_response_not_supported();
void gdb_cmd_restart_program(char *gdb_packet, int packet_len) {
  (void)gdb_packet;
  (void)packet_len;
  gdb_response_not_supported();
}


x86 assembly (clang, -O0):
<gdb_cmd_restart_program>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <gdb_response_not_supported@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @gdb_cmd_restart_program(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (...) @gdb_response_not_supported()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tswitch();
int do_switch() { tswitch(); }


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

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

LLVM IR (-O0):
define i32 @do_switch() {
%1 = alloca i32
%2 = call i32 (...) @tswitch()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @do_switch() {
%1 = tail call i32 (...) @tswitch()
ret i32 undef
}
int coreID(unsigned int *row, unsigned int *col) {
  *row = 1;
  *col = 1;
  return ((*row * 4) + *col);
}


x86 assembly (clang, -O0):
<coreID>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<coreID>:
movl   $0x1,(%rdi)
movl   $0x1,(%rsi)
mov    (%rdi),%eax
lea    0x1(,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @coreID(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
store i32 1, i32* %5
%6 = load i32*, i32** %4
store i32 1, i32* %6
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = mul i32 %8, 4
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = add i32 %9, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @coreID(i32* nocapture %0, i32* nocapture writeonly %1) {
store i32 1, i32* %0
store i32 1, i32* %1
%3 = load i32, i32* %0
%4 = shl i32 %3, 2
%5 = or i32 %4, 1
ret i32 %5
}
wm_fail_builtin() {}


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

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

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

LLVM IR (-O2):
define i32 @wm_fail_builtin() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
void dbp(const char *name, char *p, int ps) {
  snprintf(p, ps,
           "/var/run/mosaic/"
           "/%s.db",
           name);
}


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

x86 assembly (clang, -O2):
<dbp>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"/var/run/mosaic//%s.db\00"
define void @dbp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %6
%9 = load i8*, i8** %4
%10 = call i32 @snprintf(i8* %7, i32 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"/var/run/mosaic//%s.db\00"
define void @dbp(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ *fopen(char *, char const *);
FILE *fdopen(int fildes, const char *mode) {
  close(fildes);
  return fopen("foo", mode);
}


x86 assembly (clang, -O0):
<fdopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1040 <fopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdopen>:
push   %rbx
mov    %rsi,%rbx
call   1030 <close@plt>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <fopen@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
define i32* @fdopen(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = call i32 @close(i32 %5)
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32* %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define noalias i32* @fdopen(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @close(i32 %0)
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32* %4
}
/* Variables and functions */
int strcmp(char *, char *);
int st_compare(char **a, char **b) { return strcmp(*a, *b); }


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

x86 assembly (clang, -O2):
<st_compare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @st_compare(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 i32 @strcmp(i8* %6, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @st_compare(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ run_command(char const *);
int handle_line(void *data, const char *line) {
  run_command(line);
  return 0;
}


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

x86 assembly (clang, -O2):
<handle_line>:
push   %rax
mov    %rsi,%rdi
call   1030 <run_command@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @handle_line(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @run_command(i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void file_manager_release_sendfile(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<file_manager_release_sendfile>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @file_manager_release_sendfile(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ C_STRTOLD(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main() {
  C_STRTOLD(NULL, NULL);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <C_STRTOLD@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @C_STRTOLD(i32* null, i32* null)
ret i32 0
}
/* Variables and functions */
float randf(float, float);
float randrange(float min, float max) {
  float r = randf(min, max);
  if (r >= max) {
    return randrange(min, max);
  }
  return r;
}


x86 assembly (clang, -O0):
<randrange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <randf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     116e <randrange+0x4e>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1040 <randrange@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1178 <randrange+0x58>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randrange>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
nopl   0x0(%rax)
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1030 <randf@plt>
ucomiss (%rsp),%xmm0
jae    1120 <randrange+0x10>
pop    %rax
ret

LLVM IR (-O0):
define float @randrange(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %4
%8 = load float, float* %5
%9 = call float @randf(float %7, float %8)
store float %9, float* %6
%10 = load float, float* %6
%11 = load float, float* %5
%12 = fcmp oge float %10, %11
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load float, float* %4
%15 = load float, float* %5
%16 = call float @randrange(float %14, float %15)
store float %16, float* %3
br label %19
17: ; preds = %2
%18 = load float, float* %6
store float %18, float* %3
br label %19
19: ; preds = %17, %13
%20 = load float, float* %3
ret float %20
}

LLVM IR (-O2):
define float @randrange(float %0, float %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call float @randf(float %0, float %1)
%5 = fcmp ult float %4, %1
br i1 %5, label %6, label %3
6: ; preds = %3
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ dis_PERT(int);
int /*<<< orphan*/ dis_print_sched_ffsol(char *);
void dis_print_PERT_ffsol(char *fact_file_name) {
  dis_PERT(1);
  dis_print_sched_ffsol(fact_file_name);
}


x86 assembly (clang, -O0):
<dis_print_PERT_ffsol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <dis_PERT@plt>
mov    -0x8(%rbp),%rdi
call   1040 <dis_print_sched_ffsol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dis_print_PERT_ffsol>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
call   1030 <dis_PERT@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <dis_print_sched_ffsol@plt>

LLVM IR (-O0):
define void @dis_print_PERT_ffsol(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @dis_PERT(i32 1)
%4 = load i8*, i8** %2
%5 = call i32 @dis_print_sched_ffsol(i8* %4)
ret void
}

LLVM IR (-O2):
define void @dis_print_PERT_ffsol(i8* %0) {
%2 = tail call i32 @dis_PERT(i32 1)
%3 = tail call i32 @dis_print_sched_ffsol(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Cplusplus();
int /*<<< orphan*/ printf(char *);
int main() {
  Cplusplus();
  printf("done\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"done\00"
define i32 @main() {
%1 = tail call i32 (...) @Cplusplus()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void setpackettimeout(long datimeoutcount, long daresendagaincount) {}


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

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

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

LLVM IR (-O2):
define void @setpackettimeout(i64 %0, i64 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
main() {
  int I;
  for (I = 1; I <= 100; I++) {
    if (I % 2 == 0)
      printf("%d\n", I);
  }
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1176 <main+0x56>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1163 <main+0x43>
mov    -0x8(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
jmp    1168 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
lea    0xe87(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xed0(%rip),%r14
jmp    1148 <main+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x65,%ebx
je     1159 <main+0x39>
test   $0x1,%bl
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    1140 <main+0x20>
lea    0xea4(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 100
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %2
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %3
17: ; preds = %3
%18 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 1, %0 ], [ %8, %7 ]
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %1, %5
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 101
br i1 %9, label %10, label %1
10: ; preds = %7
%11 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int str_start(const char *s, const char *t) {
  char x;
  for (;;) {
    x = *t++;
    if (!x)
      return 1;
    if (x != *s++)
      return 0;
  }
}


x86 assembly (clang, -O0):
<str_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
cmpb   $0x0,-0x19(%rbp)
jne    1136 <str_start+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1165 <str_start+0x65>
movsbl -0x19(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1160 <str_start+0x60>
movl   $0x0,-0x4(%rbp)
jmp    1165 <str_start+0x65>
jmp    110c <str_start+0xc>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_start>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
test   %cl,%cl
je     1127 <str_start+0x27>
lea    0x1(%rax),%rdx
cmp    (%rdi,%rax,1),%cl
mov    %rdx,%rax
je     1110 <str_start+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @str_start(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %10, %8 ]
%5 = phi i8* [ %1, %2 ], [ %9, %8 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = load i8, i8* %4
%12 = icmp eq i8 %6, %11
br i1 %12, label %3, label %13
13: ; preds = %8, %3
%14 = phi i32 [ 1, %3 ], [ 0, %8 ]
ret i32 %14
}
void nseel_asm_and_op_end(void) {}


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

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

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

LLVM IR (-O2):
define void @nseel_asm_and_op_end() {
ret void
}
int test_imm_26uint8_reg(unsigned char val) {
  return ((val) & (-0x26 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_26uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffffda,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_26uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -38
%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_26uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -38
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}