xunge/DecIR huggingface dataset:
int test_imm_CAint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xCA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_CAint64_midword_mem>:
testb  $0xca,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_CAint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 13238272
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned short isgraph(char c) { return (c >= 0x21 && c <= 0x7E); }


x86 assembly (clang, -O0):
<isgraph>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x21,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isgraph+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgraph>:
add    $0xdf,%dil
xor    %eax,%eax
cmp    $0x5e,%dil
setb   %al
ret

LLVM IR (-O0):
define zeroext i16 @isgraph(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 33
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 126
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @isgraph(i8 signext %0) {
%2 = add i8 %0, -33
%3 = icmp ult i8 %2, 94
%4 = zext i1 %3 to i16
ret i16 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hallo World\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hallo World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int Q_isprint(int c) {
  if (c >= 0x20 && c <= 0x7E) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<Q_isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jl     1127 <Q_isprint+0x27>
cmpl   $0x7e,-0x8(%rbp)
jg     1127 <Q_isprint+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <Q_isprint+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @Q_isprint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 32
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 126
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @Q_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
void help_state_recv_msg(void *msg) {}


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

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

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

LLVM IR (-O2):
define void @help_state_recv_msg(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(
    char const *);
int fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(
    const char *text) {
  int pos = 0;
  pos =
      fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(
          text);
  if (pos != -1)
    return pos;
  return -1;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1144 <fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fn_al_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(i8* %0) {
%2 = tail call i32 @fn_sq_ch_79_ch_98_ch_106_ch_101_ch_99_ch_116_ch_77_ch_105_ch_110_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(i8* %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
char *process() {
  char *ret = (char *)malloc(100 * sizeof(char));
  strcpy(ret, "{\"cpu\":70 }");
  return ret;
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"{\22cpu\22:70 }\00"
define i8* @process() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 100)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %1
ret i8* %6
}

LLVM IR (-O2):
@.str = [12 x i8] c"{\22cpu\22:70 }\00"
define i8* @process() {
%1 = tail call i64 @malloc(i32 100)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ reg_set(int, int, int);
void sys_halt(int reg) {
  reg_set(0x0, 0x1, 0x0);
  exit(0);
}


x86 assembly (clang, -O0):
<sys_halt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <reg_set@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sys_halt>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <reg_set@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @sys_halt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @reg_set(i32 0, i32 1, i32 0)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sys_halt(i32 %0) {
%2 = tail call i32 @reg_set(i32 0, i32 1, i32 0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
int main() {
  int true_var = 5;
  int false_var = 0;
  return !((true_var || false_var) && !(true_var && false_var) &&
           (true_var && !false_var) && (true_var || false_var && false_var));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1132 <main+0x32>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     119d <main+0x9d>
cmpl   $0x0,-0x8(%rbp)
je     114b <main+0x4b>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jne    119d <main+0x9d>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     119d <main+0x9d>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jne    119d <main+0x9d>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xe(%rbp)
jne    1197 <main+0x97>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xf(%rbp)
je     1191 <main+0x91>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0xf(%rbp)
mov    -0xf(%rbp),%al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ ft_isupper(int);
int ft_tolower(int c) {
  if (ft_isupper(c))
    return (c - 'A' + 'a');
  return (c);
}


x86 assembly (clang, -O0):
<ft_tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ft_isupper@plt>
cmp    $0x0,%rax
je     113e <ft_tolower+0x2e>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <ft_tolower+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <ft_isupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ft_tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @ft_isupper(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 65
%10 = add nsw i32 %9, 97
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* %3
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @ft_tolower(i32 %0) {
%2 = tail call i64 @ft_isupper(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
int execute_mprotect() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_mprotect() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_mprotect() {
ret i32 0
}
int main() {
  __label__ bla$1;
  int x$1 = 20;
bla$1:;
  {
    __label__ break$1;
    switch (x$1) {
    case 1:;
      (x$1 = 10);
      goto break$1;
    default:;
      goto break$1;
    }
  break$1:;
  }
  goto bla$1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
jne    112f <main+0x2f>
jmp    1123 <main+0x23>
movl   $0xa,-0x8(%rbp)
jmp    1134 <main+0x34>
jmp    1134 <main+0x34>
jmp    1112 <main+0x12>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
switch i32 %4, label %6 [
i32 1, label %5
]
5: ; preds = %3
store i32 10, i32* %2
br label %7
6: ; preds = %3
br label %7
7: ; preds = %6, %5
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
int security_ip_defragment(struct sk_buff *skb) { return 0; }


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

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

LLVM IR (-O0):
%struct.sk_buff = type opaque
define i32 @security_ip_defragment(%struct.sk_buff* %0) {
%2 = alloca %struct.sk_buff*
store %struct.sk_buff* %0, %struct.sk_buff** %2
ret i32 0
}

LLVM IR (-O2):
%struct.sk_buff = type opaque
define i32 @security_ip_defragment(%struct.sk_buff* nocapture readnone %0) {
ret i32 0
}
unsigned short inw(unsigned short port) {
  unsigned short v;
  asm volatile("inw %1,%0" : "=a"(v) : "dN"(port));
  return v;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw $1,$0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw $1,$0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
void foo483() {}


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

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

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

LLVM IR (-O2):
define void @foo483() {
ret void
}
unsigned int fetch_byte(void *in_ptr, unsigned int byte_offset) {
  in_ptr = (char *)in_ptr + byte_offset;
  return (unsigned int)*(char *)in_ptr;
}


x86 assembly (clang, -O0):
<fetch_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetch_byte>:
mov    %esi,%eax
movsbl (%rdi,%rax,1),%eax
ret

LLVM IR (-O0):
define i32 @fetch_byte(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 = zext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @fetch_byte(i8* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
ret i32 %6
}
/* Variables and functions */
scalar_t__ rand_double_between(int, int);
int rand_between(int start, int end) {
  int randval = (int)(rand_double_between(start, end));
  return randval;
}


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

x86 assembly (clang, -O2):
<rand_between>:
jmp    1030 <rand_double_between@plt>

LLVM IR (-O0):
define i32 @rand_between(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i64 @rand_double_between(i32 %6, i32 %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @rand_between(i32 %0, i32 %1) {
%3 = tail call i64 @rand_double_between(i32 %0, i32 %1)
%4 = trunc i64 %3 to i32
ret i32 %4
}
float foo(double n) { return n * 2.0; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
addsd  %xmm0,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @foo(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 2.000000e+00
%5 = fptrunc double %4 to float
ret float %5
}

LLVM IR (-O2):
define float @foo(double %0) {
%2 = fmul double %0, 2.000000e+00
%3 = fptrunc double %2 to float
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ IntEnable(int);
int /*<<< orphan*/ IntRegister(int, void (*)());
void USBIntRegister(unsigned long ulBase, void (*pfnHandler)(void)) {
  ;
  IntRegister(60, pfnHandler);
  IntEnable(60);
}


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

x86 assembly (clang, -O2):
<USBIntRegister>:
push   %rax
mov    $0x3c,%edi
call   1040 <IntRegister@plt>
mov    $0x3c,%edi
pop    %rax
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @USBIntRegister(i64 %0, void ()* %1) {
%3 = alloca i64
%4 = alloca void ()*
store i64 %0, i64* %3
store void ()* %1, void ()** %4
%5 = load void ()*, void ()** %4
%6 = bitcast void ()* %5 to void (...)*
%7 = call i32 @IntRegister(i32 60, void (...)* %6)
%8 = call i32 @IntEnable(i32 60)
ret void
}

LLVM IR (-O2):
define void @USBIntRegister(i64 %0, void ()* %1) {
%3 = bitcast void ()* %1 to void (...)*
%4 = tail call i32 @IntRegister(i32 60, void (...)* %3)
%5 = tail call i32 @IntEnable(i32 60)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CompileArgument();
int /*<<< orphan*/ WriteInstruction(char *);
void CR_Colour(void) {
  CompileArgument();
  WriteInstruction("ld (23693),a");
  WriteInstruction("ld (23695),a");
}


x86 assembly (clang, -O0):
<CR_Colour>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <CompileArgument@plt>
lea    0xece(%rip),%rdi
call   1040 <WriteInstruction@plt>
lea    0xecf(%rip),%rdi
call   1040 <WriteInstruction@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CR_Colour>:
push   %rax
xor    %eax,%eax
call   1030 <CompileArgument@plt>
lea    0xed1(%rip),%rdi
call   1040 <WriteInstruction@plt>
lea    0xed2(%rip),%rdi
pop    %rax
jmp    1040 <WriteInstruction@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"ld (23693),a\00"
@.str.1 = [13 x i8] c"ld (23695),a\00"
define void @CR_Colour() {
%1 = call i32 (...) @CompileArgument()
%2 = call i32 @WriteInstruction(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @WriteInstruction(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"ld (23693),a\00"
@.str.1 = [13 x i8] c"ld (23695),a\00"
define void @CR_Colour() {
%1 = tail call i32 (...) @CompileArgument()
%2 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct dlnode {
  int dummy;
};
struct _inet_impl {
  int dummy;
};

/* Variables and functions */
long _net_destroy(struct _inet_impl *);
long _intranet_destroy(struct _inet_impl *inet) {
  long rslt;
  struct dlnode *dln, *rmv_dln;
  rslt = _net_destroy(inet);
  if (rslt < 0)
    goto error_ret;
  return 0;
error_ret:
  return -1;
}


x86 assembly (clang, -O0):
<_intranet_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_net_destroy@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1139 <_intranet_destroy+0x29>
jmp    1146 <_intranet_destroy+0x36>
movq   $0x0,-0x8(%rbp)
jmp    114e <_intranet_destroy+0x3e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_intranet_destroy>:
push   %rax
call   1030 <_net_destroy@plt>
sar    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct._inet_impl = type { i32 }
%struct.dlnode = type { i32 }
define i64 @_intranet_destroy(%struct._inet_impl* %0) {
%2 = alloca i64
%3 = alloca %struct._inet_impl*
%4 = alloca i64
%5 = alloca %struct.dlnode*
%6 = alloca %struct.dlnode*
store %struct._inet_impl* %0, %struct._inet_impl** %3
%7 = load %struct._inet_impl*, %struct._inet_impl** %3
%8 = call i64 @_net_destroy(%struct._inet_impl* %7)
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
br label %13
12: ; preds = %1
store i64 0, i64* %2
br label %14
13: ; preds = %11
store i64 -1, i64* %2
br label %14
14: ; preds = %13, %12
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
%struct._inet_impl = type { i32 }
%struct.dlnode = type { i32 }
define i64 @_intranet_destroy(%struct._inet_impl* %0) {
%2 = tail call i64 @_net_destroy(%struct._inet_impl* %0)
%3 = ashr i64 %2, 63
ret i64 %3
}
/* Type definitions */
struct passwd {
  char const *pw_name;
};

/* Variables and functions */
struct passwd *get_passwd_info();
const char *get_user_name(void) {
  const struct passwd *passwd = get_passwd_info();
  if (!passwd) {
    return NULL;
  }
  return passwd->pw_name;
}


x86 assembly (clang, -O0):
<get_user_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_passwd_info@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113b <get_user_name+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    1146 <get_user_name+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_user_name>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_passwd_info@plt>
test   %rax,%rax
je     1122 <get_user_name+0x12>
mov    (%rax),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.passwd = type { i8* }
define i8* @get_user_name() {
%1 = alloca i8*
%2 = alloca %struct.passwd*
%3 = call %struct.passwd* (...) @get_passwd_info()
store %struct.passwd* %3, %struct.passwd** %2
%4 = load %struct.passwd*, %struct.passwd** %2
%5 = icmp ne %struct.passwd* %4, null
br i1 %5, label %7, label %6
6: ; preds = %0
store i8* null, i8** %1
br label %11
7: ; preds = %0
%8 = load %struct.passwd*, %struct.passwd** %2
%9 = getelementptr inbounds %struct.passwd, %struct.passwd* %8, i32 0, i32 0
%10 = load i8*, i8** %9
store i8* %10, i8** %1
br label %11
11: ; preds = %7, %6
%12 = load i8*, i8** %1
ret i8* %12
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
define i8* @get_user_name() {
%1 = tail call %struct.passwd* (...) @get_passwd_info()
%2 = icmp eq %struct.passwd* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = getelementptr inbounds %struct.passwd, %struct.passwd* %1, i64 0, i32 0
%5 = load i8*, i8** %4
br label %6
6: ; preds = %0, %3
%7 = phi i8* [ %5, %3 ], [ null, %0 ]
ret i8* %7
}
void foo653() {}


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

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

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

LLVM IR (-O2):
define void @foo653() {
ret void
}
char *strcpy(to, from)
char *to;
const char *from;
{
  char *save = to;
  for (; (*to = *from) != '\0'; ++from, ++to)
    ;
  return (save);
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     114e <strcpy+0x4e>
jmp    1131 <strcpy+0x31>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     111f <strcpy+0x1f>
mov    $0x1,%ecx
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %9, %5 ], [ %0, %2 ]
%7 = phi i8* [ %8, %5 ], [ %1, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void __funlockfile(FILE *stream) {}


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

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

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

LLVM IR (-O2):
define void @__funlockfile(i32* nocapture %0) {
ret void
}
long assemble21(i)
unsigned long i;
{
  return (((i & 1) ? 0xfff00000 : 0) | ((i & 0x000ffe) << 8) |
          ((i & 0x00c000) >> 7) | ((i & 0x1f0000) >> 14) |
          ((i & 0x003000) >> 12));
}


x86 assembly (clang, -O0):
<assemble21>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x1,%rdx
xor    %eax,%eax
mov    $0xfff00000,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,%eax
mov    -0x8(%rbp),%rcx
and    $0xffe,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
and    $0xc000,%rcx
shr    $0x7,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
and    $0x1f0000,%rcx
shr    $0xe,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
and    $0x3000,%rcx
shr    $0xc,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble21>:
mov    %rdi,%rax
mov    %eax,%ecx
and    $0x1,%ecx
neg    %ecx
and    $0xfff00000,%ecx
mov    %eax,%edx
shl    $0x8,%edx
and    $0xffe00,%edx
mov    %rdi,%rsi
shr    $0x7,%rsi
and    $0x180,%esi
or     %rdx,%rsi
mov    %rdi,%rdx
shr    $0xe,%rdx
and    $0x7c,%edx
or     %rdx,%rsi
shr    $0xc,%eax
and    $0x3,%eax
or     %rsi,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @assemble21(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 1
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -1048576, i32 0
%8 = zext i32 %7 to i64
%9 = load i64, i64* %2
%10 = and i64 %9, 4094
%11 = shl i64 %10, 8
%12 = or i64 %8, %11
%13 = load i64, i64* %2
%14 = and i64 %13, 49152
%15 = lshr i64 %14, 7
%16 = or i64 %12, %15
%17 = load i64, i64* %2
%18 = and i64 %17, 2031616
%19 = lshr i64 %18, 14
%20 = or i64 %16, %19
%21 = load i64, i64* %2
%22 = and i64 %21, 12288
%23 = lshr i64 %22, 12
%24 = or i64 %20, %23
ret i64 %24
}

LLVM IR (-O2):
define i64 @assemble21(i64 %0) {
%2 = and i64 %0, 1
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i64 0, i64 4293918720
%5 = shl i64 %0, 8
%6 = and i64 %5, 1048064
%7 = lshr i64 %0, 7
%8 = and i64 %7, 384
%9 = lshr i64 %0, 14
%10 = and i64 %9, 124
%11 = lshr i64 %0, 12
%12 = and i64 %11, 3
%13 = or i64 %8, %6
%14 = or i64 %13, %10
%15 = or i64 %14, %12
%16 = or i64 %15, %4
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0xee() {
  Assert_real((isalnum(238) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              1195, ("isalnum should be 0 for 0xee"));
}


x86 assembly (clang, -O0):
<t_isalnum_0xee>:
push   %rbp
mov    %rsp,%rbp
mov    $0xee,%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4ab,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalnum_0xee>:
push   %rax
mov    $0xee,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4ab,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xee\00"
define void @t_isalnum_0xee() {
%1 = call i64 @isalnum(i32 238)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1195, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xee\00"
define void @t_isalnum_0xee() {
%1 = tail call i64 @isalnum(i32 238)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1195, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int atoi(char *);
scalar_t__ strlen(char *);
int toInt(char *buffer) {
  if (strlen(buffer) > 0)
    return atoi(&buffer[0]);
  return 0;
}


x86 assembly (clang, -O0):
<toInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1150 <toInt+0x30>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1157 <toInt+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toInt>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
jle    1137 <toInt+0x17>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <atoi@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @toInt(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @atoi(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(void) {
  fputs("UBSAN TEST START\n", stderr);
  unsigned int a = 1;
  a <<= 31;
  a <<= 1;
  fputs("UBSAN TEST END\n", stderr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xee3(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"UBSAN TEST START\0A\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"UBSAN TEST END\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @stderr
%4 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 1, i32* %2
%5 = load i32, i32* %2
%6 = shl i32 %5, 31
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = shl i32 %7, 1
store i32 %8, i32* %2
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"UBSAN TEST START\0A\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"UBSAN TEST END\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
struct vec3i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec3i_reflect(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ *);
__attribute__((always_)) struct vec3i *
psvec3i_reflect(struct vec3i *result, struct vec3i *a, struct vec3i *b) {
  vec3i_reflect((int32_t *)result, (int32_t *)a, (int32_t *)b);
  return result;
}


x86 assembly (clang, -O0):
<psvec3i_reflect>:
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
call   1030 <vec3i_reflect@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec3i_reflect>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec3i_reflect@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec3i = type { i32 }
define %struct.vec3i* @psvec3i_reflect(%struct.vec3i* %0, %struct.vec3i* %1, %struct.vec3i* %2) {
%4 = alloca %struct.vec3i*
%5 = alloca %struct.vec3i*
%6 = alloca %struct.vec3i*
store %struct.vec3i* %0, %struct.vec3i** %4
store %struct.vec3i* %1, %struct.vec3i** %5
store %struct.vec3i* %2, %struct.vec3i** %6
%7 = load %struct.vec3i*, %struct.vec3i** %4
%8 = bitcast %struct.vec3i* %7 to i32*
%9 = load %struct.vec3i*, %struct.vec3i** %5
%10 = bitcast %struct.vec3i* %9 to i32*
%11 = load %struct.vec3i*, %struct.vec3i** %6
%12 = bitcast %struct.vec3i* %11 to i32*
%13 = call i32 @vec3i_reflect(i32* %8, i32* %10, i32* %12)
%14 = load %struct.vec3i*, %struct.vec3i** %4
ret %struct.vec3i* %14
}

LLVM IR (-O2):
%struct.vec3i = type { i32 }
define %struct.vec3i* @psvec3i_reflect(%struct.vec3i* returned %0, %struct.vec3i* %1, %struct.vec3i* %2) {
%4 = getelementptr %struct.vec3i, %struct.vec3i* %0, i64 0, i32 0
%5 = getelementptr %struct.vec3i, %struct.vec3i* %1, i64 0, i32 0
%6 = getelementptr %struct.vec3i, %struct.vec3i* %2, i64 0, i32 0
%7 = tail call i32 @vec3i_reflect(i32* %4, i32* %5, i32* %6)
ret %struct.vec3i* %0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void __attribute__((regparm(3))) memcpy_15(void *dest, void *src) {
  memcpy(dest, src, 15);
}


x86 assembly (clang, -O0):
<memcpy_15>:
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    $0xf,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @memcpy_15(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 15)
ret void
}
/* Variables and functions */
unsigned long strtoul(char const *, char **, int);
unsigned long cstr_to_ulong(const char *s, size_t len, int *ok) {
  char *e;
  unsigned long res = strtoul(s, &e, 10);
  *ok = (e == s + len) && len != 0;
  return res;
}


x86 assembly (clang, -O0):
<cstr_to_ulong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rdx
add    -0x10(%rbp),%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x29(%rbp)
jne    115f <cstr_to_ulong+0x4f>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstr_to_ulong>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
add    %r15,%rbx
cmp    %rbx,0x8(%rsp)
sete   %cl
test   %r15,%r15
setne  %dl
and    %cl,%dl
movzbl %dl,%ecx
mov    %ecx,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @cstr_to_ulong(i8* %0, i64 %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i64 @strtoul(i8* %0, i8** %4, i32 10)
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %0, i64 %1
%9 = icmp eq i8* %7, %8
%10 = icmp ne i64 %1, 0
%11 = and i1 %10, %9
%12 = zext i1 %11 to i32
store i32 %12, i32* %2
ret i64 %6
}
void swap_call_by_value(int num1, int num2) {
  int tmp = num1;
  num1 = num2;
  num2 = tmp;
  printf("[%s] : addresses : &num1 = %p, &num2 = %p\n", __func__, &num1, &num2);
  printf("[%s] : num1 = %d, num2 = %d\n\n", __func__, num1, num2);
}


x86 assembly (clang, -O0):
<swap_call_by_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xec9(%rip),%rdi
lea    0xeed(%rip),%rsi
lea    -0x4(%rbp),%rdx
lea    -0x8(%rbp),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xee4(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_call_by_value>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,0xc(%rsp)
mov    %edi,0x8(%rsp)
lea    0xedc(%rip),%rdi
lea    0xf00(%rip),%rbx
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xef0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"[%s] : addresses : &num1 = %p, &num2 = %p\0A\00"
@__func__.swap_call_by_value = [19 x i8] c"swap_call_by_value\00"
@.str.1 = [30 x i8] c"[%s] : num1 = %d, num2 = %d\0A\0A\00"
define void @swap_call_by_value(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
store i32 %6, i32* %5
%7 = load i32, i32* %4
store i32 %7, i32* %3
%8 = load i32, i32* %5
store i32 %8, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.swap_call_by_value, i64 0, i64 0), i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.swap_call_by_value, i64 0, i64 0), i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"[%s] : addresses : &num1 = %p, &num2 = %p\0A\00"
@__func__.swap_call_by_value = [19 x i8] c"swap_call_by_value\00"
@.str.1 = [30 x i8] c"[%s] : num1 = %d, num2 = %d\0A\0A\00"
define void @swap_call_by_value(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %1, i32* %3
store i32 %0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.swap_call_by_value, i64 0, i64 0), i32* %3, i32* %4)
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.swap_call_by_value, i64 0, i64 0), i32 %6, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dump_mpgws();
void sig_dump(int signo) { dump_mpgws(); }


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

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

LLVM IR (-O0):
define void @sig_dump(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @dump_mpgws()
ret void
}

LLVM IR (-O2):
define void @sig_dump(i32 %0) {
%2 = tail call i32 (...) @dump_mpgws()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c_plsfnam(char const *);
int opt_o(const char *opt, const char *myoptarg, void *client_data) {
  (void)opt;
  (void)client_data;
  c_plsfnam(myoptarg);
  return 0;
}


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

x86 assembly (clang, -O2):
<opt_o>:
push   %rax
mov    %rsi,%rdi
call   1030 <c_plsfnam@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @opt_o(i8* nocapture readnone %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i32 @c_plsfnam(i8* %1)
ret i32 0
}
int cc_set_uc(const unsigned long start, const unsigned long end,
              const int uc) {
  return -1;
}


x86 assembly (clang, -O0):
<cc_set_uc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cc_set_uc(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
ret i32 -1
}

LLVM IR (-O2):
define i32 @cc_set_uc(i64 %0, i64 %1, i32 %2) {
ret i32 -1
}
/* Variables and functions */
double const sin(double const);
double get_vol_element(const double *x) { return x[0] * x[0] * sin(x[2]); }


x86 assembly (clang, -O0):
<get_vol_element>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_vol_element>:
push   %rax
movsd  (%rdi),%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm1,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @get_vol_element(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fmul double %5, %8
%10 = load double*, double** %2
%11 = getelementptr inbounds double, double* %10, i64 2
%12 = load double, double* %11
%13 = call double @sin(double %12)
%14 = fmul double %9, %13
ret double %14
}

LLVM IR (-O2):
define double @get_vol_element(double* nocapture %0) {
%2 = load double, double* %0
%3 = fmul double %2, %2
%4 = getelementptr inbounds double, double* %0, i64 2
%5 = load double, double* %4
%6 = tail call double @sin(double %5)
%7 = fmul double %3, %6
ret double %7
}