xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_usage(const char *prog_name) {
  printf("OVERVIEW: %s [OPTIONS]\n\n", prog_name);
  printf("OPTIONS:\n"
         "-f DB.CDB\tCDB database to open.\n"
         "-p PORT [7171] TCP port to listen on.\n"
         "-h\t\tShow this help screen.\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"OVERVIEW: %s [OPTIONS]\0A\0A\00"
@.str.1 = [107 x i8] c"OPTIONS:\0A-f DB.CDB\09CDB database to open.\0A-p PORT [7171] TCP port to listen on.\0A-h\09\09Show this help screen.\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"OVERVIEW: %s [OPTIONS]\0A\0A\00"
@str = [106 x i8] c"OPTIONS:\0A-f DB.CDB\09CDB database to open.\0A-p PORT [7171] TCP port to listen on.\0A-h\09\09Show this help screen.\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @str, i64 0, i64 0))
ret void
}
volatile char *build_push_reg(int reg_index, int x86_64f,
                              volatile char *tgt_addr) {
  if (x86_64f) {
    (*(char *)tgt_addr) = (0x40 | 0x1);
    tgt_addr += 0x1;
  }
  (*(char *)tgt_addr) = 0x50 + reg_index;
  ;
  tgt_addr += 0x1;
  return (tgt_addr);
}


x86 assembly (clang, -O0):
<build_push_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112b <build_push_reg+0x2b>
mov    -0x10(%rbp),%rax
movb   $0x41,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_push_reg>:
mov    %rdx,%rax
test   %esi,%esi
je     110e <build_push_reg+0xe>
movb   $0x41,(%rax)
add    $0x1,%rax
add    $0x50,%dil
mov    %dil,(%rax)
add    $0x1,%rax
ret

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

LLVM IR (-O2):
define i8* @build_push_reg(i32 %0, i32 %1, i8* writeonly %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %3
store i8 65, i8* %2
%6 = getelementptr inbounds i8, i8* %2, i64 1
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ %6, %5 ], [ %2, %3 ]
%9 = trunc i32 %0 to i8
%10 = add i8 %9, 80
store i8 %10, i8* %8
%11 = getelementptr inbounds i8, i8* %8, i64 1
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void go(char **board, char piece, int n) {
  printf("--> going to: %d\n", n);
  --n;
  board[n / 3][n % 3] = piece;
}


x86 assembly (clang, -O0):
<go>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,%ecx
mov    -0x11(%rbp),%dl
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<go>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xedd(%rip),%rdi
mov    %edx,%esi
call   1030 <printf@plt>
lea    -0x1(%rbx),%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
cltq
mov    0x0(%rbp,%rax,8),%rcx
lea    (%rax,%rax,2),%eax
neg    %eax
add    %ebx,%eax
add    $0xffffffff,%eax
cltq
mov    %r14b,(%rcx,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"--> going to: %d\0A\00"
define void @go(i8** nocapture %0, i8 signext %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = add nsw i32 %2, -1
%6 = sdiv i32 %5, 3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = srem i32 %5, 3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8 %1, i8* %12
ret void
}
/* Variables and functions */
int at_tok_nextint_base(char **, int *, int, int);
int at_tok_nexthexint(char **p_cur, int *p_out) {
  return at_tok_nextint_base(p_cur, p_out, 16, 1);
}


x86 assembly (clang, -O0):
<at_tok_nexthexint>:
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    $0x10,%edx
mov    $0x1,%ecx
call   1030 <at_tok_nextint_base@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_tok_nexthexint>:
mov    $0x10,%edx
mov    $0x1,%ecx
jmp    1030 <at_tok_nextint_base@plt>

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

LLVM IR (-O2):
define i32 @at_tok_nexthexint(i8** %0, i32* %1) {
%3 = tail call i32 @at_tok_nextint_base(i8** %0, i32* %1, i32 16, i32 1)
ret i32 %3
}
/* Type definitions */
struct lirc_config {
  int dummy;
};

/* Variables and functions */
int lirc_readconfig_only_internal(char const *, struct lirc_config **,
                                  int (*)(char *), int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *);
int lirc_readconfig_only(const char *file, struct lirc_config **config,
                         int(check)(char *s)) {
  return lirc_readconfig_only_internal(file, config, check, NULL, NULL);
}


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

x86 assembly (clang, -O2):
<lirc_readconfig_only>:
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <lirc_readconfig_only_internal@plt>

LLVM IR (-O0):
%struct.lirc_config = type { i32 }
define i32 @lirc_readconfig_only(i8* %0, %struct.lirc_config** %1, i32 (i8*)* %2) {
%4 = alloca i8*
%5 = alloca %struct.lirc_config**
%6 = alloca i32 (i8*)*
store i8* %0, i8** %4
store %struct.lirc_config** %1, %struct.lirc_config*** %5
store i32 (i8*)* %2, i32 (i8*)** %6
%7 = load i8*, i8** %4
%8 = load %struct.lirc_config**, %struct.lirc_config*** %5
%9 = load i32 (i8*)*, i32 (i8*)** %6
%10 = call i32 @lirc_readconfig_only_internal(i8* %7, %struct.lirc_config** %8, i32 (i8*)* %9, i32* null, i32* null)
ret i32 %10
}

LLVM IR (-O2):
%struct.lirc_config = type { i32 }
define i32 @lirc_readconfig_only(i8* %0, %struct.lirc_config** %1, i32 (i8*)* %2) {
%4 = tail call i32 @lirc_readconfig_only_internal(i8* %0, %struct.lirc_config** %1, i32 (i8*)* %2, i32* null, i32* null)
ret i32 %4
}
unsigned int get_be32(unsigned int v_) {
  const unsigned char *v = (const unsigned char *)&v_;
  unsigned int r = v[0];
  r <<= 8;
  r |= v[1];
  r <<= 8;
  r |= v[2];
  r <<= 8;
  r |= v[3];
  return r;
}


x86 assembly (clang, -O0):
<get_be32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_be32>:
mov    %edi,%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @get_be32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int time_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
void z_ms_t(time_t ms, struct timeval *t) {
  t->tv_sec = ms / 1000;
  t->tv_usec = ms - t->tv_sec * 1000;
}


x86 assembly (clang, -O0):
<z_ms_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
imul   $0x3e8,(%rax),%eax
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_ms_t>:
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,(%rsi)
imul   $0xfffffc18,%ecx,%ecx
add    %ecx,%eax
mov    %eax,0x4(%rsi)
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @z_ms_t(i32 %0, %struct.timeval* %1) {
%3 = alloca i32
%4 = alloca %struct.timeval*
store i32 %0, i32* %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load i32, i32* %3
%6 = sdiv i32 %5, 1000
%7 = load %struct.timeval*, %struct.timeval** %4
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
store i32 %6, i32* %8
%9 = load i32, i32* %3
%10 = load %struct.timeval*, %struct.timeval** %4
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = mul nsw i32 %12, 1000
%14 = sub nsw i32 %9, %13
%15 = load %struct.timeval*, %struct.timeval** %4
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
store i32 %14, i32* %16
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @z_ms_t(i32 %0, %struct.timeval* nocapture writeonly %1) {
%3 = sdiv i32 %0, 1000
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store i32 %3, i32* %4
%5 = mul nsw i32 %3, -1000
%6 = add i32 %5, %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store i32 %6, i32* %7
ret void
}
/* Variables and functions */
int get_byte(char *);
int get_word(char *s) { return get_byte(s) * 256 + get_byte(s + 2); }


x86 assembly (clang, -O0):
<get_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_byte@plt>
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
call   1030 <get_byte@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_word>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get_byte@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
add    $0x2,%rbx
mov    %rbx,%rdi
call   1030 <get_byte@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_word(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @get_byte(i8* %3)
%5 = mul nsw i32 %4, 256
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 2
%8 = call i32 @get_byte(i8* %7)
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_word(i8* %0) {
%2 = tail call i32 @get_byte(i8* %0)
%3 = shl nsw i32 %2, 8
%4 = getelementptr inbounds i8, i8* %0, i64 2
%5 = tail call i32 @get_byte(i8* %4)
%6 = add nsw i32 %3, %5
ret i32 %6
}
/* Variables and functions */
unsigned int f37(unsigned int);
unsigned int f38(unsigned int a) { return f37(f37(a)); }


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

x86 assembly (clang, -O2):
<f38>:
push   %rax
call   1030 <f37@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f37@plt>

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

LLVM IR (-O2):
define i32 @f38(i32 %0) {
%2 = tail call i32 @f37(i32 %0)
%3 = tail call i32 @f37(i32 %2)
ret i32 %3
}
void delay_us(volatile unsigned int time) {
  volatile unsigned int i;
  while (time > 0) {
    for (i = 0; i < 5 / 2; i++)
      ;
    time--;
  }
}


x86 assembly (clang, -O0):
<delay_us>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x0,%eax
jbe    1147 <delay_us+0x47>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x2,%eax
jae    1139 <delay_us+0x39>
jmp    112b <delay_us+0x2b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111a <delay_us+0x1a>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <delay_us+0x7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_us>:
mov    %edi,-0x4(%rsp)
jmp    1115 <delay_us+0x15>
cs nopw 0x0(%rax,%rax,1)
addl   $0xffffffff,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
je     1140 <delay_us+0x40>
movl   $0x0,-0x8(%rsp)
mov    -0x8(%rsp),%eax
cmp    $0x1,%eax
ja     1110 <delay_us+0x10>
nopl   (%rax)
addl   $0x1,-0x8(%rsp)
mov    -0x8(%rsp),%eax
cmp    $0x2,%eax
jb     1130 <delay_us+0x30>
jmp    1110 <delay_us+0x10>
ret

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

LLVM IR (-O2):
define void @delay_us(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store volatile i32 %0, i32* %2
%4 = bitcast i32* %3 to i8*
%5 = load volatile i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %1, %15
store volatile i32 0, i32* %3
%8 = load volatile i32, i32* %3
%9 = icmp ult i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %7, %10
%11 = load volatile i32, i32* %3
%12 = add i32 %11, 1
store volatile i32 %12, i32* %3
%13 = load volatile i32, i32* %3
%14 = icmp ult i32 %13, 2
br i1 %14, label %10, label %15
15: ; preds = %10, %7
%16 = load volatile i32, i32* %2
%17 = add i32 %16, -1
store volatile i32 %17, i32* %2
%18 = load volatile i32, i32* %2
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %7
20: ; preds = %15, %1
ret void
}
int *address_of_local(void) {
  int some_local;
  return &some_local;
}


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

x86 assembly (clang, -O2):
<address_of_local>:
lea    -0x4(%rsp),%rax
ret

LLVM IR (-O0):
define i32* @address_of_local() {
%1 = alloca i32
ret i32* %1
}

LLVM IR (-O2):
define noalias i32* @address_of_local() {
%1 = alloca i32
ret i32* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/
convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3(
    int /*<<< orphan*/ *, int /*<<< orphan*/ *);
extern void
convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3_sse41(
    __m128i *in, __m128i *out) {
  convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3(in, out);
}


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

x86 assembly (clang, -O2):
<convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3_sse41>:
jmp    1030 <convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3@plt>

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

LLVM IR (-O2):
define void @convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3_sse41(i32* %0, i32* %1) {
%3 = tail call i32 @convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3(i32* %0, i32* %1)
ret void
}
void *test_anti_range_125(signed char n) {
  extern void *alloc_anti_range_125(signed char) __attribute__((alloc_size(1)));
  if ((-0x7f - 1) + 2 <= n && n <= 1)
    n = (-0x7f - 1) + 2 - 1;
  return alloc_anti_range_125(n);
}


x86 assembly (clang, -O0):
<test_anti_range_125>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0xffffff82,%eax
cmp    %ecx,%eax
jg     1140 <test_anti_range_125+0x30>
movsbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jg     1140 <test_anti_range_125+0x30>
movb   $0x81,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <alloc_anti_range_125@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_125>:
mov    %edi,%eax
add    $0x7e,%al
mov    $0x81,%eax
cmovs  %edi,%eax
movsbl %al,%edi
jmp    1030 <alloc_anti_range_125@plt>

LLVM IR (-O0):
define i8* @test_anti_range_125(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 -126, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 -127, i8* %2
br label %11
11: ; preds = %10, %6, %1
%12 = load i8, i8* %2
%13 = call i8* @alloc_anti_range_125(i8 signext %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @test_anti_range_125(i8 signext %0) {
%2 = add i8 %0, 126
%3 = icmp sgt i8 %2, -1
%4 = select i1 %3, i8 -127, i8 %0
%5 = tail call i8* @alloc_anti_range_125(i8 signext %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ interrupt_hw_handler(int);
void _external() { interrupt_hw_handler(1); }


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

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

LLVM IR (-O0):
define void @_external() {
%1 = call i32 @interrupt_hw_handler(i32 1)
ret void
}

LLVM IR (-O2):
define void @_external() {
%1 = tail call i32 @interrupt_hw_handler(i32 1)
ret void
}
/* Variables and functions */
int __dup(int);
int dup(int oldfd) { return __dup(oldfd); }


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

x86 assembly (clang, -O2):
<dup>:
jmp    1030 <__dup@plt>

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

LLVM IR (-O2):
define i32 @dup(i32 %0) {
%2 = tail call i32 @__dup(i32 %0)
ret i32 %2
}
/* Variables and functions */
int __infer_nondet_int();
int mblen(const char *s, size_t n) { return __infer_nondet_int(); }


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

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

LLVM IR (-O0):
define i32 @mblen(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = call i32 (...) @__infer_nondet_int()
ret i32 %5
}

LLVM IR (-O2):
define i32 @mblen(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i32 (...) @__infer_nondet_int()
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void print_code_footer(FILE *fp) {
  fputs("\n"
        "  "
        "return EXIT_SUCCESS;\n"
        "}\n",
        fp);
}


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

x86 assembly (clang, -O2):
<print_code_footer>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
@.str = [27 x i8] c"\0A return EXIT_SUCCESS;\0A}\0A\00"
define void @print_code_footer(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 26, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execve(char *, char **, char **);
int main(int argc, char **argv, char **envp) {
  execve("/usr/local/pf/bin/pfcmd.pl", argv, envp);
  return 127;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec7(%rip),%rdi
call   1030 <execve@plt>
mov    $0x7f,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [27 x i8] c"/usr/local/pf/bin/pfcmd.pl\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i8**, i8*** %6
%9 = load i8**, i8*** %7
%10 = call i32 @execve(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %8, i8** %9)
ret i32 127
}

LLVM IR (-O2):
@.str = [27 x i8] c"/usr/local/pf/bin/pfcmd.pl\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = tail call i32 @execve(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %1, i8** %2)
ret i32 127
}
/* Variables and functions */
char getchar();
char nb_get_char(void) { return getchar(); }


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

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

LLVM IR (-O0):
define signext i8 @nb_get_char() {
%1 = call signext i8 (...) @getchar()
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @nb_get_char() {
%1 = tail call signext i8 (...) @getchar()
ret i8 %1
}
int check_prime(int num) {
  int i;
  if (num == 1) {
    return 0;
  }
  for (i = 2; i < num; i = i + 1) {
    if (num % i == 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111d <check_prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1166 <check_prime+0x66>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <check_prime+0x5f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    114c <check_prime+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1166 <check_prime+0x66>
jmp    1151 <check_prime+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <check_prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
xor    %ecx,%ecx
cmp    $0x1,%edi
jne    110a <check_prime+0xa>
mov    %ecx,%eax
ret
cmp    $0x3,%edi
jl     1130 <check_prime+0x30>
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <check_prime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <check_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 2
br i1 %4, label %7, label %12
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}
void free_array(int **a, int m) {
  int i;
  for (i = 0; i < m; ++i) {
    free(a[i]);
  }
  free(a);
}


x86 assembly (clang, -O0):
<free_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_array+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_array+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

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


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

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

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

LLVM IR (-O2):
define void @check_memory_gf_outmap_c() {
ret void
}
unsigned long strlen(const char *str) {
  register const char *s;
  for (s = str; *s; ++s)
    ;
  return (s - str);
}


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

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
void shell_sub(job) char *job;
{
  char *command;
  command = job;
  while (!isspace((int)*command))
    command++;
  if (*command) {
    system(command);
  } else {
    input_error("shell");
  }
}


x86 assembly (clang, -O0):
<shell_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1165 <shell_sub+0x35>
jmp    1176 <shell_sub+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <shell_sub+0x14>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1193 <shell_sub+0x63>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <system@plt>
jmp    11a1 <shell_sub+0x71>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <input_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shell_sub>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%ebp
add    $0x1,%rbx
movsbl %bpl,%edi
call   1040 <isspace@plt>
test   %eax,%eax
je     1140 <shell_sub+0x10>
test   %bpl,%bpl
je     116a <shell_sub+0x3a>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <system@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <input_error@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"shell\00"
define void @shell_sub(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %12, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 @isspace(i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
br label %5
15: ; preds = %5
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %20)
br label %24
22: ; preds = %15
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @input_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"shell\00"
define void @shell_sub(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %8, %2 ]
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = tail call i32 @isspace(i32 %5)
%7 = icmp eq i32 %6, 0
%8 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %7, label %2, label %9
9: ; preds = %2
%10 = icmp eq i8 %4, 0
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = tail call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %3)
br label %15
13: ; preds = %9
%14 = tail call i32 (i8*, ...) bitcast (i32 (...)* @input_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret void
}
long long factorial(int n) {
  if (n < 2) {
    return n;
  }
  return n * factorial(n - 1);
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1132 <factorial+0x22>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <factorial+0x44>
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factorial@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%ecx
cmp    $0x2,%edi
jl     1136 <factorial+0x36>
mov    %edi,%eax
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rax,%rcx
lea    -0x1(%rax),%rdx
cmp    $0x3,%rax
mov    %rdx,%rax
jae    1120 <factorial+0x20>
mov    $0x1,%edi
movslq %edi,%rax
imul   %rcx,%rax
ret

LLVM IR (-O0):
define i64 @factorial(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 2
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
store i64 %8, i64* %2
br label %16
9: ; preds = %1
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call i64 @factorial(i32 %13)
%15 = mul nsw i64 %11, %14
store i64 %15, i64* %2
br label %16
16: ; preds = %9, %6
%17 = load i64, i64* %2
ret i64 %17
}

LLVM IR (-O2):
define i64 @factorial(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
br label %10
5: ; preds = %10, %1
%6 = phi i64 [ 1, %1 ], [ %14, %10 ]
%7 = phi i32 [ %0, %1 ], [ 1, %10 ]
%8 = sext i32 %7 to i64
%9 = mul nsw i64 %6, %8
ret i64 %9
10: ; preds = %3, %10
%11 = phi i64 [ %4, %3 ], [ %13, %10 ]
%12 = phi i64 [ 1, %3 ], [ %14, %10 ]
%13 = add nsw i64 %11, -1
%14 = mul nsw i64 %12, %11
%15 = icmp ult i64 %11, 3
br i1 %15, label %5, label %10
}
/* Type definitions */
struct iax_ie_data {
  int dummy;
};
typedef int /*<<< orphan*/ newval;

/* Variables and functions */
unsigned int htonl(unsigned int);
int iax_ie_append_raw(struct iax_ie_data *, unsigned char, unsigned int *, int);
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie,
                      unsigned int value) {
  unsigned int newval;
  newval = htonl(value);
  return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
}


x86 assembly (clang, -O0):
<iax_ie_append_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rdx
mov    $0x4,%ecx
movzbl -0x9(%rbp),%esi
call   1040 <iax_ie_append_raw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iax_ie_append_int>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %edx,%edi
call   1030 <htonl@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x4,%ecx
call   1040 <iax_ie_append_raw@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.iax_ie_data = type { i32 }
define i32 @iax_ie_append_int(%struct.iax_ie_data* %0, i8 zeroext %1, i32 %2) {
%4 = alloca %struct.iax_ie_data*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
store %struct.iax_ie_data* %0, %struct.iax_ie_data** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @htonl(i32 %8)
store i32 %9, i32* %7
%10 = load %struct.iax_ie_data*, %struct.iax_ie_data** %4
%11 = load i8, i8* %5
%12 = call i32 @iax_ie_append_raw(%struct.iax_ie_data* %10, i8 zeroext %11, i32* %7, i32 4)
ret i32 %12
}

LLVM IR (-O2):
%struct.iax_ie_data = type { i32 }
define i32 @iax_ie_append_int(%struct.iax_ie_data* %0, i8 zeroext %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @htonl(i32 %2)
store i32 %6, i32* %4
%7 = call i32 @iax_ie_append_raw(%struct.iax_ie_data* %0, i8 zeroext %1, i32* %4, i32 4)
ret i32 %7
}
/* Variables and functions */
unsigned int __blci_u32(unsigned int);
unsigned int test__blci_u32(unsigned int a) { return __blci_u32(a); }


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

x86 assembly (clang, -O2):
<test__blci_u32>:
jmp    1030 <__blci_u32@plt>

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

LLVM IR (-O2):
define i32 @test__blci_u32(i32 %0) {
%2 = tail call i32 @__blci_u32(i32 %0)
ret i32 %2
}
/* Variables and functions */
unsigned int strlen(char *);
void fit(char *string, unsigned int size) {
  if (strlen(string) > size)
    string[size] = '\0';
}


x86 assembly (clang, -O0):
<fit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0xc(%rbp),%eax
jbe    113c <fit+0x2c>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    %ebp,%eax
jbe    1127 <fit+0x17>
mov    %ebp,%eax
movb   $0x0,(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fit(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp ugt i32 %3, %1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = zext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
br label %8
8: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
void exit_if_null(void *ptr) {
  if (ptr == NULL) {
    error("unexpected null pointer. Out of memory?\n");
    exit(69);
  }
}


x86 assembly (clang, -O0):
<exit_if_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114d <exit_if_null+0x2d>
lea    0xec2(%rip),%rdi
call   1030 <error@plt>
mov    $0x45,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_if_null>:
test   %rdi,%rdi
je     1126 <exit_if_null+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <error@plt>
mov    $0x45,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"unexpected null pointer. Out of memory?\0A\00"
define void @exit_if_null(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 69)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"unexpected null pointer. Out of memory?\0A\00"
define void @exit_if_null(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 69)
unreachable
6: ; preds = %1
ret void
}
void *f(void) {
  void *r;
  r = (long unsigned int)(void *)0;
  return (long unsigned int)(void *)0;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @f() {
%1 = alloca i8*
store i8* null, i8** %1
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @f() {
ret i8* null
}
/* Variables and functions */
double exp(double);
double f2(double x) { return exp(-x * x); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
movapd 0xee8(%rip),%xmm1
xorpd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @f2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = call double @exp(double %6)
ret double %7
}

LLVM IR (-O2):
define double @f2(double %0) {
%2 = fneg double %0
%3 = fmul double %2, %0
%4 = tail call double @exp(double %3)
ret double %4
}
int foo(unsigned char f) { return f; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @foo(i8 zeroext %0) {
%2 = zext i8 %0 to i32
ret i32 %2
}