xunge/DecIR huggingface dataset:
/* Variables and functions */
int htoi(char *);
int /*<<< orphan*/ mgetline(char *, int);
int /*<<< orphan*/ printf(char *, char *, int);
int main(void) {
  char line[100];
  int value;
  mgetline(line, 100);
  value = htoi(line);
  printf("The value of %s is %d", line, value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1050 <mgetline@plt>
lea    -0x70(%rbp),%rdi
call   1040 <htoi@plt>
mov    %eax,-0x74(%rbp)
lea    -0x70(%rbp),%rsi
mov    -0x74(%rbp),%edx
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <mgetline@plt>
mov    %rbx,%rdi
call   1040 <htoi@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"The value of %s is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @mgetline(i8* %4, i32 100)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @htoi(i8* %6)
store i32 %7, i32* %3
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"The value of %s is %d\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @mgetline(i8* %2, i32 100)
%4 = call i32 @htoi(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ is_alpha2(char const *);
int /*<<< orphan*/ is_world_regdom(char const *);
int is_valid_regdom(const char *alpha2) {
  if (!is_alpha2(alpha2) && !is_world_regdom(alpha2))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_valid_regdom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <is_alpha2@plt>
cmp    $0x0,%eax
jne    115c <is_valid_regdom+0x3c>
mov    -0x10(%rbp),%rdi
call   1030 <is_world_regdom@plt>
cmp    $0x0,%eax
jne    115c <is_valid_regdom+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1163 <is_valid_regdom+0x43>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_regdom>:
push   %rbx
mov    %rdi,%rbx
call   1040 <is_alpha2@plt>
test   %eax,%eax
jne    1139 <is_valid_regdom+0x19>
mov    %rbx,%rdi
call   1030 <is_world_regdom@plt>
test   %eax,%eax
je     1140 <is_valid_regdom+0x20>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @is_valid_regdom(i8* %0) {
%2 = tail call i32 @is_alpha2(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @is_world_regdom(i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %4, %1
br label %8
8: ; preds = %4, %7
%9 = phi i32 [ 1, %7 ], [ 0, %4 ]
ret i32 %9
}
int isProbablePrime(long oddNumber) {
  long i = 0;
  for (i = 3; i < 51; i += 2)
    if (oddNumber == i)
      return 1;
    else if (oddNumber % i == 0)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isProbablePrime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x3,-0x18(%rbp)
cmpq   $0x33,-0x18(%rbp)
jge    1178 <isProbablePrime+0x78>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    113d <isProbablePrime+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    117f <isProbablePrime+0x7f>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
cmp    $0x0,%rdx
jne    115d <isProbablePrime+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    117f <isProbablePrime+0x7f>
jmp    1162 <isProbablePrime+0x62>
jmp    1167 <isProbablePrime+0x67>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <isProbablePrime+0x18>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isProbablePrime>:
mov    $0x1,%r8d
cmp    $0x3,%rdi
je     115f <isProbablePrime+0x5f>
mov    $0x5,%esi
sub    %rdi,%rsi
mov    $0x3,%ecx
nopl   0x0(%rax)
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1140 <isProbablePrime+0x40>
mov    %rdi,%rax
cqto
idiv   %rcx
test   %rdx,%rdx
jne    114b <isProbablePrime+0x4b>
jmp    1163 <isProbablePrime+0x63>
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
je     1163 <isProbablePrime+0x63>
cmp    $0x30,%rcx
ja     115f <isProbablePrime+0x5f>
lea    (%rsi,%rcx,1),%rax
add    $0x2,%rcx
cmp    $0x3,%rax
jne    1120 <isProbablePrime+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @isProbablePrime(i64 %0) {
%2 = icmp eq i64 %0, 3
br i1 %2, label %12, label %7
3: ; preds = %7
%4 = icmp ugt i64 %8, 48
%5 = icmp eq i64 %11, %0
%6 = or i1 %4, %5
br i1 %6, label %12, label %7
7: ; preds = %1, %3
%8 = phi i64 [ %11, %3 ], [ 3, %1 ]
%9 = srem i64 %0, %8
%10 = icmp eq i64 %9, 0
%11 = add nuw nsw i64 %8, 2
br i1 %10, label %12, label %3
12: ; preds = %7, %3, %1
%13 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %7 ]
ret i32 %13
}
void dbg_break() { *((volatile unsigned *)0) = 0x0; }


x86 assembly (clang, -O0):
<dbg_break>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_break>:
movl   $0x0,0x0
ret

LLVM IR (-O0):
define void @dbg_break() {
store volatile i32 0, i32* null
ret void
}

LLVM IR (-O2):
define void @dbg_break() {
store volatile i32 0, i32* null
ret void
}
char *langDbgDevKonamiKbd() { return "Konami Keyboard Master"; }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"Konami Keyboard Master\00"
define i8* @langDbgDevKonamiKbd() {
ret i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [23 x i8] c"Konami Keyboard Master\00"
define i8* @langDbgDevKonamiKbd() {
ret i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, int);
int setblock(int fd) {
  int flag = fcntl(fd, F_GETFL, 0);
  flag &= ~O_NONBLOCK;
  return fcntl(fd, F_SETFL, flag);
}


x86 assembly (clang, -O0):
<setblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setblock>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2ebe(%rip),%rcx
mov    (%rcx),%edx
not    %edx
and    %eax,%edx
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define i32 @setblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 @fcntl(i32 %4, i32 %5, i32 0)
store i32 %6, i32* %3
%7 = load i32, i32* @O_NONBLOCK
%8 = xor i32 %7, -1
%9 = load i32, i32* %3
%10 = and i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* @F_SETFL
%13 = load i32, i32* %3
%14 = call i32 @fcntl(i32 %11, i32 %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define i32 @setblock(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = load i32, i32* @O_NONBLOCK
%5 = xor i32 %4, -1
%6 = and i32 %3, %5
%7 = load i32, i32* @F_SETFL
%8 = tail call i32 @fcntl(i32 %0, i32 %7, i32 %6)
ret i32 %8
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double atan(double);
double pop(struct lifo *);
double opr_atan(struct lifo *stack) {
  double op = pop(stack);
  return atan(op);
}


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

x86 assembly (clang, -O2):
<opr_atan>:
push   %rax
call   1030 <pop@plt>
pop    %rax
jmp    1040 <atan@plt>

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_atan(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%4 = load %struct.lifo*, %struct.lifo** %2
%5 = call double @pop(%struct.lifo* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call double @atan(double %6)
ret double %7
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_atan(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = tail call double @atan(double %2)
ret double %3
}
/* Type definitions */
struct bst_table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void **bst_probe(struct bst_table *, void *);
void(bst_assert_insert)(struct bst_table *table, void *item) {
  void **p = bst_probe(table, item);
  assert(p != NULL && *p == item);
}


x86 assembly (clang, -O0):
<bst_assert_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <bst_probe@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
je     1162 <bst_assert_insert+0x42>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bst_assert_insert>:
push   %rbx
mov    %rsi,%rbx
call   1040 <bst_probe@plt>
xor    %edi,%edi
test   %rax,%rax
je     1137 <bst_assert_insert+0x17>
cmp    %rbx,(%rax)
sete   %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct.bst_table = type { i32 }
define void @bst_assert_insert(%struct.bst_table* %0, i8* %1) {
%3 = alloca %struct.bst_table*
%4 = alloca i8*
%5 = alloca i8**
store %struct.bst_table* %0, %struct.bst_table** %3
store i8* %1, i8** %4
%6 = load %struct.bst_table*, %struct.bst_table** %3
%7 = load i8*, i8** %4
%8 = call i8** @bst_probe(%struct.bst_table* %6, i8* %7)
store i8** %8, i8*** %5
%9 = load i8**, i8*** %5
%10 = icmp ne i8** %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = load i8*, i8** %4
%15 = icmp eq i8* %13, %14
br label %16
16: ; preds = %11, %2
%17 = phi i1 [ false, %2 ], [ %15, %11 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret void
}

LLVM IR (-O2):
%struct.bst_table = type { i32 }
define void @bst_assert_insert(%struct.bst_table* %0, i8* %1) {
%3 = tail call i8** @bst_probe(%struct.bst_table* %0, i8* %1)
%4 = icmp eq i8** %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ 0, %2 ], [ %8, %5 ]
%11 = tail call i32 @assert(i32 %10)
ret void
}
void point_destroy(struct point *point) { point = point; }


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

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

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

LLVM IR (-O2):
%struct.point = type opaque
define void @point_destroy(%struct.point* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
char *rewrite_url(char *url) {
  if (strchr(url, '?') == NULL)
    return url;
  char *parser = strtok(url, "?");
  strcpy(url, parser);
  return url;
}


x86 assembly (clang, -O0):
<rewrite_url>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3f,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1161 <rewrite_url+0x31>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <rewrite_url+0x5a>
mov    -0x10(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rewrite_url>:
push   %rbx
mov    %rdi,%rbx
mov    $0x3f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     115d <rewrite_url+0x2d>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strtok@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
define i8* @rewrite_url(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @strchr(i8* %5, i8 signext 63)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8* %9, i8** %2
br label %17
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %4
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
store i8* %16, i8** %2
br label %17
17: ; preds = %10, %8
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
define i8* @rewrite_url(i8* returned %0) {
%2 = tail call i32* @strchr(i8* %0, i8 signext 63)
%3 = icmp eq i32* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcpy(i8* %0, i8* %5)
br label %7
7: ; preds = %1, %4
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ unimplemented();
void norm_imm(void) { unimplemented(); }


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

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

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

LLVM IR (-O2):
define void @norm_imm() {
%1 = tail call i32 (...) @unimplemented()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_section(char *section) {
  printf("*********************************\n* "
         "%s\n*********************************\n",
         section);
}


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

x86 assembly (clang, -O2):
<print_section>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [74 x i8] c"*********************************\0A* %s\0A*********************************\0A\00"
define void @print_section(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void __attribute__((regparm(3))) memcpy_18(void *dest, void *src) {
  memcpy(dest, src, 18);
}


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

x86 assembly (clang, -O2):
<memcpy_18>:
mov    $0x12,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @memcpy_18(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 @memcpy(i8* %5, i8* %6, i32 18)
ret void
}

LLVM IR (-O2):
define void @memcpy_18(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 18)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close_framebuffer();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void sig(int sig) {
  close_framebuffer();
  fflush(stderr);
  printf("signal %d caught\n", sig);
  fflush(stdout);
  exit(1);
}


x86 assembly (clang, -O0):
<sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <close_framebuffer@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x4(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<sig>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <close_framebuffer@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xea1(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"signal %d caught\0A\00"
@stdout = global i32 0
define void @sig(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @close_framebuffer()
%4 = load i32, i32* @stderr
%5 = call i32 @fflush(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"signal %d caught\0A\00"
@stdout = global i32 0
define void @sig(i32 %0) {
%2 = tail call i32 (...) @close_framebuffer()
%3 = load i32, i32* @stderr
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
%8 = tail call i32 @exit(i32 1)
unreachable
}
int nested_loop_constant() {
  int k = 0;
  for (int i = 0; i < 5; i++) {
  A:
    k = 0;
    for (int j = 0; j < 100; j++) {
      k = 3;
    }
  }
  return k;
}


x86 assembly (clang, -O0):
<nested_loop_constant>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1161 <nested_loop_constant+0x61>
jmp    1121 <nested_loop_constant+0x21>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    114e <nested_loop_constant+0x4e>
movl   $0x3,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112f <nested_loop_constant+0x2f>
jmp    1153 <nested_loop_constant+0x53>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <nested_loop_constant+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @nested_loop_constant() {
ret i32 3
}
void rwsem_wake(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<rwsem_wake>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rwsem_wake>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.rwsem_wake = [11 x i8] c"rwsem_wake\00"
define void @rwsem_wake() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.rwsem_wake, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.rwsem_wake = [11 x i8] c"rwsem_wake\00"
define void @rwsem_wake() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.rwsem_wake, i64 0, i64 0))
ret void
}
int hash(char *any) { return (any[1] + any[2]) % 97 + 1; }


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
add    %ecx,%eax
mov    $0x61,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
movsbl 0x1(%rdi),%eax
movsbl 0x2(%rdi),%ecx
add    %eax,%ecx
imul   $0xffffa8e9,%ecx,%eax
shr    $0x10,%eax
add    %ecx,%eax
movzwl %ax,%eax
movswl %ax,%edx
shr    $0xf,%eax
sar    $0x6,%edx
add    %eax,%edx
imul   $0x61,%edx,%eax
sub    %eax,%ecx
add    $0x1,%ecx
movswl %cx,%eax
ret

LLVM IR (-O0):
define i32 @hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add nsw i32 %6, %10
%12 = srem i32 %11, 97
%13 = add nsw i32 %12, 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = sext i8 %3 to i16
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i16
%8 = add nsw i16 %7, %4
%9 = srem i16 %8, 97
%10 = add nsw i16 %9, 1
%11 = sext i16 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void dump_fglrxinfo(void) {
  system("fglrxinfo -v 2> /dev/null > fglrxinfo.txt");
}


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

x86 assembly (clang, -O2):
<dump_fglrxinfo>:
lea    0xee9(%rip),%rdi
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"fglrxinfo -v 2> /dev/null > fglrxinfo.txt\00"
define void @dump_fglrxinfo() {
%1 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"fglrxinfo -v 2> /dev/null > fglrxinfo.txt\00"
define void @dump_fglrxinfo() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}
void outudec(num) unsigned num;
{
  char str[10 + 1];
  str[sizeof str - 1] = 0;
  outstr(pushudec(str + sizeof str - 1, num));
}


x86 assembly (clang, -O0):
<outudec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
lea    -0xf(%rbp),%rdi
add    $0xb,%rdi
add    $0xffffffffffffffff,%rdi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1040 <pushudec@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1030 <outstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outudec>:
sub    $0x18,%rsp
mov    %edi,%esi
lea    0x17(%rsp),%rdi
movb   $0x0,0x17(%rsp)
xor    %eax,%eax
call   1040 <pushudec@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1030 <outstr@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @outudec(i32 %0) {
%2 = alloca i32
%3 = alloca [11 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 10
store i8 0, i8* %4
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %5, i64 11
%7 = getelementptr inbounds i8, i8* %6, i64 -1
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @pushudec to i32 (i8*, i32, ...)*)(i8* %7, i32 %8)
%10 = call i32 (i32, ...) bitcast (i32 (...)* @outstr to i32 (i32, ...)*)(i32 %9)
ret void
}

LLVM IR (-O2):
define void @outudec(i32 %0) {
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 10
store i8 0, i8* %4
%5 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @pushudec to i32 (i8*, i32, ...)*)(i8* %4, i32 %0)
%6 = call i32 (i32, ...) bitcast (i32 (...)* @outstr to i32 (i32, ...)*)(i32 %5)
ret void
}
/* Type definitions */
struct _mgmt_listuser_req {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ osapi_free(struct _mgmt_listuser_req *);
void mgmt_listuser_req_free(struct _mgmt_listuser_req *ptr) { osapi_free(ptr); }


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

x86 assembly (clang, -O2):
<mgmt_listuser_req_free>:
jmp    1030 <osapi_free@plt>

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

LLVM IR (-O2):
%struct._mgmt_listuser_req = type { i32 }
define void @mgmt_listuser_req_free(%struct._mgmt_listuser_req* %0) {
%2 = tail call i32 @osapi_free(%struct._mgmt_listuser_req* %0)
ret void
}
/* Variables and functions */
scalar_t__ isdigit(int);
scalar_t__ islower(int);
scalar_t__ isupper(int);
int IdentifierCharP(int ch) {
  return isupper(ch) || islower(ch) || isdigit(ch) || ch == '_';
}


x86 assembly (clang, -O0):
<IdentifierCharP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <isupper@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1193 <IdentifierCharP+0x63>
mov    -0x4(%rbp),%edi
call   1040 <islower@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1193 <IdentifierCharP+0x63>
mov    -0x4(%rbp),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1193 <IdentifierCharP+0x63>
cmpl   $0x5f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IdentifierCharP>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1050 <isupper@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    1164 <IdentifierCharP+0x34>
mov    %ebp,%edi
call   1040 <islower@plt>
test   %rax,%rax
jne    1164 <IdentifierCharP+0x34>
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1164 <IdentifierCharP+0x34>
xor    %ebx,%ebx
cmp    $0x5f,%ebp
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IdentifierCharP(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isupper(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i64 @islower(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i64 @isdigit(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 95
br label %17
17: ; preds = %14, %10, %6, %1
%18 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %16, %14 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @IdentifierCharP(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call i64 @islower(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i64 @isdigit(i32 %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = icmp eq i32 %0, 95
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %10, %7, %4, %1
%14 = phi i32 [ 1, %7 ], [ 1, %4 ], [ 1, %1 ], [ %12, %10 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ arm_memio_regdh_op();
int /*<<< orphan*/ arm_memio_strd(int /*<<< orphan*/);
void arm_strd_reg() { arm_memio_strd(arm_memio_regdh_op()); }


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

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

LLVM IR (-O0):
define void @arm_strd_reg() {
%1 = call i32 (...) @arm_memio_regdh_op()
%2 = call i32 @arm_memio_strd(i32 %1)
ret void
}

LLVM IR (-O2):
define void @arm_strd_reg() {
%1 = tail call i32 (...) @arm_memio_regdh_op()
%2 = tail call i32 @arm_memio_strd(i32 %1)
ret void
}
int IMUBClose() {}


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

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

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

LLVM IR (-O2):
define i32 @IMUBClose() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ drdynvc_send_capability_request(int);
int /*<<< orphan*/ xcommon_init();
int drdynvc_init(void) {
  xcommon_init();
  drdynvc_send_capability_request(2);
  return 0;
}


x86 assembly (clang, -O0):
<drdynvc_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <xcommon_init@plt>
mov    $0x2,%edi
call   1040 <drdynvc_send_capability_request@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<drdynvc_init>:
push   %rax
xor    %eax,%eax
call   1030 <xcommon_init@plt>
mov    $0x2,%edi
call   1040 <drdynvc_send_capability_request@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @drdynvc_init() {
%1 = call i32 (...) @xcommon_init()
%2 = call i32 @drdynvc_send_capability_request(i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @drdynvc_init() {
%1 = tail call i32 (...) @xcommon_init()
%2 = tail call i32 @drdynvc_send_capability_request(i32 2)
ret i32 0
}
int main(void) {
  int i;
  1 != !3;
  4 && (6);
  7 * 8 + 10;
  (11 - 12) + (12 / 16);
  17 <= 18 < -20;
  i = 21 == 22;
  25 >= 27 > 28;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef double time_t;

/* Variables and functions */
double difftime(time_t time2, time_t time1) { return (time1 - time2); }


x86 assembly (clang, -O0):
<difftime>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<difftime>:
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @difftime(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @difftime(double %0, double %1) {
%3 = fsub double %1, %0
ret double %3
}
/* Variables and functions */
size_t strlen(const char *s) {
  size_t cnt = 0;
  while (*s++)
    cnt++;
  return cnt;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1139 <strlen+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Variables and functions */
int strlen(char const *);
int buspirate_is_prompt(const char *str) {
  int strlen_str = strlen(str);
  return (str[strlen_str - 1] == '>' || str[strlen_str - 2] == '>');
}


x86 assembly (clang, -O0):
<buspirate_is_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x3e,%ecx
mov    %al,-0xd(%rbp)
je     1161 <buspirate_is_prompt+0x51>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3e,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buspirate_is_prompt>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%rcx
mov    $0x1,%eax
cmpb   $0x3e,-0x1(%rcx,%rbx,1)
je     1132 <buspirate_is_prompt+0x22>
xor    %eax,%eax
cmpb   $0x3e,-0x2(%rcx,%rbx,1)
sete   %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @buspirate_is_prompt(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 62
br i1 %7, label %15, label %8
8: ; preds = %1
%9 = add nsw i32 %2, -2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 62
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %8, %1
%16 = phi i32 [ 1, %1 ], [ %14, %8 ]
ret i32 %16
}
g() {
  long clobber[] = {1, 2, 3};
  (void)clobber;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.g.clobber = [3 x i64] [i64 1, i64 2, i64 3]
define i32 @g() {
%1 = alloca i32
%2 = alloca [3 x i64]
%3 = bitcast [3 x i64]* %2 to i8*
%4 = getelementptr inbounds [3 x i64], [3 x i64]* %2, i64 0, i64 0
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @g() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int pen(int pen) {
  if (pen < 1 || pen > 10)
    return (1);
  printf("J%d\n", pen);
  return (0);
}


x86 assembly (clang, -O0):
<pen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     112f <pen+0x1f>
cmpl   $0xa,-0x8(%rbp)
jle    113b <pen+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1151 <pen+0x41>
mov    -0x8(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pen>:
mov    %edi,%esi
lea    -0xb(%rsi),%ecx
mov    $0x1,%eax
cmp    $0xfffffff6,%ecx
jb     1132 <pen+0x22>
push   %rax
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"J%d\0A\00"
define i32 @pen(i32 %0) {
%2 = add i32 %0, -11
%3 = icmp ult i32 %2, -10
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ 1, %1 ]
ret i32 %7
}
int integer_length(int x) { return 4; }


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

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

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

LLVM IR (-O2):
define i32 @integer_length(i32 %0) {
ret i32 4
}
int param_get_ulong(char *buffer, struct kernel_param *kp) { return 0; }


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

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

LLVM IR (-O0):
%struct.kernel_param = type opaque
define i32 @param_get_ulong(i8* %0, %struct.kernel_param* %1) {
%3 = alloca i8*
%4 = alloca %struct.kernel_param*
store i8* %0, i8** %3
store %struct.kernel_param* %1, %struct.kernel_param** %4
ret i32 0
}

LLVM IR (-O2):
%struct.kernel_param = type opaque
define i32 @param_get_ulong(i8* nocapture readnone %0, %struct.kernel_param* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int invalid(char *name) { printf("Invalid command : %s!\n", name); }


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

x86 assembly (clang, -O2):
<invalid>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Invalid command : %s!\0A\00"
define i32 @invalid(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [23 x i8] c"Invalid command : %s!\0A\00"
define i32 @invalid(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 undef
}
int swapone(int *B, int left, int right) {
  int tmp;
  tmp = B[left];
  B[left] = B[right];
  B[right] = tmp;
  return 0;
}


x86 assembly (clang, -O0):
<swapone>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapone>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @swapone(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
int main() {
  while (1) {
    int x = -1;
    x++;
    if (x)
      __VERIFIER_error();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1140 <main+0x30>
mov    $0x0,%al
call   1030 <__VERIFIER_error@plt>
jmp    111f <main+0xf>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %10
store i32 -1, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = call i32 (...) @__VERIFIER_error()
br label %10
10: ; preds = %8, %3
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
struct strbuffer {
  int dummy;
};

/* Variables and functions */
size_t strbuffer_insertn(struct strbuffer *, size_t, char *, int);
size_t strbuffer_insert_char(struct strbuffer *sb, size_t index, char c) {
  return strbuffer_insertn(sb, index, &c, 1);
}


x86 assembly (clang, -O0):
<strbuffer_insert_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x11(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <strbuffer_insertn@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strbuffer_insert_char>:
push   %rax
mov    %dl,0x7(%rsp)
lea    0x7(%rsp),%rdx
mov    $0x1,%ecx
call   1030 <strbuffer_insertn@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.strbuffer = type { i32 }
define i64 @strbuffer_insert_char(%struct.strbuffer* %0, i64 %1, i8 signext %2) {
%4 = alloca %struct.strbuffer*
%5 = alloca i64
%6 = alloca i8
store %struct.strbuffer* %0, %struct.strbuffer** %4
store i64 %1, i64* %5
store i8 %2, i8* %6
%7 = load %struct.strbuffer*, %struct.strbuffer** %4
%8 = load i64, i64* %5
%9 = call i64 @strbuffer_insertn(%struct.strbuffer* %7, i64 %8, i8* %6, i32 1)
ret i64 %9
}

LLVM IR (-O2):
%struct.strbuffer = type { i32 }
define i64 @strbuffer_insert_char(%struct.strbuffer* %0, i64 %1, i8 signext %2) {
%4 = alloca i8
store i8 %2, i8* %4
%5 = call i64 @strbuffer_insertn(%struct.strbuffer* %0, i64 %1, i8* %4, i32 1)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int main(void) {
  void daemonize(const char *);
  daemonize("hello, world");
  while (1)
    sleep(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <daemonize@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    113b <main+0x1b>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <daemonize@plt>
nopl   (%rax)
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
@.str = [13 x i8] c"hello, world\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @sleep(i32 1)
br label %2
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello, world\00"
define i32 @main() {
tail call void @daemonize(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @sleep(i32 1)
br label %1
}