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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int logger_flush_file(struct Logger *);
int logger_destroy_file(struct Logger *logger) {
  assert(logger != NULL);
  return logger_flush_file(logger);
}


x86 assembly (clang, -O0):
<logger_destroy_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <logger_flush_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_destroy_file>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <logger_flush_file@plt>

LLVM IR (-O0):
%struct.Logger = type { i32 }
define i32 @logger_destroy_file(%struct.Logger* %0) {
%2 = alloca %struct.Logger*
store %struct.Logger* %0, %struct.Logger** %2
%3 = load %struct.Logger*, %struct.Logger** %2
%4 = icmp ne %struct.Logger* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load %struct.Logger*, %struct.Logger** %2
%8 = call i32 @logger_flush_file(%struct.Logger* %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.Logger = type { i32 }
define i32 @logger_destroy_file(%struct.Logger* %0) {
%2 = icmp ne %struct.Logger* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @logger_flush_file(%struct.Logger* %0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ mytest();
int main() {
  mytest();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @mytest()
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t EMACTimestampConfigGet(uint32_t ui32Base,
                                uint32_t *pui32SubSecondInc) {
  ;
  ;
  *pui32SubSecondInc =
      ((*((volatile uint32_t *)(ui32Base + 0x00000704))) & 0x000000FF) >> 0;
  return ((*((volatile uint32_t *)(ui32Base + 0x00000700))));
}


x86 assembly (clang, -O0):
<EMACTimestampConfigGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x704,%eax
cltq
mov    (%rax),%ecx
and    $0xff,%ecx
sar    $0x0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTimestampConfigGet>:
movslq %edi,%rax
mov    0x704(%rax),%ecx
movzbl %cl,%ecx
mov    %ecx,(%rsi)
mov    0x700(%rax),%eax
ret

LLVM IR (-O0):
define i32 @EMACTimestampConfigGet(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
%6 = add nsw i32 %5, 1796
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, 255
%11 = ashr i32 %10, 0
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1792
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @EMACTimestampConfigGet(i32 %0, i32* nocapture writeonly %1) {
%3 = add nsw i32 %0, 1796
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, 255
store i32 %7, i32* %1
%8 = add nsw i32 %0, 1792
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void fnDispArray(int iaArr[], int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("\t%d", iaArr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<fnDispArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <fnDispArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <fnDispArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnDispArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <fnDispArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <fnDispArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"\09%d\00"
define void @fnDispArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
char keypress(int);
char portable_getch(int echo) {
  char input;
  return keypress(echo);
  return input;
}


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

x86 assembly (clang, -O2):
<portable_getch>:
jmp    1030 <keypress@plt>

LLVM IR (-O0):
define signext i8 @portable_getch(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call signext i8 @keypress(i32 %4)
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @portable_getch(i32 %0) {
%2 = tail call signext i8 @keypress(i32 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int getuser(char *buf, int nbuf) {
  memset(buf, 0, nbuf);
  gets(buf, nbuf);
  if (buf[0] == 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<getuser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <gets@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1165 <getuser+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <getuser+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getuser>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <gets@plt>
cmpb   $0x1,(%rbx)
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getuser(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
%4 = tail call i32 @gets(i8* %0, i32 %1)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
%7 = sext i1 %6 to i32
ret i32 %7
}
int g_DUMMY_popup_listbox(int win_id, char *title, char *subtitle,
                          int item_count, char *items[], int select_pos,
                          int items_visible) {
  win_id = win_id;
  title = title;
  subtitle = subtitle;
  item_count = item_count;
  items = items;
  select_pos = select_pos;
  items_visible = items_visible;
  return 0;
}


x86 assembly (clang, -O0):
<g_DUMMY_popup_listbox>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @g_DUMMY_popup_listbox(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3, i8** nocapture readnone %4, i32 %5, i32 %6) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ get1();
int get2();
int /*<<< orphan*/ printf(char *, int, int);
void eatmarker(int kind) {
  int l, c;
  l = get2();
  printf("%02x len=%d\n", kind, l);
  for (l -= 2; l > 0; l--)
    get1();
}


x86 assembly (clang, -O0):
<eatmarker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <get2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    117f <eatmarker+0x4f>
mov    $0x0,%al
call   1050 <get1@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <eatmarker+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eatmarker>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <get2@plt>
mov    %eax,%ebx
lea    0xebb(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <printf@plt>
cmp    $0x3,%ebx
jl     116f <eatmarker+0x3f>
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <get1@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1160 <eatmarker+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%02x len=%d\0A\00"
define void @eatmarker(i32 %0) {
%2 = tail call i32 (...) @get2()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
%4 = icmp sgt i32 %2, 2
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = add nsw i32 %2, -2
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ %6, %5 ]
%9 = tail call i32 (...) @get1()
%10 = add nsw i32 %8, -1
%11 = icmp ugt i32 %8, 1
br i1 %11, label %7, label %12
12: ; preds = %7, %1
ret void
}
/* Type definitions */
struct chmcPmglChunkNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct chmcPmglChunkNode *);
int /*<<< orphan*/ free(struct chmcPmglChunkNode *);
void chmc_pmgl_destroy(struct chmcPmglChunkNode *node) {
  assert(node);
  free(node);
}


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

x86 assembly (clang, -O2):
<chmc_pmgl_destroy>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.chmcPmglChunkNode = type { i32 }
define void @chmc_pmgl_destroy(%struct.chmcPmglChunkNode* %0) {
%2 = alloca %struct.chmcPmglChunkNode*
store %struct.chmcPmglChunkNode* %0, %struct.chmcPmglChunkNode** %2
%3 = load %struct.chmcPmglChunkNode*, %struct.chmcPmglChunkNode** %2
%4 = call i32 @assert(%struct.chmcPmglChunkNode* %3)
%5 = load %struct.chmcPmglChunkNode*, %struct.chmcPmglChunkNode** %2
%6 = call i32 @free(%struct.chmcPmglChunkNode* %5)
ret void
}

LLVM IR (-O2):
%struct.chmcPmglChunkNode = type { i32 }
define void @chmc_pmgl_destroy(%struct.chmcPmglChunkNode* %0) {
%2 = tail call i32 @assert(%struct.chmcPmglChunkNode* %0)
%3 = tail call i32 @free(%struct.chmcPmglChunkNode* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ create_page_table();
int /*<<< orphan*/ mmu_enable();
void mmu_init() {
  create_page_table();
  mmu_enable();
}


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

x86 assembly (clang, -O2):
<mmu_init>:
push   %rax
xor    %eax,%eax
call   1030 <create_page_table@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <mmu_enable@plt>

LLVM IR (-O0):
define void @mmu_init() {
%1 = call i32 (...) @create_page_table()
%2 = call i32 (...) @mmu_enable()
ret void
}

LLVM IR (-O2):
define void @mmu_init() {
%1 = tail call i32 (...) @create_page_table()
%2 = tail call i32 (...) @mmu_enable()
ret void
}
long __ocl_clamp_long_long(long src, long minval, long maxval) {
  if (src < minval) {
    return minval;
  }
  if (src > maxval) {
    return maxval;
  }
  return src;
}


x86 assembly (clang, -O0):
<__ocl_clamp_long_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    112b <__ocl_clamp_long_long+0x2b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114e <__ocl_clamp_long_long+0x4e>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jle    1146 <__ocl_clamp_long_long+0x46>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114e <__ocl_clamp_long_long+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_clamp_long_long>:
mov    %rdx,%rax
cmp    %rdx,%rdi
cmovle %rdi,%rax
cmp    %rsi,%rdi
cmovl  %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @__ocl_clamp_long_long(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %0, %1
%5 = icmp sgt i64 %0, %2
%6 = select i1 %5, i64 %2, i64 %0
%7 = select i1 %4, i64 %1, i64 %6
ret i64 %7
}
/* Variables and functions */
scalar_t__ isSmallChar(char);
char getSmallChar(char c) {
  if (isSmallChar(c))
    return c;
  return c + 32;
}


x86 assembly (clang, -O0):
<getSmallChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <isSmallChar@plt>
cmp    $0x0,%rax
je     113c <getSmallChar+0x2c>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1146 <getSmallChar+0x36>
movsbl -0x2(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSmallChar>:
push   %rbx
mov    %edi,%ebx
call   1030 <isSmallChar@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmovne %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define signext i8 @getSmallChar(i8 signext %0) {
%2 = tail call i64 @isSmallChar(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void sig_usr1(int sig) {
  printf("SIGUSR1 recieved.\n");
  kill(getpid(), SIGUSR1);
  printf("SIGUSR1 ended.\n");
}


x86 assembly (clang, -O0):
<sig_usr1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_usr1>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    0x2e9d(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <kill@plt>
lea    0xeb7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"SIGUSR1 recieved.\0A\00"
@SIGUSR1 = global i32 0
@.str.1 = [16 x i8] c"SIGUSR1 ended.\0A\00"
define void @sig_usr1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getpid()
%5 = load i32, i32* @SIGUSR1
%6 = call i32 @kill(i32 %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
@str = [18 x i8] c"SIGUSR1 recieved.\00"
@str.2 = [15 x i8] c"SIGUSR1 ended.\00"
define void @sig_usr1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @getpid()
%4 = load i32, i32* @SIGUSR1
%5 = tail call i32 @kill(i32 %3, i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
long strtol(char *, char **, int);
long int ascii_to_int(char *data) {
  char *ptr;
  long ret;
  ret = strtol(data, &ptr, 16);
  return (ret);
}


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

x86 assembly (clang, -O2):
<ascii_to_int>:
push   %rax
mov    %rsp,%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i64 @ascii_to_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strtol(i8* %5, i8** %3, i32 16)
store i64 %6, i64* %4
%7 = load i64, i64* %4
ret i64 %7
}

LLVM IR (-O2):
define i64 @ascii_to_int(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 16)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ writel(int, void *);
void set__PIO_PCx__OUTPUT_PUSH_PULL(void *base, int pin) {
  writel(((0x1) & 0x1) << pin, base + (0x28 + (2) * 0x10));
  writel(((0x1) & 0x1) << pin, base + (0x24 + (1) * 0x10));
  writel(((0x1) & 0x1) << pin, base + (0x28 + (0) * 0x10));
}


x86 assembly (clang, -O0):
<set__PIO_PCx__OUTPUT_PUSH_PULL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%rsi
add    $0x48,%rsi
call   1030 <writel@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%rsi
add    $0x34,%rsi
call   1030 <writel@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%rsi
add    $0x28,%rsi
call   1030 <writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set__PIO_PCx__OUTPUT_PUSH_PULL>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ecx
mov    %rdi,%rbx
mov    $0x1,%ebp
shl    %cl,%ebp
lea    0x48(%rdi),%rsi
mov    %ebp,%edi
call   1030 <writel@plt>
lea    0x34(%rbx),%rsi
mov    %ebp,%edi
call   1030 <writel@plt>
add    $0x28,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <writel@plt>

LLVM IR (-O0):
define void @set__PIO_PCx__OUTPUT_PUSH_PULL(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = load i8*, i8** %3
%8 = getelementptr i8, i8* %7, i64 72
%9 = call i32 @writel(i32 %6, i8* %8)
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = load i8*, i8** %3
%13 = getelementptr i8, i8* %12, i64 52
%14 = call i32 @writel(i32 %11, i8* %13)
%15 = load i32, i32* %4
%16 = shl i32 1, %15
%17 = load i8*, i8** %3
%18 = getelementptr i8, i8* %17, i64 40
%19 = call i32 @writel(i32 %16, i8* %18)
ret void
}

LLVM IR (-O2):
define void @set__PIO_PCx__OUTPUT_PUSH_PULL(i8* %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = getelementptr i8, i8* %0, i64 72
%5 = tail call i32 @writel(i32 %3, i8* %4)
%6 = getelementptr i8, i8* %0, i64 52
%7 = tail call i32 @writel(i32 %3, i8* %6)
%8 = getelementptr i8, i8* %0, i64 40
%9 = tail call i32 @writel(i32 %3, i8* %8)
ret void
}
/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int rmdir(char const *const);
int our_rmdir(const char *const path) {
  do {
    const int ret = rmdir(path);
    if (ret == 0) {
      return ret;
    }
  } while (errno == EINTR);
  return -1;
}


x86 assembly (clang, -O0):
<our_rmdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <rmdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113d <our_rmdir+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1163 <our_rmdir+0x53>
jmp    1142 <our_rmdir+0x32>
mov    0x2e97(%rip),%rax
mov    (%rax),%rax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%rax
je     111c <our_rmdir+0xc>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<our_rmdir>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2ec1(%rip),%r14
mov    0x2eb2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <rmdir@plt>
test   %eax,%eax
je     114b <our_rmdir+0x3b>
mov    (%r14),%rax
cmp    (%r15),%rax
je     1130 <our_rmdir+0x20>
mov    $0xffffffff,%eax
jmp    114d <our_rmdir+0x3d>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @our_rmdir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
br label %5
5: ; preds = %13, %1
%6 = load i8*, i8** %3
%7 = call i32 @rmdir(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %18
12: ; preds = %5
br label %13
13: ; preds = %12
%14 = load i64, i64* @errno
%15 = load i64, i64* @EINTR
%16 = icmp eq i64 %14, %15
br i1 %16, label %5, label %17
17: ; preds = %13
store i32 -1, i32* %2
br label %18
18: ; preds = %17, %10
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @our_rmdir(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = tail call i32 @rmdir(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINTR
%8 = icmp eq i64 %6, %7
br i1 %8, label %2, label %9
9: ; preds = %2, %5
%10 = phi i32 [ 0, %2 ], [ -1, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char const *const, unsigned int);
void ft_putstr_fd(const char *const str, int fd) {
  unsigned int len;
  len = 0;
  while (str[len] != '\0')
    len++;
  write(fd, str, len);
}


x86 assembly (clang, -O0):
<ft_putstr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1148 <ft_putstr_fd+0x38>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <ft_putstr_fd+0x16>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr_fd>:
mov    %esi,%eax
mov    %rdi,%rsi
mov    $0xffffffff,%edx
nopw   0x0(%rax,%rax,1)
add    $0x1,%edx
cmpb   $0x0,(%rsi,%rdx,1)
jne    1120 <ft_putstr_fd+0x10>
mov    %eax,%edi
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define void @ft_putstr_fd(i8* nocapture %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %9, %3 ]
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = add i32 %4, 1
br i1 %8, label %10, label %3
10: ; preds = %3
%11 = tail call i32 @write(i32 %1, i8* %0, i32 %4)
ret void
}
/* Variables and functions */
long *malloc(int);
long *longdup(long *src) {
  long *res = malloc(sizeof(long));
  if (res)
    *res = *src;
  return res;
}


x86 assembly (clang, -O0):
<longdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1143 <longdup+0x33>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<longdup>:
push   %rbx
mov    %rdi,%rbx
mov    $0x8,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1129 <longdup+0x19>
mov    (%rbx),%rcx
mov    %rcx,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i64* @longdup(i64* nocapture %0) {
%2 = tail call i64* @malloc(i32 8)
%3 = icmp eq i64* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = load i64, i64* %0
store i64 %5, i64* %2
br label %6
6: ; preds = %4, %1
ret i64* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int main(void) {
  if (1) {
    exit(9);
  }
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @exit(i32 9)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 9)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookreal8array_(char *x, unsigned int *n) { lookNarray(x, (*n * 8)); }


x86 assembly (clang, -O0):
<lookreal8array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x3,%esi
call   1030 <lookNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookreal8array_>:
mov    (%rsi),%esi
shl    $0x3,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookreal8array_(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 = load i32, i32* %6
%8 = mul i32 %7, 8
%9 = call i32 @lookNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @lookreal8array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 3
%5 = tail call i32 @lookNarray(i8* %0, i32 %4)
ret void
}
__attribute__((always_)) unsigned long __ffs(unsigned long word) {
  return __builtin_ctzl(word);
}


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

x86 assembly (clang, -O2):
<__ffs>:
bsf    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @__ffs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @llvm.cttz.i64(i64 %3, i1 true)
%5 = trunc i64 %4 to i32
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @__ffs(i64 %0) {
%2 = tail call i64 @llvm.cttz.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ dot(double const *, double const *);
double sqrt(int /*<<< orphan*/);
double norm(const double *v) { return sqrt(dot(v, v)); }


x86 assembly (clang, -O0):
<norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <dot@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm>:
push   %rax
mov    %rdi,%rsi
call   1030 <dot@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @norm(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double*, double** %2
%5 = call i32 @dot(double* %3, double* %4)
%6 = call double @sqrt(i32 %5)
ret double %6
}

LLVM IR (-O2):
define double @norm(double* %0) {
%2 = tail call i32 @dot(double* %0, double* %0)
%3 = tail call double @sqrt(i32 %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ MyCalDistance(double, double, double, double, double,
                                 double *, double *);
double CalculateLength_GreatCircle(double lng1, double lat1, double lng2,
                                   double lat2) {
  double dbAzimuth = 0, dbDistance = 0, dbAngleDiff = 0;
  MyCalDistance(lat1, lng1, lat2, lng2, dbAngleDiff, &dbDistance, &dbAzimuth);
  return dbDistance;
}


x86 assembly (clang, -O0):
<CalculateLength_GreatCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
lea    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <MyCalDistance@plt>
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateLength_GreatCircle>:
sub    $0x18,%rsp
movaps %xmm2,%xmm5
movaps %xmm0,%xmm2
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
xorps  %xmm4,%xmm4
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
movaps %xmm5,%xmm3
call   1030 <MyCalDistance@plt>
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @CalculateLength_GreatCircle(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %11
%12 = load double, double* %6
%13 = load double, double* %5
%14 = load double, double* %8
%15 = load double, double* %7
%16 = load double, double* %11
%17 = call i32 @MyCalDistance(double %12, double %13, double %14, double %15, double %16, double* %10, double* %9)
%18 = load double, double* %10
ret double %18
}

LLVM IR (-O2):
define double @CalculateLength_GreatCircle(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%8 = bitcast double* %6 to i8*
store double 0.000000e+00, double* %6
%9 = call i32 @MyCalDistance(double %1, double %0, double %3, double %2, double 0.000000e+00, double* %6, double* %5)
%10 = load double, double* %6
ret double %10
}
int led_util_roundup(int val, int range) {
  int extra = val % range;
  if (extra)
    extra = range - extra;
  return val + extra;
}


x86 assembly (clang, -O0):
<led_util_roundup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1127 <led_util_roundup+0x27>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_util_roundup>:
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%esi
test   %edx,%edx
cmove  %edx,%esi
lea    (%rsi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @led_util_roundup(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
%5 = sub nsw i32 %1, %3
%6 = select i1 %4, i32 0, i32 %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ref(uint32_t a) {
  return (a + 128) / 255;
  return (a + (65535 / 2)) / 65535;
}


x86 assembly (clang, -O0):
<ref>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%eax
mov    $0xff,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ref>:
mov    %edi,%eax
sub    $0xffffff80,%eax
cltq
imul   $0xffffffff80808081,%rax,%rax
shr    $0x20,%rax
add    %edi,%eax
add    $0x80,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x7,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ref(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 128
%5 = sdiv i32 %4, 255
ret i32 %5
}

LLVM IR (-O2):
define i32 @ref(i32 %0) {
%2 = add nsw i32 %0, 128
%3 = sdiv i32 %2, 255
ret i32 %3
}
/* Variables and functions */
scalar_t__ round(double);
int count_values(double min, double max, double step) {
  return (int)round((max - min) / step) + 1;
}


x86 assembly (clang, -O0):
<count_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <round@plt>
add    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_values>:
push   %rax
subsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
call   1030 <round@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @count_values(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 = load double, double* %4
%9 = fsub double %7, %8
%10 = load double, double* %6
%11 = fdiv double %9, %10
%12 = call i64 @round(double %11)
%13 = trunc i64 %12 to i32
%14 = add nsw i32 %13, 1
ret i32 %14
}

LLVM IR (-O2):
define i32 @count_values(double %0, double %1, double %2) {
%4 = fsub double %1, %0
%5 = fdiv double %4, %2
%6 = tail call i64 @round(double %5)
%7 = trunc i64 %6 to i32
%8 = add nsw i32 %7, 1
ret i32 %8
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;

/* Variables and functions */
void threefish_mix(void *data, uint8_t rot) {
  uint64_t x;
  x = (((uint64_t *)data)[1]);
  (((uint64_t *)data)[0]) += x;
  (((uint64_t *)data)[1]) =
      ((x << rot) | (x >> (64 - rot))) ^ (((uint64_t *)data)[0]);
}


x86 assembly (clang, -O0):
<threefish_mix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x40,%ecx
sub    -0xc(%rbp),%ecx
sar    %cl,%eax
mov    -0x14(%rbp),%ecx
or     %eax,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<threefish_mix>:
mov    %esi,%ecx
mov    0x4(%rdi),%eax
mov    (%rdi),%edx
add    %eax,%edx
mov    %eax,%esi
shl    %cl,%esi
neg    %cl
sar    %cl,%eax
mov    %edx,(%rdi)
or     %esi,%eax
xor    %edx,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @threefish_mix(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = add nsw i32 %14, %10
store i32 %15, i32* %13
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = shl i32 %16, %17
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = sub nsw i32 64, %20
%22 = ashr i32 %19, %21
%23 = or i32 %18, %22
%24 = load i8*, i8** %3
%25 = bitcast i8* %24 to i32*
%26 = getelementptr inbounds i32, i32* %25, i64 0
%27 = load i32, i32* %26
%28 = xor i32 %23, %27
%29 = load i8*, i8** %3
%30 = bitcast i8* %29 to i32*
%31 = getelementptr inbounds i32, i32* %30, i64 1
store i32 %28, i32* %31
ret void
}

LLVM IR (-O2):
define void @threefish_mix(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = load i32, i32* %3
%8 = add nsw i32 %7, %6
store i32 %8, i32* %3
%9 = shl i32 %6, %1
%10 = sub nsw i32 64, %1
%11 = ashr i32 %6, %10
%12 = or i32 %9, %11
%13 = xor i32 %12, %8
store i32 %13, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void anstrcpy(char *a, char *b) { strcpy(a, b); }


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

x86 assembly (clang, -O2):
<anstrcpy>:
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
define void @anstrcpy(i8* %0, i8* %1) {
%3 = tail call i32 @strcpy(i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int f239(int *);
int f240(int *p) { return f239(p); }


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

x86 assembly (clang, -O2):
<f240>:
jmp    1030 <f239@plt>

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

LLVM IR (-O2):
define i32 @f240(i32* %0) {
%2 = tail call i32 @f239(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ swStart();
void playStarWars() { swStart(); }


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

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

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

LLVM IR (-O2):
define void @playStarWars() {
%1 = tail call i32 (...) @swStart()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ B(int, int);
void A(int tmp) {
  int x = 0;
  if (tmp < 2)
    B(1, 2);
}


x86 assembly (clang, -O0):
<A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    113b <A+0x2b>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <B@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<A>:
cmp    $0x1,%edi
jg     1124 <A+0x14>
mov    $0x1,%edi
mov    $0x2,%esi
jmp    1030 <B@plt>
ret

LLVM IR (-O0):
define void @A(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @B(i32 1, i32 2)
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @A(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @B(i32 1, i32 2)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tk_fat_init();
int /*<<< orphan*/ tk_ird_init();
int tk_vfile_init() {
  static int init = 0;
  if (init)
    return (0);
  init = 1;
  tk_ird_init();
  tk_fat_init();
  return (1);
}


x86 assembly (clang, -O0):
<tk_vfile_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f05(%rip)
je     1141 <tk_vfile_init+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1160 <tk_vfile_init+0x40>
movl   $0x1,0x2ee9(%rip)
mov    $0x0,%al
call   1030 <tk_ird_init@plt>
mov    $0x0,%al
call   1040 <tk_fat_init@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tk_vfile_init>:
push   %rax
xor    %eax,%eax
cmpb   $0x0,0x2f0a(%rip)
jne    1146 <tk_vfile_init+0x26>
movb   $0x1,0x2f01(%rip)
xor    %eax,%eax
call   1030 <tk_ird_init@plt>
xor    %eax,%eax
call   1040 <tk_fat_init@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@tk_vfile_init.init = internal global i32 0
define i32 @tk_vfile_init() {
%1 = alloca i32
%2 = load i32, i32* @tk_vfile_init.init
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 0, i32* %1
br label %8
5: ; preds = %0
store i32 1, i32* @tk_vfile_init.init
%6 = call i32 (...) @tk_ird_init()
%7 = call i32 (...) @tk_fat_init()
store i32 1, i32* %1
br label %8
8: ; preds = %5, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@tk_vfile_init.init = internal unnamed_addr global i1 false
define i32 @tk_vfile_init() {
%1 = load i1, i1* @tk_vfile_init.init
br i1 %1, label %5, label %2
2: ; preds = %0
store i1 true, i1* @tk_vfile_init.init
%3 = tail call i32 (...) @tk_ird_init()
%4 = tail call i32 (...) @tk_fat_init()
br label %5
5: ; preds = %0, %2
%6 = phi i32 [ 1, %2 ], [ 0, %0 ]
ret i32 %6
}
int abs_int(int a) { return a < 0 ? -a : a; }


x86 assembly (clang, -O0):
<abs_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs_int+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs_int+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs_int(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
void test_crc(int start) {}


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

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

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

LLVM IR (-O2):
define void @test_crc(i32 %0) {
ret void
}
int lock_component_take() {}


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

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

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

LLVM IR (-O2):
define i32 @lock_component_take() {
ret i32 undef
}