xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ handle_39(int /*<<< orphan*/);
int gen_39(void) {
  handle_39(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_39>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_39@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_39() {
%1 = call i32 @handle_39(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_39() {
%1 = tail call i32 @handle_39(i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read(int, char *, int);
void callback(int fd, short events, void *arg) {
  char buf[512];
  memset(buf, 0, 512);
  read(fd, buf, sizeof(buf));
  printf("callback data:%s", buf);
}


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x200,%edx
call   1050 <read@plt>
lea    -0x210(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callback>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x200,%edx
call   1050 <read@plt>
lea    0xe9c(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"callback data:%s\00"
define void @callback(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
%7 = alloca [512 x i8]
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 512)
%10 = load i32, i32* %4
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%12 = call i32 @read(i32 %10, i8* %11, i32 512)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"callback data:%s\00"
define void @callback(i32 %0, i16 signext %1, i8* nocapture readnone %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 512)
%7 = call i32 @read(i32 %0, i8* %5, i32 512)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t io_reader(uint8_t addr) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @io_reader(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ system(char *);
int main() {
  chdir("/mnt/browser/usb/lolcode");
  system("sh install.sh");
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"/mnt/browser/usb/lolcode\00"
@.str.1 = [14 x i8] c"sh install.sh\00"
define i32 @main() {
%1 = call i32 @chdir(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"/mnt/browser/usb/lolcode\00"
@.str.1 = [14 x i8] c"sh install.sh\00"
define i32 @main() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int test_imm_A9uint8_mem(unsigned char *val) {
  return ((*val) & (0xA9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_A9uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -87
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ winch(int /*<<< orphan*/ *);
uint32_t __darwin_winch(WINDOW *w) { return winch(w); }


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

x86 assembly (clang, -O2):
<__darwin_winch>:
jmp    1030 <winch@plt>

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

LLVM IR (-O2):
define i32 @__darwin_winch(i32* %0) {
%2 = tail call i32 @winch(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void memoryError() {
  printf("prcNetwork: Out of memory.");
  exit(-1);
}


x86 assembly (clang, -O0):
<memoryError>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<memoryError>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"prcNetwork: Out of memory.\00"
define void @memoryError() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"prcNetwork: Out of memory.\00"
define void @memoryError() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
void _M2_GC_finish(__attribute__((unused)) int argc,
                   __attribute__((unused)) char *argv[]) {}


x86 assembly (clang, -O0):
<_M2_GC_finish>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @_M2_GC_finish(i32 %0, i8** nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ v;
typedef int /*<<< orphan*/ intmax_t;

/* Variables and functions */
int /*<<< orphan*/ arc4random_buf(int /*<<< orphan*/ *, int);
intmax_t rndnum(void) {
  intmax_t v;
  arc4random_buf(&v, sizeof(v));
  return (v);
}


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

x86 assembly (clang, -O2):
<rndnum>:
push   %rax
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <arc4random_buf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rndnum() {
%1 = alloca i32
%2 = call i32 @arc4random_buf(i32* %1, i32 4)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @rndnum() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @arc4random_buf(i32* %1, i32 4)
%4 = load i32, i32* %1
ret i32 %4
}
void v9fs_fscache_invalidate_page(struct page *page) {}


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

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

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

LLVM IR (-O2):
%struct.page = type opaque
define void @v9fs_fscache_invalidate_page(%struct.page* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
unsigned int smoothstep_int(unsigned int a, unsigned int b, unsigned int x) {
  uint64_t xs = x;
  xs = xs * xs * ((3 * (128ul)) - 2 * xs);
  uint64_t i =
      ((uint64_t)a * (((128ul) * (128ul) * (128ul)) - xs)) + ((uint64_t)b * xs);
  i /= ((128ul) * (128ul) * (128ul));
  return i;
}


x86 assembly (clang, -O0):
<smoothstep_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rdx
mov    $0x180,%ecx
sub    %rdx,%rcx
imul   %rcx,%rax
mov    %eax,-0x10(%rbp)
movslq -0x4(%rbp),%rax
movslq -0x10(%rbp),%rdx
mov    $0x200000,%ecx
sub    %rdx,%rcx
imul   %rcx,%rax
mov    -0x8(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shr    $0x15,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smoothstep_int>:
mov    %edx,%ecx
imul   %edx,%ecx
add    %edx,%edx
mov    $0x180,%eax
sub    %edx,%eax
imul   %ecx,%eax
mov    $0x200000,%ecx
sub    %eax,%ecx
imul   %edi,%ecx
imul   %esi,%eax
add    %ecx,%eax
sar    $0x15,%eax
ret

LLVM IR (-O0):
define i32 @smoothstep_int(i32 %0, i32 %1, i32 %2) {
%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 %2, i32* %6
%9 = load i32, i32* %6
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = load i32, i32* %7
%12 = mul nsw i32 %10, %11
%13 = sext i32 %12 to i64
%14 = load i32, i32* %7
%15 = mul nsw i32 2, %14
%16 = sext i32 %15 to i64
%17 = sub i64 384, %16
%18 = mul i64 %13, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %7
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = sub i64 2097152, %23
%25 = mul i64 %21, %24
%26 = load i32, i32* %5
%27 = load i32, i32* %7
%28 = mul nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = add i64 %25, %29
%31 = trunc i64 %30 to i32
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = udiv i64 %33, 2097152
%35 = trunc i64 %34 to i32
store i32 %35, i32* %8
%36 = load i32, i32* %8
ret i32 %36
}

LLVM IR (-O2):
define i32 @smoothstep_int(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %2
%5 = mul i32 %2, -2
%6 = add i32 %5, 384
%7 = mul i32 %4, %6
%8 = sub i32 2097152, %7
%9 = mul i32 %8, %0
%10 = mul nsw i32 %7, %1
%11 = add i32 %9, %10
%12 = ashr i32 %11, 21
ret i32 %12
}
int cmp(const void *a, const void *b) {
  int f = *(int *)a;
  int s = *(int *)b;
  if (f < s)
    return -1;
  else if (f == s)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <cmp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <cmp+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <cmp+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <cmp+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
void f(int size) {
  char *ia5_string = malloc(size);
  for (int i = 0; i <= size; i++)
    ia5_string[i] = 0;
  free(ia5_string);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1164 <f+0x44>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <f+0x1e>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
js     1151 <f+0x21>
mov    %ebp,%edx
add    $0x1,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp slt i32 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = zext i32 %0 to i64
%6 = add nuw nsw i64 %5, 1
br label %7
7: ; preds = %4, %1
%8 = tail call i32 @free(i8* %2)
ret void
}
double AUX1bp0b(double x) {
  return 1.0 - x * x / 6.0 * (1.0 - 7.0 * x * x / 60.0);
}


x86 assembly (clang, -O0):
<AUX1bp0b>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xefd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xee9(%rip),%xmm2
mulsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
movsd  0xecf(%rip),%xmm1
divsd  %xmm1,%xmm2
movsd  0xebb(%rip),%xmm1
subsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe94(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<AUX1bp0b>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xef0(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm0
divsd  0xee8(%rip),%xmm0
movsd  0xee8(%rip),%xmm2
addsd  %xmm2,%xmm0
divsd  0xee4(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @AUX1bp0b(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = fdiv double %5, 6.000000e+00
%7 = load double, double* %2
%8 = fmul double 7.000000e+00, %7
%9 = load double, double* %2
%10 = fmul double %8, %9
%11 = fdiv double %10, 6.000000e+01
%12 = fsub double 1.000000e+00, %11
%13 = fneg double %6
%14 = call double @llvm.fmuladd.f64(double %13, double %12, double 1.000000e+00)
ret double %14
}

LLVM IR (-O2):
define double @AUX1bp0b(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %0, 7.000000e+00
%4 = fmul double %3, %0
%5 = fdiv double %4, 6.000000e+01
%6 = fsub double 1.000000e+00, %5
%7 = fdiv double %2, -6.000000e+00
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double 1.000000e+00)
ret double %8
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int volatile);
int main() {
  volatile uint8_t a = 0, b = 1, c = 0;
  b = a ^ 4;
  c = b + 1;
  printf("%d\n", b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x1,0xc(%rsp)
movl   $0x0,0x10(%rsp)
mov    0x14(%rsp),%eax
xor    $0x4,%eax
mov    %eax,0xc(%rsp)
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp)
mov    0xc(%rsp),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store volatile i32 1, i32* %2
%6 = bitcast i32* %3 to i8*
store volatile i32 0, i32* %3
%7 = load volatile i32, i32* %1
%8 = xor i32 %7, 4
store volatile i32 %8, i32* %2
%9 = load volatile i32, i32* %2
%10 = add nsw i32 %9, 1
store volatile i32 %10, i32* %3
%11 = load volatile i32, i32* %2
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, double *);
double prompt_minimum_speed(void) {
  double value = 0.0;
  printf("Minimum Speed (RPM) of the Gearbox? ");
  scanf("%lf", &value);
  return value;
}


x86 assembly (clang, -O0):
<prompt_minimum_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_minimum_speed>:
push   %rax
movq   $0x0,(%rsp)
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Minimum Speed (RPM) of the Gearbox? \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @prompt_minimum_speed() {
%1 = alloca double
store double 0.000000e+00, double* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%4 = load double, double* %1
ret double %4
}

LLVM IR (-O2):
@.str = [37 x i8] c"Minimum Speed (RPM) of the Gearbox? \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @prompt_minimum_speed() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
void wait_for_user() {
  char buf[8];
  read(0, buf, 1);
}


x86 assembly (clang, -O0):
<wait_for_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_user>:
push   %rax
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @wait_for_user() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 1)
ret void
}

LLVM IR (-O2):
define void @wait_for_user() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 1)
ret void
}
int ft_isspace(char c) {
  if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     113e <ft_isspace+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     113e <ft_isspace+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     113e <ft_isspace+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0xd,%eax
jne    114a <ft_isspace+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <ft_isspace+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isspace>:
cmp    $0x20,%dil
ja     1120 <ft_isspace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100002600,%rdx
bt     %rcx,%rdx
jae    1120 <ft_isspace+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_isspace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 13, label %3
i8 10, label %3
i8 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ FalsePosition(double, double);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void TestFalsePosition() {
  printf("Test False Position: a=2.0, b=1000.0; root = %lf\n",
         FalsePosition(2.0, 1000.0));
}


x86 assembly (clang, -O0):
<TestFalsePosition>:
push   %rbp
mov    %rsp,%rbp
movsd  0xed4(%rip),%xmm0
movsd  0xed4(%rip),%xmm1
call   1040 <FalsePosition@plt>
mov    %eax,%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestFalsePosition>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
call   1040 <FalsePosition@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Test False Position: a=2.0, b=1000.0; root = %lf\0A\00"
define void @TestFalsePosition() {
%1 = call i32 @FalsePosition(double 2.000000e+00, double 1.000000e+03)
%2 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Test False Position: a=2.0, b=1000.0; root = %lf\0A\00"
define void @TestFalsePosition() {
%1 = tail call i32 @FalsePosition(double 2.000000e+00, double 1.000000e+03)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int fsfr_base_llistxattr(char const *, char *, size_t);
int fsfr_filter_xattr(char *, int);
ssize_t llistxattr(const char *path, char *list, size_t size) {
  int rtn = fsfr_base_llistxattr(path, list, size);
  if (rtn > 0)
    return fsfr_filter_xattr(list, rtn);
  return rtn;
}


x86 assembly (clang, -O0):
<llistxattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <fsfr_base_llistxattr@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1166 <llistxattr+0x46>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <fsfr_filter_xattr@plt>
mov    %eax,-0x4(%rbp)
jmp    116c <llistxattr+0x4c>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llistxattr>:
push   %rbx
mov    %rsi,%rbx
call   1040 <fsfr_base_llistxattr@plt>
test   %eax,%eax
jle    1138 <llistxattr+0x18>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <fsfr_filter_xattr@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @llistxattr(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @fsfr_base_llistxattr(i8* %0, i8* %1, i64 %2)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @fsfr_filter_xattr(i8* %1, i32 %4)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ %4, %3 ]
ret i32 %9
}
int test_imm_44uint16_mem(unsigned short *val) {
  return ((*val) & (0x44 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_44uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 68
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int isLeapYear(int year) {
  assert(year > 0);
  if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1154 <isLeapYear+0x44>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1168 <isLeapYear+0x58>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1174 <isLeapYear+0x64>
movl   $0x1,-0x4(%rbp)
jmp    117b <isLeapYear+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeapYear>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1030 <assert@plt>
test   $0x3,%bl
sete   %al
imul   $0xc28f5c29,%ebx,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
cmp    $0x28f5c29,%edx
setae  %dl
and    %al,%dl
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %al
or     %dl,%al
movzbl %al,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isLeapYear(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* %3
%9 = srem i32 %8, 4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i32, i32* %3
%13 = srem i32 %12, 100
%14 = icmp ne i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %11, %1
%16 = load i32, i32* %3
%17 = srem i32 %16, 400
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15, %11
store i32 1, i32* %2
br label %21
20: ; preds = %15
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = and i32 %0, 3
%6 = icmp eq i32 %5, 0
%7 = srem i32 %0, 100
%8 = icmp ne i32 %7, 0
%9 = and i1 %6, %8
%10 = srem i32 %0, 400
%11 = icmp eq i32 %10, 0
%12 = or i1 %11, %9
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE;
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main(void) { return !setlocale(LC_CTYPE, ""); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <setlocale@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <setlocale@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@LC_CTYPE = global i32 0
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @LC_CTYPE
%3 = call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@LC_CTYPE = global i32 0
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = load i32, i32* @LC_CTYPE
%2 = tail call i32 @setlocale(i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(int /*<<< orphan*/);
int /*<<< orphan*/ g();
main() {
  int x;
  f(g());
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <g@plt>
mov    %eax,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <g@plt>
mov    %eax,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @g()
%4 = call i32 @f(i32 %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @g()
%2 = tail call i32 @f(i32 %1)
%3 = tail call i32 @exit(i32 0)
unreachable
}
int g(a)
int a;
{ return a * 2; }


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

x86 assembly (clang, -O2):
<g>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int unmthread_yield();
int main(void) {
  int i = 0;
  i = unmthread_yield();
  printf("blah");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <unmthread_yield@plt>
mov    %eax,-0x8(%rbp)
lea    0xeb9(%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 <unmthread_yield@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"blah\00"
define i32 @main() {
%1 = tail call i32 (...) @unmthread_yield()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Done(int /*<<< orphan*/);
void SigIntCaught() { Done(0); }


x86 assembly (clang, -O0):
<SigIntCaught>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <Done@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SigIntCaught>:
xor    %edi,%edi
jmp    1030 <Done@plt>

LLVM IR (-O0):
define void @SigIntCaught() {
%1 = call i32 @Done(i32 0)
ret void
}

LLVM IR (-O2):
define void @SigIntCaught() {
%1 = tail call i32 @Done(i32 0)
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ procspeed;

/* Variables and functions */
int sysctlbyname(char *, int *, size_t *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/);
uint32_t get_procspeed(void) {
  size_t len;
  uint64_t procspeed;
  int retcode;
  len = sizeof(procspeed);
  retcode = sysctlbyname("hw.cpufrequency", &procspeed, &len, NULL, 0);
  if (retcode == -1) {
    return 0;
  }
  procspeed /= 1000000;
  return (uint32_t)procspeed;
}


x86 assembly (clang, -O0):
<get_procspeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x4,-0x10(%rbp)
lea    0xed9(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
call   1030 <sysctlbyname@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1154 <get_procspeed+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1168 <get_procspeed+0x58>
mov    -0x14(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_procspeed>:
push   %rbx
sub    $0x10,%rsp
movq   $0x4,0x8(%rsp)
lea    0xedb(%rip),%rdi
xor    %ebx,%ebx
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <sysctlbyname@plt>
cmp    $0xffffffff,%eax
je     1159 <get_procspeed+0x49>
movslq 0x4(%rsp),%rax
imul   $0x431bde83,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x32,%rbx
add    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"hw.cpufrequency\00"
define i32 @get_procspeed() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i64 4, i64* %1
%5 = call i32 @sysctlbyname(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %2, i64* %1, i32* null, i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 1000000
br label %10
10: ; preds = %0, %7
%11 = phi i32 [ %9, %7 ], [ 0, %0 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ status;

/* Variables and functions */
int FtdiWriteReg(int, int, int /*<<< orphan*/ *);
int WriteTpmSts(uint32_t status) {
  return FtdiWriteReg(0x18, sizeof(status), &status);
}


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

x86 assembly (clang, -O2):
<WriteTpmSts>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x18,%edi
mov    $0x4,%esi
call   1030 <FtdiWriteReg@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @WriteTpmSts(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @FtdiWriteReg(i32 24, i32 4, i32* %2)
ret i32 %3
}
/* Variables and functions */
unsigned int cap1166_get_polarity();
int led_get_polarity(int i) {
  unsigned int l;
  l = cap1166_get_polarity();
  l &= (1 << i);
  if (l == 0) {
    return 0;
  } else {
    return 1;
  };
}


x86 assembly (clang, -O0):
<led_get_polarity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <cap1166_get_polarity@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114b <led_get_polarity+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1152 <led_get_polarity+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_get_polarity>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <cap1166_get_polarity@plt>
mov    %ebx,%ecx
shr    %cl,%eax
and    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @led_get_polarity(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 (...) @cap1166_get_polarity()
store i32 %5, i32* %4
%6 = load i32, i32* %3
%7 = shl i32 1, %6
%8 = load i32, i32* %4
%9 = and i32 %8, %7
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 0, i32* %2
br label %14
13: ; preds = %1
store i32 1, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @led_get_polarity(i32 %0) {
%2 = tail call i32 (...) @cap1166_get_polarity()
%3 = lshr i32 %2, %0
%4 = and i32 %3, 1
ret i32 %4
}
void RTStrToUniEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrToUniEx() {
ret void
}
void RTLockValidatorIsBlockedThreadInValidator(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLockValidatorIsBlockedThreadInValidator() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage() {
  fprintf(stderr, "Usage:\n");
  fprintf(
      stderr,
      "perlgen <size_t w> <size_t h> <float gain> <int octaves> <int hgrid>\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed9(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [70 x i8] c"perlgen <size_t w> <size_t h> <float gain> <int octaves> <int hgrid>\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [70 x i8] c"perlgen <size_t w> <size_t h> <float gain> <int octaves> <int hgrid>\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ res_(int, long *);
void clock_readres_processtime(long *t) { res_(15, t); }


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

x86 assembly (clang, -O2):
<clock_readres_processtime>:
mov    %rdi,%rsi
mov    $0xf,%edi
jmp    1030 <res_@plt>

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

LLVM IR (-O2):
define void @clock_readres_processtime(i64* %0) {
%2 = tail call i32 @res_(i32 15, i64* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
void main() {
  int a, b;
  printf("input:");
  scanf("%d%d", &a, &b);
  printf("%d-%d\n", a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"input:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [7 x i8] c"%d-%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"input:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [7 x i8] c"%d-%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int);
int /*<<< orphan*/ output_byte(int);
void emit_fdiv(int r) {
  assem_debug("fdiv st%d", r);
  output_byte(0xd8);
  output_byte(0xf0 + r);
}


x86 assembly (clang, -O0):
<emit_fdiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd8,%edi
call   1040 <output_byte@plt>
mov    -0x4(%rbp),%edi
add    $0xf0,%edi
call   1040 <output_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fdiv>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <assem_debug@plt>
mov    $0xd8,%edi
call   1040 <output_byte@plt>
add    $0xf0,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"fdiv st%d\00"
define void @emit_fdiv(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @output_byte(i32 216)
%6 = load i32, i32* %2
%7 = add nsw i32 240, %6
%8 = call i32 @output_byte(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"fdiv st%d\00"
define void @emit_fdiv(i32 %0) {
%2 = tail call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @output_byte(i32 216)
%4 = add nsw i32 %0, 240
%5 = tail call i32 @output_byte(i32 %4)
ret void
}