xunge/DecIR huggingface dataset:
void *KwmCreateContext(int Id) {
  int *IdContext = (int *)malloc(sizeof(Id));
  *IdContext = Id;
  return IdContext;
}


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

x86 assembly (clang, -O2):
<KwmCreateContext>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @KwmCreateContext(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i8* @malloc(i64 4)
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32, i32* %2
%7 = load i32*, i32** %3
store i32 %6, i32* %7
%8 = load i32*, i32** %3
%9 = bitcast i32* %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define noalias i8* @KwmCreateContext(i32 %0) {
%2 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%3 = bitcast i8* %2 to i32*
store i32 %0, i32* %3
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void PrintHeader() {
  printf("oclpc OpenCL Precompiler Copyright 2014 Celtoys Ltd\n");
  printf("Licensed under the Apache License, Version 2.0 \n");
}


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

x86 assembly (clang, -O2):
<PrintHeader>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"oclpc OpenCL Precompiler Copyright 2014 Celtoys Ltd\0A\00"
@.str.1 = [49 x i8] c"Licensed under the Apache License, Version 2.0 \0A\00"
define void @PrintHeader() {
%1 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [52 x i8] c"oclpc OpenCL Precompiler Copyright 2014 Celtoys Ltd\00"
@str.2 = [48 x i8] c"Licensed under the Apache License, Version 2.0 \00"
define void @PrintHeader() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(int);
pthread_mutex_t *doMalloc() { return malloc(sizeof(pthread_mutex_t)); }


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

x86 assembly (clang, -O2):
<doMalloc>:
mov    $0x4,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @doMalloc() {
%1 = call i32* @malloc(i32 4)
ret i32* %1
}

LLVM IR (-O2):
define noalias i32* @doMalloc() {
%1 = tail call i32* @malloc(i32 4)
ret i32* %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *gtk_type_check_object_cast(void *object, void *cast_type) {
  if (!object)
    exit(0);
  return object;
}


x86 assembly (clang, -O0):
<gtk_type_check_object_cast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1132 <gtk_type_check_object_cast+0x22>
xor    %edi,%edi
call   1030 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtk_type_check_object_cast>:
test   %rdi,%rdi
je     1119 <gtk_type_check_object_cast+0x9>
mov    %rdi,%rax
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i8* @gtk_type_check_object_cast(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 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define i8* @gtk_type_check_object_cast(i8* readnone returned %0, i8* nocapture readnone %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test_ok(void *setup_ctxt) {
  printf("  (c) test_ok\n");
  return 1;
}


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

x86 assembly (clang, -O2):
<test_ok>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [14 x i8] c" (c) test_ok\00"
define i32 @test_ok(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 1
}
void freeMatrix(float **matrix, char rows, char cols) {
  char i = 0;
  for (i = 0; i < rows; i++) {
    free(matrix[i]);
  }
  free(matrix);
}


x86 assembly (clang, -O0):
<freeMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movb   $0x0,-0xb(%rbp)
movb   $0x0,-0xb(%rbp)
movsbl -0xb(%rbp),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jge    115e <freeMatrix+0x4e>
mov    -0x8(%rbp),%rax
movsbq -0xb(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xb(%rbp),%al
add    $0x1,%al
mov    %al,-0xb(%rbp)
jmp    112f <freeMatrix+0x1f>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeMatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %sil,%sil
jle    1142 <freeMatrix+0x32>
movzbl %sil,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <freeMatrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeMatrix(float** nocapture %0, i8 signext %1, i8 signext %2) {
%4 = icmp sgt i8 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i8 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds float*, float** %0, i64 %8
%10 = bitcast float** %9 to i8**
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
%15 = bitcast float** %0 to i8*
tail call void @free(i8* %15)
ret void
}
/* Type definitions */
struct navi_scope {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _navi_scope_unref(struct navi_scope *);
void _navi_extern_scope_unref(struct navi_scope *scope) {
  _navi_scope_unref(scope);
}


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

x86 assembly (clang, -O2):
<_navi_extern_scope_unref>:
jmp    1030 <_navi_scope_unref@plt>

LLVM IR (-O0):
%struct.navi_scope = type { i32 }
define void @_navi_extern_scope_unref(%struct.navi_scope* %0) {
%2 = alloca %struct.navi_scope*
store %struct.navi_scope* %0, %struct.navi_scope** %2
%3 = load %struct.navi_scope*, %struct.navi_scope** %2
%4 = call i32 @_navi_scope_unref(%struct.navi_scope* %3)
ret void
}

LLVM IR (-O2):
%struct.navi_scope = type { i32 }
define void @_navi_extern_scope_unref(%struct.navi_scope* %0) {
%2 = tail call i32 @_navi_scope_unref(%struct.navi_scope* %0)
ret void
}
/* Type definitions */
typedef int u_int32_t;

/* Variables and functions */
int is_ip_in_whitelist(u_int32_t ip) {
  if ((ip & 0xff) == 127 && (ip >> 8 & 0xff) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_ip_in_whitelist>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x7f,%eax
jne    1138 <is_ip_in_whitelist+0x38>
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
cmp    $0x0,%eax
jne    1138 <is_ip_in_whitelist+0x38>
movl   $0x1,-0x4(%rbp)
jmp    113f <is_ip_in_whitelist+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ip_in_whitelist>:
xor    %eax,%eax
cmp    $0x7f,%di
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_ip_in_whitelist(i32 %0) {
%2 = and i32 %0, 65535
%3 = icmp eq i32 %2, 127
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
size_t strlen(char const *);
size_t base_len(char const *name) {
  size_t len;
  for (len = strlen(name); 1 < len && ((name[len - 1]) == '/'); len--)
    continue;
  return len;
}


x86 assembly (clang, -O0):
<base_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
jae    1156 <base_len+0x46>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1166 <base_len+0x56>
jmp    117c <base_len+0x6c>
jmp    116b <base_len+0x5b>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <base_len+0x19>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_len>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x2,%rcx
jb     114b <base_len+0x3b>
lea    -0x1(%rcx),%rdx
cmpb   $0x2f,-0x1(%rbx,%rcx,1)
mov    %rdx,%rcx
je     1130 <base_len+0x20>
add    $0x1,%rdx
mov    %rdx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @base_len(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
br label %5
5: ; preds = %8, %1
%6 = phi i64 [ %2, %1 ], [ %9, %8 ]
%7 = icmp ugt i64 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = add i64 %6, -1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 47
br i1 %12, label %5, label %13
13: ; preds = %5, %8
%14 = phi i64 [ %4, %5 ], [ %6, %8 ]
ret i64 %14
}
/* Type definitions */
struct t_config_file {
  int dummy;
};

/* Variables and functions */
int config_file_write_internal(struct t_config_file *, int /*<<< orphan*/);
int config_file_write(struct t_config_file *config_file) {
  return config_file_write_internal(config_file, 0);
}


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

x86 assembly (clang, -O2):
<config_file_write>:
xor    %esi,%esi
jmp    1030 <config_file_write_internal@plt>

LLVM IR (-O0):
%struct.t_config_file = type { i32 }
define i32 @config_file_write(%struct.t_config_file* %0) {
%2 = alloca %struct.t_config_file*
store %struct.t_config_file* %0, %struct.t_config_file** %2
%3 = load %struct.t_config_file*, %struct.t_config_file** %2
%4 = call i32 @config_file_write_internal(%struct.t_config_file* %3, i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.t_config_file = type { i32 }
define i32 @config_file_write(%struct.t_config_file* %0) {
%2 = tail call i32 @config_file_write_internal(%struct.t_config_file* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
char *strndup(const char *str, size_t n) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @strndup(i8* nocapture readnone %0, i64 %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  static int a;
  foo();
  foo();
  foo();
  printf("%d\n", a);
  return 0;
}


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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 0
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void fill_array(int arr[], int array_size) {
  int i;
  srand(time(NULL));
  for (i = 0; i < array_size; i++) {
    arr[i] = rand();
  }
}


x86 assembly (clang, -O0):
<fill_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1184 <fill_array+0x54>
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <fill_array+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_array>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    1164 <fill_array+0x34>
mov    %ebp,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <fill_array+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fill_array(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %12, %8 ]
%10 = tail call i32 (...) @rand()
%11 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %10, i32* %11
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %7
br i1 %13, label %14, label %8
14: ; preds = %8, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __builtin_ctzll(unsigned long long);
uint64_t chpl_bitops_ctz_64(unsigned long long x) {
  return x ? __builtin_ctzll(x) : 0;
}


x86 assembly (clang, -O0):
<chpl_bitops_ctz_64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1123 <chpl_bitops_ctz_64+0x23>
mov    -0x8(%rbp),%rax
bsf    %rax,%rax
mov    %eax,-0xc(%rbp)
jmp    112d <chpl_bitops_ctz_64+0x2d>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <chpl_bitops_ctz_64+0x2d>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chpl_bitops_ctz_64>:
xor    %ecx,%ecx
bsf    %rdi,%rax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @chpl_bitops_ctz_64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i64, i64* %2
%7 = call i64 @llvm.cttz.i64(i64 %6, i1 true)
%8 = trunc i64 %7 to i32
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %5
%11 = phi i32 [ %8, %5 ], [ 0, %9 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @chpl_bitops_ctz_64(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = tail call i64 @llvm.cttz.i64(i64 %0, i1 true)
%4 = trunc i64 %3 to i32
%5 = select i1 %2, i32 0, i32 %4
ret i32 %5
}
/* Variables and functions */
void *malloc(int);
void *p_alloc(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<p_alloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @p_alloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
void Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler+0x9>
jmp    1109 <Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler+0x9>

x86 assembly (clang, -O2):
<Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler>:
jmp    1100 <Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler>

LLVM IR (-O0):
define void @Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Default_UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int enable_path_for_cleanup(char const *, char const *, char *);
char *get_task_dir_path(char const *, char const *, char const *, char const *);
int enable_task_for_cleanup(const char *tt_root, const char *user,
                            const char *jobid, const char *dir_to_be_deleted) {
  char *full_path = get_task_dir_path(tt_root, user, jobid, dir_to_be_deleted);
  return enable_path_for_cleanup(tt_root, user, full_path);
}


x86 assembly (clang, -O0):
<enable_task_for_cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <get_task_dir_path@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <enable_path_for_cleanup@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_task_for_cleanup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <get_task_dir_path@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <enable_path_for_cleanup@plt>

LLVM IR (-O0):
define i32 @enable_task_for_cleanup(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = call i8* @get_task_dir_path(i8* %10, i8* %11, i8* %12, i8* %13)
store i8* %14, i8** %9
%15 = load i8*, i8** %5
%16 = load i8*, i8** %6
%17 = load i8*, i8** %9
%18 = call i32 @enable_path_for_cleanup(i8* %15, i8* %16, i8* %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @enable_task_for_cleanup(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i8* @get_task_dir_path(i8* %0, i8* %1, i8* %2, i8* %3)
%6 = tail call i32 @enable_path_for_cleanup(i8* %0, i8* %1, i8* %5)
ret i32 %6
}
/* Variables and functions */
size_t strlen(char const *);
char *strstr(char const *, char const *);
bool match_env_name(const char *value, const char *name) {
  char *match = strstr(value, name);
  return (match == value && match[strlen(name)] == '=');
}


x86 assembly (clang, -O0):
<match_env_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x19(%rbp)
jne    1179 <match_env_name+0x59>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_env_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    115d <match_env_name+0x3d>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmpb   $0x3d,(%r14,%rcx,1)
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @match_env_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @strstr(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = icmp eq i8* %9, %10
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = load i8*, i8** %4
%15 = call i64 @strlen(i8* %14)
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 61
br label %20
20: ; preds = %12, %2
%21 = phi i1 [ false, %2 ], [ %19, %12 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @match_env_name(i8* %0, i8* nocapture %1) {
%3 = call i64 @strlen(i8* dereferenceable(1) %1)
%4 = call i32 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 61
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %2
%13 = phi i32 [ 0, %2 ], [ %11, %6 ]
ret i32 %13
}
char UINT_TO_SINT(unsigned short var) {
  char newvar = (char)var;
  if (var > 127)
    newvar = 127;
  return newvar;
}


x86 assembly (clang, -O0):
<UINT_TO_SINT>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x7f,%eax
jle    1123 <UINT_TO_SINT+0x23>
movb   $0x7f,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UINT_TO_SINT>:
cmp    $0x7f,%di
mov    $0x7f,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @UINT_TO_SINT(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = trunc i16 %4 to i8
store i8 %5, i8* %3
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = icmp sgt i32 %7, 127
br i1 %8, label %9, label %10
9: ; preds = %1
store i8 127, i8* %3
br label %10
10: ; preds = %9, %1
%11 = load i8, i8* %3
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @UINT_TO_SINT(i16 zeroext %0) {
%2 = icmp ult i16 %0, 127
%3 = select i1 %2, i16 %0, i16 127
%4 = trunc i16 %3 to i8
ret i8 %4
}
void paravirt_arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) {}


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

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

LLVM IR (-O0):
%struct.mm_struct = type opaque
define void @paravirt_arch_dup_mmap(%struct.mm_struct* %0, %struct.mm_struct* %1) {
%3 = alloca %struct.mm_struct*
%4 = alloca %struct.mm_struct*
store %struct.mm_struct* %0, %struct.mm_struct** %3
store %struct.mm_struct* %1, %struct.mm_struct** %4
ret void
}

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @paravirt_arch_dup_mmap(%struct.mm_struct* nocapture %0, %struct.mm_struct* nocapture %1) {
ret void
}
/* Variables and functions */
int errno;
int write(int, void const *, int);
int k_write(int *nwritten, int fd, const void *addr, int count) {
  int rc = write(fd, addr, count);
  if (rc < 0)
    return errno;
  if (nwritten)
    *nwritten = rc;
  return 0;
}


x86 assembly (clang, -O0):
<k_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    1153 <k_write+0x43>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <k_write+0x5e>
cmpq   $0x0,-0x10(%rbp)
je     1167 <k_write+0x57>
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_write>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <write@plt>
test   %eax,%eax
js     1131 <k_write+0x21>
mov    %eax,%ecx
xor    %eax,%eax
test   %rbx,%rbx
je     112f <k_write+0x1f>
mov    %ecx,(%rbx)
pop    %rbx
ret
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @k_write(i32* writeonly %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @write(i32 %1, i8* %2, i32 %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = load i32, i32* @errno
br label %12
9: ; preds = %4
%10 = icmp eq i32* %0, null
br i1 %10, label %12, label %11
11: ; preds = %9
store i32 %5, i32* %0
br label %12
12: ; preds = %9, %11, %7
%13 = phi i32 [ %8, %7 ], [ 0, %11 ], [ 0, %9 ]
ret i32 %13
}
void GPMCycle2CycleAndTurnArndTimeTimingConfig(unsigned int baseAddr,
                                               unsigned int csNum,
                                               unsigned int conf) {
  (*((volatile unsigned int *)(baseAddr + (0x74 + (csNum * (0x30)))))) |= conf;
}


x86 assembly (clang, -O0):
<GPMCycle2CycleAndTurnArndTimeTimingConfig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x74,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCycle2CycleAndTurnArndTimeTimingConfig>:
lea    (%rsi,%rsi,2),%eax
shl    $0x4,%eax
add    %edi,%eax
add    $0x74,%eax
or     %edx,(%rax)
ret

LLVM IR (-O0):
define void @GPMCycle2CycleAndTurnArndTimeTimingConfig(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = mul i32 %9, 48
%11 = add i32 116, %10
%12 = add i32 %8, %11
%13 = zext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = or i32 %15, %7
store volatile i32 %16, i32* %14
ret void
}

LLVM IR (-O2):
define void @GPMCycle2CycleAndTurnArndTimeTimingConfig(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %1, 48
%5 = add i32 %0, 116
%6 = add i32 %5, %4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = or i32 %9, %2
store volatile i32 %10, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lerror(char *, char *, char *);
void argcount(char *fname, int nargs, int c) {
  if (nargs != c)
    lerror("%s: error: too %s arguments\n", fname, nargs < c ? "few" : "many");
}


x86 assembly (clang, -O0):
<argcount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1158 <argcount+0x48>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edi
lea    0xee2(%rip),%rdx
lea    0xed7(%rip),%rax
cmp    %edi,%ecx
cmovl  %rax,%rdx
lea    0xead(%rip),%rdi
call   1030 <lerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argcount>:
cmp    %edx,%esi
jne    1115 <argcount+0x5>
ret
mov    %rdi,%rax
lea    0xefe(%rip),%rcx
lea    0xefb(%rip),%rdx
cmovl  %rcx,%rdx
lea    0xecf(%rip),%rdi
mov    %rax,%rsi
jmp    1030 <lerror@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"%s: error: too %s arguments\0A\00"
@.str.1 = [4 x i8] c"few\00"
@.str.2 = [5 x i8] c"many\00"
define void @argcount(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%17 = call i32 @lerror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %16)
br label %18
18: ; preds = %10, %3
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s: error: too %s arguments\0A\00"
@.str.1 = [4 x i8] c"few\00"
@.str.2 = [5 x i8] c"many\00"
define void @argcount(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = icmp slt i32 %1, %2
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @lerror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %7)
br label %9
9: ; preds = %5, %3
ret void
}
/* Variables and functions */
void *kl_malloc(int);
int /*<<< orphan*/ list_add(void *, void *);
int /*<<< orphan*/ memcpy(void *, void *, int);
void list_add_copy(void *rptr, void *node, int size) {
  void *nptr = kl_malloc(size);
  memcpy(nptr, node, size);
  list_add(rptr, nptr);
}


x86 assembly (clang, -O0):
<list_add_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <kl_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <list_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_add_copy>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%edi
call   1030 <kl_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <list_add@plt>

LLVM IR (-O0):
define void @list_add_copy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = call i8* @kl_malloc(i32 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %7
%16 = call i32 @list_add(i8* %14, i8* %15)
ret void
}

LLVM IR (-O2):
define void @list_add_copy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @kl_malloc(i32 %2)
%5 = tail call i32 @memcpy(i8* %4, i8* %1, i32 %2)
%6 = tail call i32 @list_add(i8* %0, i8* %4)
ret void
}
/* Type definitions */
struct ListNode {
  int dummy;
};

/* Variables and functions */
struct ListNode *createList(int *, int);
int /*<<< orphan*/ printList(struct ListNode *);
struct ListNode *removeNthFromEnd(struct ListNode *, int);
int main(void) {
  struct ListNode *head = NULL;
  int arr[1] = {1};
  head = createList(arr, 1);
  printList(head);
  head = removeNthFromEnd(head, 1);
  printList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0xeb3(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x1,%esi
call   1040 <createList@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <printList@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <removeNthFromEnd@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
call   1040 <createList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <printList@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <removeNthFromEnd@plt>
mov    %rax,%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@__const.main.arr = [1 x i32] [i32 1]
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.ListNode*
%3 = alloca [1 x i32]
store i32 0, i32* %1
store %struct.ListNode* null, %struct.ListNode** %2
%4 = bitcast [1 x i32]* %3 to i8*
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
%6 = call %struct.ListNode* @createList(i32* %5, i32 1)
store %struct.ListNode* %6, %struct.ListNode** %2
%7 = load %struct.ListNode*, %struct.ListNode** %2
%8 = call i32 @printList(%struct.ListNode* %7)
%9 = load %struct.ListNode*, %struct.ListNode** %2
%10 = call %struct.ListNode* @removeNthFromEnd(%struct.ListNode* %9, i32 1)
store %struct.ListNode* %10, %struct.ListNode** %2
%11 = load %struct.ListNode*, %struct.ListNode** %2
%12 = call i32 @printList(%struct.ListNode* %11)
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
define i32 @main() {
%1 = alloca [1 x i32]
%2 = bitcast [1 x i32]* %1 to i8*
%3 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 1, i32* %3
%4 = call %struct.ListNode* @createList(i32* %3, i32 1)
%5 = call i32 @printList(%struct.ListNode* %4)
%6 = call %struct.ListNode* @removeNthFromEnd(%struct.ListNode* %4, i32 1)
%7 = call i32 @printList(%struct.ListNode* %6)
ret i32 0
}
unsigned char Slcd_Bit_Swap(unsigned char DATA) {
  unsigned char i = 0;
  unsigned char RESULT = 0;
  for (i = 0; i <= 7; i += 1) {
    RESULT = RESULT << 1;
    RESULT = RESULT | ((DATA >> i) & 0x01);
  }
  return RESULT;
}


x86 assembly (clang, -O0):
<Slcd_Bit_Swap>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movb   $0x0,-0x3(%rbp)
movb   $0x0,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x7,%eax
jg     1154 <Slcd_Bit_Swap+0x54>
movzbl -0x3(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
movzbl -0x1(%rbp),%edx
movzbl -0x2(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0x1,%ecx
or     %ecx,%eax
mov    %al,-0x3(%rbp)
movzbl -0x2(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x2(%rbp)
jmp    1116 <Slcd_Bit_Swap+0x16>
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Slcd_Bit_Swap>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %dil,%al
mov    %eax,%ecx
and    $0x55,%cl
add    %cl,%cl
shr    %al
and    $0x55,%al
or     %cl,%al
ret

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

LLVM IR (-O2):
define zeroext i8 @Slcd_Bit_Swap(i8 zeroext %0) {
%2 = call i8 @llvm.bitreverse.i8(i8 %0)
ret i8 %2
}
/* Variables and functions */
scalar_t__ fabs(float);
int SCE_Math_IsZero(float number) {
  return ((float)fabs((number))) < (0.000001f);
}


x86 assembly (clang, -O0):
<SCE_Math_IsZero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2ss %rax,%xmm1
movss  0xecc(%rip),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Math_IsZero>:
push   %rax
call   1030 <fabs@plt>
xor    %ecx,%ecx
test   %rax,%rax
setle  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @SCE_Math_IsZero(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @fabs(float %3)
%5 = sitofp i64 %4 to float
%6 = fcmp olt float %5, 0x3EB0C6F7A0000000
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @SCE_Math_IsZero(float %0) {
%2 = tail call i64 @fabs(float %0)
%3 = icmp slt i64 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *STRDUP(char const *);
char *findExt(char *);
char *stripExt(const char *in) {
  char *out = STRDUP(in);
  char *ext = findExt(out);
  if (ext)
    *ext = '\0';
  return out;
}


x86 assembly (clang, -O0):
<stripExt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <STRDUP@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <findExt@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1158 <stripExt+0x38>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripExt>:
push   %rbx
call   1030 <STRDUP@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <findExt@plt>
test   %rax,%rax
je     1139 <stripExt+0x19>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @stripExt(i8* %0) {
%2 = tail call i8* @STRDUP(i8* %0)
%3 = tail call i8* @findExt(i8* %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
store i8 0, i8* %3
br label %6
6: ; preds = %5, %1
ret i8* %2
}
/* Variables and functions */
int get_line(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int len;
  char line[1000];
  while ((len = get_line(line, 1000)) > 0)
    if (len > 80) {
      printf("%s\n", line);
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <get_line@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1171 <main+0x51>
cmpl   $0x50,-0x8(%rbp)
jle    116c <main+0x4c>
lea    -0x3f0(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1030 <get_line@plt>
test   %eax,%eax
jle    1173 <main+0x53>
lea    0xebe(%rip),%r14
mov    %rsp,%rbx
jmp    1161 <main+0x41>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <get_line@plt>
test   %eax,%eax
jle    1173 <main+0x53>
cmp    $0x51,%eax
jb     1150 <main+0x30>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %14, %0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @get_line(i8* %5, i32 1000)
store i32 %6, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 80
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %8
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @get_line(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0, %10
%6 = phi i32 [ %11, %10 ], [ %3, %0 ]
%7 = icmp ugt i32 %6, 80
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %10
10: ; preds = %8, %5
%11 = call i32 @get_line(i8* %2, i32 1000)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %10, %0
ret i32 0
}
/* Variables and functions */
char *g_memdup(char const *, size_t);
size_t strlen(char const *);
char *g_strdup(const char *input) {
  size_t len = strlen(input);
  return g_memdup(input, len + 1);
}


x86 assembly (clang, -O0):
<g_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1040 <g_memdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_strdup>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <g_memdup@plt>

LLVM IR (-O0):
define i8* @g_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
store i64 %5, i64* %3
%6 = load i8*, i8** %2
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @g_memdup(i8* %6, i64 %8)
ret i8* %9
}

LLVM IR (-O2):
define i8* @g_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @g_memdup(i8* %0, i64 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ *in_get_data(char *);
int in_check_header_finish(char *data, size_t count) {
  data[count] = '\0';
  return (in_get_data(data) == NULL) ? -1 : 0;
}


x86 assembly (clang, -O0):
<in_check_header_finish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1030 <in_get_data@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_check_header_finish>:
push   %rax
movb   $0x0,(%rdi,%rsi,1)
call   1030 <in_get_data@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @in_check_header_finish(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = getelementptr inbounds i8, i8* %5, i64 %6
store i8 0, i8* %7
%8 = load i8*, i8** %3
%9 = call i32* @in_get_data(i8* %8)
%10 = icmp eq i32* %9, null
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 -1, i32 0
ret i32 %12
}

LLVM IR (-O2):
define i32 @in_check_header_finish(i8* %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
store i8 0, i8* %3
%4 = tail call i32* @in_get_data(i8* %0)
%5 = icmp eq i32* %4, null
%6 = sext i1 %5 to i32
ret i32 %6
}