xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int sosuu(int);
main() {
  int n;
  printf("n=");
  scanf("%d", &n);
  printf("sosuu(n)=%d\n", sosuu(n));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1040 <sosuu@plt>
mov    %eax,%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <sosuu@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"n=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"sosuu(n)=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @sosuu(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *subsSize(int subsval) {
  char *subsptr;
  subsptr = malloc(16 * sizeof(char));
  sprintf(subsptr, "%d",
          (int)((subsval + sizeof(double) - 1) / sizeof(double)));
  return (subsptr);
}


x86 assembly (clang, -O0):
<subsSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x4(%rbp),%rax
add    $0x8,%rax
sub    $0x1,%rax
shr    $0x3,%rax
mov    %eax,%edx
lea    0xeaa(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subsSize>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
movslq %ebp,%rdx
add    $0x7,%rdx
shr    $0x3,%rdx
lea    0xebc(%rip),%rsi
mov    %rax,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @subsSize(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @malloc(i32 16)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = add i64 %7, 8
%9 = sub i64 %8, 1
%10 = udiv i64 %9, 8
%11 = trunc i64 %10 to i32
%12 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define noalias i8* @subsSize(i32 %0) {
%2 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%3 = sext i32 %0 to i64
%4 = add nsw i64 %3, 7
%5 = lshr i64 %4, 3
%6 = trunc i64 %5 to i32
%7 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ uart0_send_char(char const);
void uart0_send_cstring(const char *cstring) {
  while (*cstring) {
    uart0_send_char(*cstring);
    ++cstring;
  }
}


x86 assembly (clang, -O0):
<uart0_send_cstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <uart0_send_cstring+0x36>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <uart0_send_char@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <uart0_send_cstring+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart0_send_cstring>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <uart0_send_cstring+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <uart0_send_char@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <uart0_send_cstring+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @uart0_send_cstring(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 i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @uart0_send_char(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
void f(int s, char *c, char *x1, char *x2, char *x3) {
  int a1, a2, a3;
  a1 = 2 * s;
  x1 = c + a1;
  *x1 = 1;
  a2 = 4 * s;
  x2 = c + a2;
  *x2 = 2;
  a3 = 6 * s;
  x3 = c + a3;
  *x3 = 3;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x2,(%rax)
imul   $0x6,-0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movb   $0x3,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movslq %edi,%rax
movb   $0x1,(%rsi,%rax,2)
movb   $0x2,(%rsi,%rax,4)
lea    (%rax,%rax,2),%rax
movb   $0x3,(%rsi,%rax,2)
ret

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

LLVM IR (-O2):
define void @f(i32 %0, i8* nocapture writeonly %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4) {
%6 = shl nsw i32 %0, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
store i8 1, i8* %8
%9 = shl nsw i32 %0, 2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %1, i64 %10
store i8 2, i8* %11
%12 = mul nsw i32 %0, 6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %1, i64 %13
store i8 3, i8* %14
ret void
}
/* Type definitions */
struct rq_asset_irvol {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rq_asset_irvol_free(struct rq_asset_irvol *);
void rq_asset_irvol_freefunc(void *asset_data) {
  rq_asset_irvol_free((struct rq_asset_irvol *)asset_data);
}


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

x86 assembly (clang, -O2):
<rq_asset_irvol_freefunc>:
jmp    1030 <rq_asset_irvol_free@plt>

LLVM IR (-O0):
%struct.rq_asset_irvol = type { i32 }
define void @rq_asset_irvol_freefunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.rq_asset_irvol*
%5 = call i32 @rq_asset_irvol_free(%struct.rq_asset_irvol* %4)
ret void
}

LLVM IR (-O2):
%struct.rq_asset_irvol = type { i32 }
define void @rq_asset_irvol_freefunc(i8* %0) {
%2 = bitcast i8* %0 to %struct.rq_asset_irvol*
%3 = tail call i32 @rq_asset_irvol_free(%struct.rq_asset_irvol* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void fatal(const char *message) {
  fprintf(stderr, "%s\n", message);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @fatal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *, char *);
main() {
  char c1, c2;
  printf("Please insert two characters:\n");
  scanf("%c %c", &c1, &c2);
  printf("\nYour characters were: %c and %c.\n", c1, c2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x1(%rbp),%rsi
lea    -0x2(%rbp),%rdx
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%esi
movsbl -0x2(%rbp),%edx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x7(%rsp),%rsi
lea    0x6(%rsp),%rdx
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%esi
movsbl 0x6(%rsp),%edx
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Please insert two characters:\0A\00"
@.str.1 = [6 x i8] c"%c %c\00"
@.str.2 = [35 x i8] c"\0AYour characters were: %c and %c.\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%c %c\00"
@.str.2 = [35 x i8] c"\0AYour characters were: %c and %c.\0A\00"
@str = [30 x i8] c"Please insert two characters:\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}
int main(int argc, char *argv[]) {
  char *cmd, *opt;
  unsigned int Flag;
  Flag = 1;
  while (Flag) {
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1128 <main+0x28>
jmp    1119 <main+0x19>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
/* Variables and functions */
char tolower(char);
unsigned int pencil_degradation(char character) {
  if (character == '\n' || character == ' ') {
    return 0;
  }
  if (character == tolower(character)) {
    return 1;
  }
  return 2;
}


x86 assembly (clang, -O0):
<pencil_degradation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1138 <pencil_degradation+0x28>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1144 <pencil_degradation+0x34>
movl   $0x0,-0x4(%rbp)
jmp    1177 <pencil_degradation+0x67>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0xc(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    1170 <pencil_degradation+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1177 <pencil_degradation+0x67>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pencil_degradation>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
cmp    $0xa,%bl
je     111f <pencil_degradation+0xf>
cmp    $0x20,%bl
jne    1121 <pencil_degradation+0x11>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <tolower@plt>
xor    %ecx,%ecx
cmp    %bl,%al
sete   %cl
mov    $0x2,%eax
sub    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @pencil_degradation(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %6
i8 10, label %6
]
2: ; preds = %1
%3 = tail call signext i8 @tolower(i8 signext %0)
%4 = icmp eq i8 %3, %0
%5 = select i1 %4, i32 1, i32 2
br label %6
6: ; preds = %2, %1, %1
%7 = phi i32 [ 0, %1 ], [ 0, %1 ], [ %5, %2 ]
ret i32 %7
}
char *strsub(char *s1, const char *s2, int start) {
  char *p;
  p = s1;
  s2 = s2 + start;
  while (*s2 != '\0') {
    *p = *s2;
    p++;
    s2++;
  }
  *p = '\0';
  return p;
}


x86 assembly (clang, -O0):
<strsub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115f <strsub+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1126 <strsub+0x26>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsub>:
mov    %rdi,%rax
movslq %edx,%rdx
mov    (%rsi,%rdx,1),%cl
test   %cl,%cl
je     1131 <strsub+0x31>
add    %rsi,%rdx
add    $0x1,%rdx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1120 <strsub+0x20>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @strsub(i8* writeonly %0, i8* nocapture %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %3, %8
%9 = phi i8 [ %14, %8 ], [ %6, %3 ]
%10 = phi i8* [ %12, %8 ], [ %0, %3 ]
%11 = phi i8* [ %13, %8 ], [ %5, %3 ]
store i8 %9, i8* %10
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %8, %3
%17 = phi i8* [ %0, %3 ], [ %12, %8 ]
store i8 0, i8* %17
ret i8* %17
}
main() {
  extern int bad;
  return bad;
}


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

x86 assembly (clang, -O2):
<main>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@bad = external global i32
define i32 @main() {
%1 = load i32, i32* @bad
ret i32 %1
}
void dfn_ac(c) char c;
{}


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

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

LLVM IR (-O0):
define void @dfn_ac(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
ret void
}

LLVM IR (-O2):
define void @dfn_ac(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char const);
char *btp_skip_non_whitespace_r(const char *s, const char *leftedge) {
  while (s >= leftedge && !isspace(*s))
    --s;
  return (char *)s;
}


x86 assembly (clang, -O0):
<btp_skip_non_whitespace_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
jb     114a <btp_skip_non_whitespace_r+0x3a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <btp_skip_non_whitespace_r+0x4a>
jmp    116b <btp_skip_non_whitespace_r+0x5b>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <btp_skip_non_whitespace_r+0x10>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btp_skip_non_whitespace_r>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmp    %rsi,%rdi
jb     1135 <btp_skip_non_whitespace_r+0x25>
mov    %rsi,%r14
nop
movsbl (%rbx),%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1135 <btp_skip_non_whitespace_r+0x25>
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jae    1120 <btp_skip_non_whitespace_r+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @btp_skip_non_whitespace_r(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %17, %2
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = icmp uge i8* %6, %7
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i32 @isspace(i8 signext %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %9, %5
%16 = phi i1 [ false, %5 ], [ %14, %9 ]
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 -1
store i8* %19, i8** %3
br label %5
20: ; preds = %15
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
define i8* @btp_skip_non_whitespace_r(i8* %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %12, label %4
4: ; preds = %2, %9
%5 = phi i8* [ %10, %9 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = tail call i32 @isspace(i8 signext %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 -1
%11 = icmp ult i8* %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %9, %2
%13 = phi i8* [ %0, %2 ], [ %10, %9 ], [ %5, %4 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *nni_alloc(size_t);
int strlen(char const *);
char *nni_strdup(const char *src) {
  char *dst;
  size_t len = strlen(src) + 1;
  if ((dst = nni_alloc(len)) != NULL) {
    memcpy(dst, src, len);
  }
  return (dst);
}


x86 assembly (clang, -O0):
<nni_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <nni_alloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1176 <nni_strdup+0x46>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nni_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1040 <nni_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <nni_strdup+0x31>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @nni_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @nni_alloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
/* Variables and functions */
char inch();
int /*<<< orphan*/ outch(char);
char inche(void) {
  char ch;
  ch = inch();
  outch(ch);
  return (char)ch;
}


x86 assembly (clang, -O0):
<inche>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <inch@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <outch@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inche>:
push   %rbx
xor    %eax,%eax
call   1040 <inch@plt>
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <outch@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @inche() {
%1 = alloca i8
%2 = call signext i8 (...) @inch()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = call i32 @outch(i8 signext %3)
%5 = load i8, i8* %1
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @inche() {
%1 = tail call signext i8 (...) @inch()
%2 = tail call i32 @outch(i8 signext %1)
ret i8 %1
}
/* Variables and functions */
int bar();
int hide_original_foo() { return 1 + bar(); }


x86 assembly (clang, -O0):
<hide_original_foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hide_original_foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hide_original_foo() {
%1 = call i32 (...) @bar()
%2 = add nsw i32 1, %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @hide_original_foo() {
%1 = tail call i32 (...) @bar()
%2 = add nsw i32 %1, 1
ret i32 %2
}
/* Type definitions */
typedef int time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gmtime_r(int *, struct tm *);
int main(void) {
  struct tm date;
  time_t time = 1221176626;
  int i;
  for (i = 0; i < 1000000; i++) {
    gmtime_r(&time, &date);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x48c9ad32,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xf4240,-0x10(%rbp)
jge    1155 <main+0x45>
lea    -0xc(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <gmtime_r@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x48c9ad32,0x4(%rsp)
48
mov    $0xf4240,%ebp
lea    0x4(%rsp),%r14
lea    0x8(%rsp),%rbx
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <gmtime_r@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1221176626, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %10, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 1000000
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 @gmtime_r(i32* %3, %struct.tm* %2)
br label %10
10: ; preds = %8
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
br label %5
13: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @main() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = bitcast %struct.tm* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 1221176626, i32* %2
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %8, %5 ]
%7 = call i32 @gmtime_r(i32* %2, %struct.tm* %1)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 1000000
br i1 %9, label %10, label %5
10: ; preds = %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void cpu_idle(void) {
  while (1)
    sleep(3600);
}


x86 assembly (clang, -O0):
<cpu_idle>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <cpu_idle+0x9>
mov    $0xe10,%edi
call   1030 <sleep@plt>
jmp    1119 <cpu_idle+0x9>

x86 assembly (clang, -O2):
<cpu_idle>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xe10,%edi
call   1030 <sleep@plt>
jmp    1120 <cpu_idle+0x10>

LLVM IR (-O0):
define void @cpu_idle() {
br label %1
1: ; preds = %0, %1
%2 = call i32 @sleep(i32 3600)
br label %1
}

LLVM IR (-O2):
define void @cpu_idle() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @sleep(i32 3600)
br label %1
}
int add(int a, int b, int (*add_value)(int, int)) { return (*add_value)(a, b); }


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
jmp    *%rdx

LLVM IR (-O0):
define i32 @add(i32 %0, i32 %1, i32 (i32, i32)* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32 (i32, i32)*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 (i32, i32)* %2, i32 (i32, i32)** %6
%7 = load i32 (i32, i32)*, i32 (i32, i32)** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 %7(i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1, i32 (i32, i32)* nocapture %2) {
%4 = tail call i32 %2(i32 %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage() {
  printf("Parameters:\n");
  printf("[ -file <name> ]           file to do the test on (default %s)\n",
         "mnt1_1/this_is_the_default_rw_2_proc_test_file_name");
  exit(-100);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xf0d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffff9c,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xf3c(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0xef5(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffff9c,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Parameters:\0A\00"
@.str.1 = [64 x i8] c"[ -file <name> ] file to do the test on (default %s)\0A\00"
@.str.2 = [52 x i8] c"mnt1_1/this_is_the_default_rw_2_proc_test_file_name\00"
define void @usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @exit(i32 -100)
unreachable
}

LLVM IR (-O2):
@.str.1 = [64 x i8] c"[ -file <name> ] file to do the test on (default %s)\0A\00"
@.str.2 = [52 x i8] c"mnt1_1/this_is_the_default_rw_2_proc_test_file_name\00"
@str = [12 x i8] c"Parameters:\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -100)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void mytool2_print(char *print_str) {
  printf("This is mytool2 print %s\n", print_str);
}


x86 assembly (clang, -O0):
<mytool2_print>:
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):
<mytool2_print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [26 x i8] c"This is mytool2 print %s\0A\00"
define void @mytool2_print(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int main(void) { return 42; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 42
}
/* Variables and functions */
int nrf_read_register(int, char *, char *);
int nrf_get_rf_channel(int *rfchannel, char *retstatus) {
  int ret;
  char reg_val;
  ret = nrf_read_register(0x05, &reg_val, retstatus);
  *rfchannel = reg_val;
  return ret;
}


x86 assembly (clang, -O0):
<nrf_get_rf_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x5,%edi
lea    -0x15(%rbp),%rsi
call   1030 <nrf_read_register@plt>
mov    %eax,-0x14(%rbp)
movsbl -0x15(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_get_rf_channel>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xf(%rsp),%rsi
mov    $0x5,%edi
call   1030 <nrf_read_register@plt>
movsbl 0xf(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @nrf_get_rf_channel(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @nrf_read_register(i32 5, i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = load i32*, i32** %3
store i32 %10, i32* %11
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @nrf_get_rf_channel(i32* nocapture writeonly %0, i8* %1) {
%3 = alloca i8
%4 = call i32 @nrf_read_register(i32 5, i8* %3, i8* %1)
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
store i32 %6, i32* %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void iv_zero(int *v) { memset(v + 1, 0, (*(int *)v) * sizeof(int)); }


x86 assembly (clang, -O0):
<iv_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iv_zero>:
mov    (%rdi),%edx
add    $0x4,%rdi
shl    $0x2,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @iv_zero(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 4
%9 = trunc i64 %8 to i32
%10 = call i32 @memset(i32* %4, i32 0, i32 %9)
ret void
}

LLVM IR (-O2):
define void @iv_zero(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %0
%4 = shl i32 %3, 2
%5 = tail call i32 @memset(i32* %2, i32 0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
void packet_unpack_login_req(const char *packet, char *name, char *password) {
  int len = (4 + 2);
  memcpy(name, packet + len, 32);
  len += 32;
  memcpy(password, packet + len, 32);
  len += 32;
}


x86 assembly (clang, -O0):
<packet_unpack_login_req>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x6,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    $0x20,%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    $0x20,%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x1c(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packet_unpack_login_req>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0x6(%rdi),%rsi
mov    %rax,%rdi
mov    $0x20,%edx
call   1030 <memcpy@plt>
add    $0x26,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @packet_unpack_login_req(i8* %0, i8* %1, i8* %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 6
%5 = tail call i32 @memcpy(i8* %1, i8* %4, i32 32)
%6 = getelementptr inbounds i8, i8* %0, i64 38
%7 = tail call i32 @memcpy(i8* %2, i8* %6, i32 32)
ret void
}
int test_imm_E2int64_midword_reg(long long val) {
  return ((val >> 16) & (0xE2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E2int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0xe2,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E2int64_midword_reg>:
test   $0xe20000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E2int64_midword_reg(i64 %0) {
%2 = and i64 %0, 14811136
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct reconos_thread {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ reconos_thread_create(struct reconos_thread *, int);
void __attribute__((deprecated))
reconos_hwt_create(struct reconos_thread *hwt, int slot, void *arg) {
  reconos_thread_create(hwt, slot);
}


x86 assembly (clang, -O0):
<reconos_hwt_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <reconos_thread_create@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reconos_hwt_create>:
jmp    1030 <reconos_thread_create@plt>

LLVM IR (-O0):
%struct.reconos_thread = type { i32 }
define void @reconos_hwt_create(%struct.reconos_thread* %0, i32 %1, i8* %2) {
%4 = alloca %struct.reconos_thread*
%5 = alloca i32
%6 = alloca i8*
store %struct.reconos_thread* %0, %struct.reconos_thread** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.reconos_thread*, %struct.reconos_thread** %4
%8 = load i32, i32* %5
%9 = call i32 @reconos_thread_create(%struct.reconos_thread* %7, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.reconos_thread = type { i32 }
define void @reconos_hwt_create(%struct.reconos_thread* %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @reconos_thread_create(%struct.reconos_thread* %0, i32 %1)
ret void
}
void white_skip(char **s) {
  while (((**s) == ' ' || (**s) == '\t' || (**s) == '\n' || (**s) == '\r'))
    (*s)++;
}


x86 assembly (clang, -O0):
<white_skip>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     1163 <white_skip+0x63>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x9(%rbp)
je     1163 <white_skip+0x63>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     1163 <white_skip+0x63>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1173 <white_skip+0x73>
jmp    1186 <white_skip+0x86>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1108 <white_skip+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<white_skip>:
mov    (%rdi),%rax
add    $0x1,%rax
movabs $0x100002600,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rax),%edx
cmp    $0x20,%rdx
ja     1139 <white_skip+0x39>
bt     %rdx,%rcx
jae    1139 <white_skip+0x39>
mov    %rax,(%rdi)
add    $0x1,%rax
jmp    1120 <white_skip+0x20>
ret

LLVM IR (-O0):
define void @white_skip(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %29, %1
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 32
br i1 %8, label %27, label %9
9: ; preds = %3
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 9
br i1 %14, label %27, label %15
15: ; preds = %9
%16 = load i8**, i8*** %2
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 10
br i1 %20, label %27, label %21
21: ; preds = %15
%22 = load i8**, i8*** %2
%23 = load i8*, i8** %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 13
br label %27
27: ; preds = %21, %15, %9, %3
%28 = phi i1 [ true, %15 ], [ true, %9 ], [ true, %3 ], [ %26, %21 ]
br i1 %28, label %29, label %33
29: ; preds = %27
%30 = load i8**, i8*** %2
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %30
br label %3
33: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @white_skip(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %6, %1
%4 = phi i8* [ %7, %6 ], [ %2, %1 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 32, label %6
i8 9, label %6
i8 10, label %6
i8 13, label %6
]
6: ; preds = %3, %3, %3, %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %7, i8** %0
br label %3
8: ; preds = %3
ret void
}
int test_imm_26uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x26 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_26uint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x26,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_26uint64_lowword_reg>:
test   $0x26,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_26uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 38
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ MurmurHash3_x64_128(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ strlen(int /*<<< orphan*/ *);
uint64_t ikv_hash_64(uint8_t *key, size_t size) {
  uint64_t a[2];
  MurmurHash3_x64_128(key, (strlen(key)), 0, a);
  return ((a[0]));
}


x86 assembly (clang, -O0):
<ikv_hash_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
lea    -0x18(%rbp),%rcx
xor    %edx,%edx
call   1040 <MurmurHash3_x64_128@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ikv_hash_64>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1040 <MurmurHash3_x64_128@plt>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ikv_hash_64(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca [2 x i32]
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @strlen(i32* %7)
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%10 = call i32 @MurmurHash3_x64_128(i32* %6, i32 %8, i32 0, i32* %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ikv_hash_64(i32* %0, i64 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = tail call i32 @strlen(i32* %0)
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%7 = call i32 @MurmurHash3_x64_128(i32* %0, i32 %5, i32 0, i32* %6)
%8 = load i32, i32* %6
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ run_tests();
int main() { run_tests(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @run_tests()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @run_tests()
ret i32 0
}
void d2i_ASN1_type_bytes(void) {}


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

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

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

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