xunge/DecIR huggingface dataset:
int SNDWavReset() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @SNDWavReset() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print(char *);
void PlutoError(int condition, char *str) {
  char *str_err = "! Error: ";
  if (condition) {
    print(str_err);
    print(str);
    print("\n");
    exit(1);
    ;
  }
}


x86 assembly (clang, -O0):
<PlutoError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     116c <PlutoError+0x4c>
mov    -0x18(%rbp),%rdi
call   1030 <print@plt>
mov    -0x10(%rbp),%rdi
call   1030 <print@plt>
lea    0xead(%rip),%rdi
call   1030 <print@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PlutoError>:
test   %edi,%edi
jne    1125 <PlutoError+0x5>
ret
push   %rbx
mov    %rsi,%rbx
lea    0xed0(%rip),%rdi
call   1030 <print@plt>
mov    %rbx,%rdi
call   1030 <print@plt>
lea    0xec6(%rip),%rdi
call   1030 <print@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"! Error: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @PlutoError(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = call i32 @print(i8* %9)
%11 = load i8*, i8** %4
%12 = call i32 @print(i8* %11)
%13 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"! Error: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @PlutoError(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 @print(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @print(i8* %1)
%7 = tail call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret void
}
int test_imm_D5int64_lowword_mem(long long *val) {
  return ((*val) & (0xD5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D5int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 213
%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_D5int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 213
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ f(int);
int main() {
  int a, b, c;
  if (f(a)) {
    b = 0;
    c = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <f@plt>
cmp    $0x0,%rax
je     113f <main+0x2f>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @f(i32 undef)
ret i32 0
}
int ia_end_vector(struct iarchive *ia, const char *tag) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.iarchive = type opaque
define i32 @ia_end_vector(%struct.iarchive* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
unsigned int str_len(char *t) {
  char *s = t;
  while (*t++)
    ;
  t--;
  return (unsigned int)(t - s);
}


x86 assembly (clang, -O0):
<str_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     112d <str_len+0x2d>
jmp    1110 <str_len+0x10>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_len>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <str_len+0x10>
ret

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

LLVM IR (-O2):
define i32 @str_len(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
int main() { return 1 & 2; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void setgrent(void) {}


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

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

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

LLVM IR (-O2):
define void @setgrent() {
ret void
}
/* Variables and functions */
size_t ft_nbrlen(long n) {
  size_t len;
  len = (n < 0) ? 2 : 1;
  n = (n < 0) ? -n : n;
  while (n > 9) {
    len++;
    n /= 10;
  }
  return (len);
}


x86 assembly (clang, -O0):
<ft_nbrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%eax
mov    $0x2,%ecx
cmp    $0x0,%rdx
cmovl  %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    113d <ft_nbrlen+0x3d>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1145 <ft_nbrlen+0x45>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x9,-0x8(%rbp)
jle    117b <ft_nbrlen+0x7b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    114d <ft_nbrlen+0x4d>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_nbrlen>:
mov    %rdi,%rcx
shr    $0x3f,%rcx
add    $0x1,%rcx
mov    %rdi,%rsi
neg    %rsi
cmovs  %rdi,%rsi
cmp    $0xa,%rsi
jb     1147 <ft_nbrlen+0x47>
movabs $0xcccccccccccccccd,%rdi
cc cc cc
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rcx
mov    %rsi,%rax
mul    %rdi
shr    $0x3,%rdx
cmp    $0x63,%rsi
mov    %rdx,%rsi
ja     1130 <ft_nbrlen+0x30>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @ft_nbrlen(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp slt i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 2, i32 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %2
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i64, i64* %2
%13 = sub nsw i64 0, %12
br label %16
14: ; preds = %1
%15 = load i64, i64* %2
br label %16
16: ; preds = %14, %11
%17 = phi i64 [ %13, %11 ], [ %15, %14 ]
store i64 %17, i64* %2
br label %18
18: ; preds = %21, %16
%19 = load i64, i64* %2
%20 = icmp sgt i64 %19, 9
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i64, i64* %3
%23 = add i64 %22, 1
store i64 %23, i64* %3
%24 = load i64, i64* %2
%25 = sdiv i64 %24, 10
store i64 %25, i64* %2
br label %18
26: ; preds = %18
%27 = load i64, i64* %3
ret i64 %27
}

LLVM IR (-O2):
define i64 @ft_nbrlen(i64 %0) {
%2 = icmp slt i64 %0, 0
%3 = select i1 %2, i64 2, i64 1
%4 = sub nsw i64 0, %0
%5 = select i1 %2, i64 %4, i64 %0
%6 = icmp ugt i64 %5, 9
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = phi i64 [ %10, %7 ], [ %3, %1 ]
%9 = phi i64 [ %11, %7 ], [ %5, %1 ]
%10 = add i64 %8, 1
%11 = udiv i64 %9, 10
%12 = icmp ugt i64 %9, 99
br i1 %12, label %7, label %13
13: ; preds = %7, %1
%14 = phi i64 [ %3, %1 ], [ %10, %7 ]
ret i64 %14
}
void gtk_text_view_get_iter_at_position() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_view_get_iter_at_position() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
size_t strxfrm(char *restrict dest, const char *restrict src, size_t n) {
  size_t l = strlen(src);
  if (n > l)
    strcpy(dest, src);
  return l;
}


x86 assembly (clang, -O0):
<strxfrm>:
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   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    115c <strxfrm+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxfrm>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
cmp    %r12,%rax
jae    114c <strxfrm+0x2c>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @strxfrm(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp ult i64 %4, %2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @strcpy(i8* %0, i8* %1)
br label %8
8: ; preds = %6, %3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ native_safe_halt();
__attribute__((always_)) void raw_safe_halt(void) { native_safe_halt(); }


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

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

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

LLVM IR (-O2):
define void @raw_safe_halt() {
%1 = tail call i32 (...) @native_safe_halt()
ret void
}
/* Variables and functions */
scalar_t__ strcmp(scalar_t__, char *);
scalar_t__ strrchr(char const *, char);
char *get_mime_type_from_filename(const char *filename) {
  if (strcmp(strrchr(filename, '.') + 1, "png") == 0) {
    return "image/png";
  } else {
    return "image/jpeg";
  }
}


x86 assembly (clang, -O0):
<get_mime_type_from_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,%rdi
add    $0x1,%rdi
lea    0xebe(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1167 <get_mime_type_from_filename+0x47>
lea    0xea2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1172 <get_mime_type_from_filename+0x52>
lea    0xe9c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mime_type_from_filename>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rdi
lea    0xed0(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xebb(%rip),%rcx
lea    0xebe(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"png\00"
@.str.1 = [10 x i8] c"image/png\00"
@.str.2 = [11 x i8] c"image/jpeg\00"
define i8* @get_mime_type_from_filename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strrchr(i8* %4, i8 signext 46)
%6 = add nsw i64 %5, 1
%7 = call i64 @strcmp(i64 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
10: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %11
11: ; preds = %10, %9
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@.str = [4 x i8] c"png\00"
@.str.1 = [10 x i8] c"image/png\00"
@.str.2 = [11 x i8] c"image/jpeg\00"
define i8* @get_mime_type_from_filename(i8* %0) {
%2 = tail call i64 @strrchr(i8* %0, i8 signext 46)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @strcmp(i64 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0)
ret i8* %6
}
/* Variables and functions */
int yaffs_rmdir_reldir(int /*<<< orphan*/, char const *);
int yaffs_rmdir(const char *path) { return yaffs_rmdir_reldir((0), path); }


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

x86 assembly (clang, -O2):
<yaffs_rmdir>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <yaffs_rmdir_reldir@plt>

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

LLVM IR (-O2):
define i32 @yaffs_rmdir(i8* %0) {
%2 = tail call i32 @yaffs_rmdir_reldir(i32 0, i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void usage(const char *prog) {
  fprintf(stderr,
          "%s: usage: %s [-linear|-sRGB] [-gray|-color] component{1,4}\n", prog,
          prog);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"%s: usage: %s [-linear|-sRGB] [-gray|-color] component{1,4}\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int shift_overrun(int x) { return x << 123; }


x86 assembly (clang, -O0):
<shift_overrun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x7b,%ecx
shl    %cl,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @shift_overrun(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ F(char *);
int /*<<< orphan*/ print_P(int /*<<< orphan*/);
void print_g_close() { print_P(F("</g>\n")); }


x86 assembly (clang, -O0):
<print_g_close>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <F@plt>
mov    %eax,%edi
call   1040 <print_P@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_g_close>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <F@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <print_P@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"</g>\0A\00"
define void @print_g_close() {
%1 = call i32 @F(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @print_P(i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"</g>\0A\00"
define void @print_g_close() {
%1 = tail call i32 @F(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_P(i32 %1)
ret void
}
int Cyc_IOEffect_hash_ptr(void *s) { return (int)s; }


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

x86 assembly (clang, -O2):
<Cyc_IOEffect_hash_ptr>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32 @Cyc_IOEffect_hash_ptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void environ_display(FILE *output_pipe) {
  extern char **environ;
  char **ptr;
  ptr = environ;
  while (*ptr) {
    fprintf(output_pipe, "%s\n", *ptr);
    ptr++;
  }
}


x86 assembly (clang, -O0):
<environ_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1160 <environ_display+0x50>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeb6(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    112a <environ_display+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<environ_display>:
push   %r15
push   %r14
push   %rbx
mov    0x2ecc(%rip),%rax
mov    (%rax),%rbx
mov    (%rbx),%rdx
test   %rdx,%rdx
je     1157 <environ_display+0x47>
mov    %rdi,%r15
add    $0x8,%rbx
lea    0xecb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%rdx
add    $0x8,%rbx
test   %rdx,%rdx
jne    1140 <environ_display+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@environ = external global i8**
@.str = [4 x i8] c"%s\0A\00"
define void @environ_display(i32* %0) {
%2 = alloca i32*
%3 = alloca i8**
store i32* %0, i32** %2
%4 = load i8**, i8*** @environ
store i8** %4, i8*** %3
br label %5
5: ; preds = %9, %1
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i32*, i32** %2
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8**, i8*** %3
%15 = getelementptr inbounds i8*, i8** %14, i32 1
store i8** %15, i8*** %3
br label %5
16: ; preds = %5
ret void
}

LLVM IR (-O2):
@environ = external global i8**
@.str = [4 x i8] c"%s\0A\00"
define void @environ_display(i32* nocapture %0) {
%2 = load i8**, i8*** @environ
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8* [ %10, %5 ], [ %3, %1 ]
%7 = phi i8** [ %9, %5 ], [ %2, %1 ]
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%9 = getelementptr inbounds i8*, i8** %7, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %5
12: ; preds = %5, %1
ret void
}
int dna_bit_match(unsigned char t, unsigned char s, int match, int mismatch) {
  return ((t & 1) | (s & 1)) ? 0 : ((t & s) > 0 ? match : mismatch);
}


x86 assembly (clang, -O0):
<dna_bit_match>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
mov    %ecx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
movzbl -0x2(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     113a <dna_bit_match+0x3a>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1164 <dna_bit_match+0x64>
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jle    1158 <dna_bit_match+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    115e <dna_bit_match+0x5e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dna_bit_match>:
mov    %esi,%r8d
or     %dil,%r8b
test   %dil,%sil
cmove  %ecx,%edx
xor    %eax,%eax
test   $0x1,%r8b
cmove  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @dna_bit_match(i8 zeroext %0, i8 zeroext %1, i32 %2, i32 %3) {
%5 = or i8 %1, %0
%6 = and i8 %5, 1
%7 = icmp eq i8 %6, 0
%8 = and i8 %1, %0
%9 = icmp eq i8 %8, 0
%10 = select i1 %9, i32 %3, i32 %2
%11 = select i1 %7, i32 %10, i32 0
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                             char *);
int /*<<< orphan*/ refresh();
int strlen(char *);
void print_title(WINDOW *win, char *title) {
  int length = strlen(title);
  int x, y;
  getmaxyx(win, y, x);
  mvwprintw(win, 0, x / 2 - length / 2, title);
  refresh();
}


x86 assembly (clang, -O0):
<print_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <getmaxyx@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%edx
sub    %eax,%edx
mov    -0x10(%rbp),%rcx
xor    %esi,%esi
call   1060 <mvwprintw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_title>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <getmaxyx@plt>
mov    %ebp,%edx
shr    $0x1f,%edx
add    %ebp,%edx
sar    %edx
neg    %edx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rcx
call   1060 <mvwprintw@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <refresh@plt>

LLVM IR (-O0):
define void @print_title(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %5
%10 = load i32*, i32** %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = call i32 @getmaxyx(i32* %10, i32 %11, i32 %12)
%14 = load i32*, i32** %3
%15 = load i32, i32* %6
%16 = sdiv i32 %15, 2
%17 = load i32, i32* %5
%18 = sdiv i32 %17, 2
%19 = sub nsw i32 %16, %18
%20 = load i8*, i8** %4
%21 = call i32 @mvwprintw(i32* %14, i32 0, i32 %19, i8* %20)
%22 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
define void @print_title(i32* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @getmaxyx(i32* %0, i32 undef, i32 undef)
%5 = sdiv i32 %3, -2
%6 = tail call i32 @mvwprintw(i32* %0, i32 0, i32 %5, i8* %1)
%7 = tail call i32 (...) @refresh()
ret void
}
int my_cmp(const void *key1, const void *key2) {
  return (*(int *)key1 - *(int *)key2);
}


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

x86 assembly (clang, -O2):
<my_cmp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @my_cmp(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @my_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
void list_del(struct ds *p) {}


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

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

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

LLVM IR (-O2):
%struct.ds = type opaque
define void @list_del(%struct.ds* nocapture %0) {
ret void
}
void nand_send_data(unsigned char data) {
  (*((volatile unsigned char *)0x70200010)) = data;
}


x86 assembly (clang, -O0):
<nand_send_data>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%cl
mov    $0x70200010,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_send_data>:
mov    %dil,0x70200010
70
ret

LLVM IR (-O0):
define void @nand_send_data(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
store volatile i8 %3, i8* inttoptr (i64 1881145360 to i8*)
ret void
}

LLVM IR (-O2):
define void @nand_send_data(i8 zeroext %0) {
store volatile i8 %0, i8* inttoptr (i64 1881145360 to i8*)
ret void
}
/* Variables and functions */
bool skip_whitespace(const char **string) {
  bool seen = false;
  while (**string == ' ' || **string == '\t') {
    *string += 1;
    seen = true;
  }
  return seen;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0xd(%rbp)
je     113a <skip_whitespace+0x3a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    114a <skip_whitespace+0x4a>
jmp    1164 <skip_whitespace+0x64>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movl   $0x1,-0xc(%rbp)
jmp    110f <skip_whitespace+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
mov    (%rdi),%rcx
add    $0x1,%rcx
xor    %eax,%eax
jmp    111c <skip_whitespace+0x1c>
nopl   0x0(%rax,%rax,1)
mov    %rcx,(%rdi)
add    $0x1,%rcx
mov    $0x1,%eax
movzbl -0x1(%rcx),%edx
cmp    $0x20,%dl
je     1110 <skip_whitespace+0x10>
cmp    $0x9,%dl
je     1110 <skip_whitespace+0x10>
ret

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

LLVM IR (-O2):
define i32 @skip_whitespace(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %7, %1
%4 = phi i8* [ %2, %1 ], [ %8, %7 ]
%5 = phi i32 [ 0, %1 ], [ 1, %7 ]
%6 = load i8, i8* %4
switch i8 %6, label %9 [
i8 32, label %7
i8 9, label %7
]
7: ; preds = %3, %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %8, i8** %0
br label %3
9: ; preds = %3
ret i32 %5
}
/* Variables and functions */
char *strcpy(int /*<<< orphan*/, char const *);
int strlen(char const *);
int /*<<< orphan*/ xmalloc(int);
char *xstrdup(const char *string) {
  return strcpy(xmalloc((strlen(string) + 1) * sizeof(char)), string);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <xmalloc@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <xmalloc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 1
%8 = trunc i64 %7 to i32
%9 = call i32 @xmalloc(i32 %8)
%10 = load i8*, i8** %2
%11 = call i8* @strcpy(i32 %9, i8* %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i32 @xmalloc(i32 %3)
%5 = tail call i8* @strcpy(i32 %4, i8* %0)
ret i8* %5
}
void irq_disable(int interrupt) {
  (*((volatile unsigned int *)((0x12000000 + 0x200) + 0x04))) =
      (1 << interrupt);
}


x86 assembly (clang, -O0):
<irq_disable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x12000204,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_disable>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,0x12000204
ret

LLVM IR (-O0):
define void @irq_disable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 1, %3
store volatile i32 %4, i32* inttoptr (i64 301990404 to i32*)
ret void
}

LLVM IR (-O2):
define void @irq_disable(i32 %0) {
%2 = shl nuw i32 1, %0
store volatile i32 %2, i32* inttoptr (i64 301990404 to i32*)
ret void
}
/* Variables and functions */
char *getenv(char *);
scalar_t__ strcmp(char *, char *);
int testenv(char *key, char *val) {
  char *p = getenv(key);
  if (!p)
    return (1);
  else if (*val && strcmp(p, val))
    return (2);
  return (0);
}


x86 assembly (clang, -O0):
<testenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1154 <testenv+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1193 <testenv+0x73>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1187 <testenv+0x67>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1187 <testenv+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1193 <testenv+0x73>
jmp    118c <testenv+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testenv>:
push   %rbx
mov    %rsi,%rbx
call   1030 <getenv@plt>
test   %rax,%rax
je     114d <testenv+0x2d>
cmpb   $0x0,(%rbx)
je     1154 <testenv+0x34>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
je     1154 <testenv+0x34>
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @testenv(i8* nocapture %0, i8* %1) {
%3 = tail call i8* @getenv(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i64 @strcmp(i8* %3, i8* %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %5, %8
br label %12
12: ; preds = %8, %2, %11
%13 = phi i32 [ 0, %11 ], [ 1, %2 ], [ 2, %8 ]
ret i32 %13
}
void StrCpy(char *src, char *dest) {
  while (*src != '\0') {
    *dest++ = *src++;
  }
  *dest = '\0';
  return;
}


x86 assembly (clang, -O0):
<StrCpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <StrCpy+0x43>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <StrCpy+0xc>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrCpy>:
mov    (%rdi),%al
test   %al,%al
je     1121 <StrCpy+0x21>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rsi)
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <StrCpy+0x10>
movb   $0x0,(%rsi)
ret

LLVM IR (-O0):
define void @StrCpy(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 = %10, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
store i8 %13, i8* %14
br label %5
16: ; preds = %5
%17 = load i8*, i8** %4
store i8 0, i8* %17
ret void
}

LLVM IR (-O2):
define void @StrCpy(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %1, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %1, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret void
}
BOOST_AUTO_TEST_CASE(floor) {
  TESTCASE1(floor, 0, 0);
  TESTCASE1(floor, 0.5, 0);
  TESTCASE1(floor, 1, 1);
  TESTCASE1(floor, -1, -1);
  TESTCASE1(floor, -1.2, -2);
}


x86 assembly (clang, -O0):
<BOOST_AUTO_TEST_CASE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <TESTCASE1@plt>
mov    -0x8(%rbp),%edi
movsd  0xed4(%rip),%xmm0
xor    %esi,%esi
mov    $0x1,%al
call   1030 <TESTCASE1@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <TESTCASE1@plt>
mov    -0x8(%rbp),%edi
mov    $0xffffffff,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <TESTCASE1@plt>
mov    -0x8(%rbp),%edi
movsd  0xe96(%rip),%xmm0
mov    $0xfffffffe,%esi
mov    $0x1,%al
call   1030 <TESTCASE1@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BOOST_AUTO_TEST_CASE>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <TESTCASE1@plt>
movsd  0xeda(%rip),%xmm0
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%al
call   1030 <TESTCASE1@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <TESTCASE1@plt>
mov    %ebx,%edi
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
xor    %eax,%eax
call   1030 <TESTCASE1@plt>
movsd  0xea9(%rip),%xmm0
mov    %ebx,%edi
mov    $0xfffffffe,%esi
mov    $0x1,%al
pop    %rbx
jmp    1030 <TESTCASE1@plt>

LLVM IR (-O0):
define i32 @BOOST_AUTO_TEST_CASE(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %4, i32 0, i32 0)
%6 = load i32, i32* %3
%7 = call i32 (i32, double, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, double, i32, ...)*)(i32 %6, double 5.000000e-01, i32 0)
%8 = load i32, i32* %3
%9 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %8, i32 1, i32 1)
%10 = load i32, i32* %3
%11 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %10, i32 -1, i32 -1)
%12 = load i32, i32* %3
%13 = call i32 (i32, double, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, double, i32, ...)*)(i32 %12, double -1.200000e+00, i32 -2)
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @BOOST_AUTO_TEST_CASE(i32 %0) {
%2 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %0, i32 0, i32 0)
%3 = tail call i32 (i32, double, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, double, i32, ...)*)(i32 %0, double 5.000000e-01, i32 0)
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %0, i32 1, i32 1)
%5 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, i32, i32, ...)*)(i32 %0, i32 -1, i32 -1)
%6 = tail call i32 (i32, double, i32, ...) bitcast (i32 (...)* @TESTCASE1 to i32 (i32, double, i32, ...)*)(i32 %0, double -1.200000e+00, i32 -2)
ret i32 undef
}
int main(int argc, char *argv[]) {
  int i, j;
  for (i = 1; i & 7; i = i + 1) {
    if (i & 2)
      continue;
    for (j = 1; j & 3; j = j + 1) {
      if ((j + i) ^ 3)
        break;
    }
  }
  return i + j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     118f <main+0x8f>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     113c <main+0x3c>
jmp    1181 <main+0x81>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     117c <main+0x7c>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
xor    $0x3,%eax
cmp    $0x0,%eax
je     1169 <main+0x69>
jmp    117c <main+0x7c>
jmp    116e <main+0x6e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <main+0x43>
jmp    1181 <main+0x81>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1119 <main+0x19>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 9
}
/* Type definitions */
struct ctx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vdso_has_clock_getres();
void clock_getres_notes(struct ctx *ctx) {
  if (!vdso_has_clock_getres())
    printf("Note: vDSO version of clock_getres not found\n");
}


x86 assembly (clang, -O0):
<clock_getres_notes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <vdso_has_clock_getres@plt>
cmp    $0x0,%eax
jne    1148 <clock_getres_notes+0x28>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_getres_notes>:
push   %rax
xor    %eax,%eax
call   1040 <vdso_has_clock_getres@plt>
test   %eax,%eax
je     112e <clock_getres_notes+0xe>
pop    %rax
ret
lea    0xecb(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
%struct.ctx = type { i32 }
@.str = [46 x i8] c"Note: vDSO version of clock_getres not found\0A\00"
define void @clock_getres_notes(%struct.ctx* %0) {
%2 = alloca %struct.ctx*
store %struct.ctx* %0, %struct.ctx** %2
%3 = call i32 (...) @vdso_has_clock_getres()
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.ctx = type { i32 }
@str = [45 x i8] c"Note: vDSO version of clock_getres not found\00"
define void @clock_getres_notes(%struct.ctx* nocapture readnone %0) {
%2 = tail call i32 (...) @vdso_has_clock_getres()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int get_time_of_day(struct timeval *tv) { return gettimeofday(tv, NULL); }


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

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

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @get_time_of_day(%struct.timeval* nocapture %0) {
%2 = tail call i32 @gettimeofday(%struct.timeval* %0, i32* null)
ret i32 %2
}
int weather_get_ex_temp() { return -42; }


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

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

LLVM IR (-O0):
define i32 @weather_get_ex_temp() {
ret i32 -42
}

LLVM IR (-O2):
define i32 @weather_get_ex_temp() {
ret i32 -42
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
void statusout(int cur, int max) { fprintf(stderr, "%u/%u\r", cur, max); }


x86 assembly (clang, -O0):
<statusout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<statusout>:
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%u/%u\0D\00"
define void @statusout(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%u/%u\0D\00"
define void @statusout(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}