xunge/DecIR huggingface dataset:
int main(int argc, char **argv) { return eb$main(); }


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

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
jmp    1030 <eb$main@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @"eb$main"()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @"eb$main"()
ret i32 %3
}
int skip_white(char *pin) {
  int c, len = 0;
  while ((c = *pin++) == ' ' || c == '\t' || c == '\n')
    len++;
  return (len);
}


x86 assembly (clang, -O0):
<skip_white>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
mov    %ecx,-0xc(%rbp)
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     114b <skip_white+0x4b>
mov    $0x1,%al
cmpl   $0x9,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     114b <skip_white+0x4b>
cmpl   $0xa,-0xc(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115b <skip_white+0x5b>
jmp    1169 <skip_white+0x69>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    110f <skip_white+0xf>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_white>:
xor    %eax,%eax
movabs $0x100000600,%rcx
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%edx
cmp    $0x20,%rdx
ja     1126 <skip_white+0x26>
bt     %rdx,%rcx
jae    1126 <skip_white+0x26>
add    $0x1,%rax
jmp    1110 <skip_white+0x10>
ret

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

LLVM IR (-O2):
define i32 @skip_white(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = phi i32 [ 0, %1 ], [ %8, %6 ]
%5 = load i8, i8* %3
switch i8 %5, label %9 [
i8 32, label %6
i8 10, label %6
i8 9, label %6
]
6: ; preds = %2, %2, %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = add nuw nsw i32 %4, 1
br label %2
9: ; preds = %2
ret i32 %4
}
OP(ed, c4) {}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int MULT32(int, int);
int32_t MULT31(int32_t x, int32_t y) { return MULT32(x, y) << 1; }


x86 assembly (clang, -O0):
<MULT31>:
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 <MULT32@plt>
shl    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MULT31>:
push   %rax
call   1030 <MULT32@plt>
add    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @MULT31(i32 %0, i32 %1) {
%3 = tail call i32 @MULT32(i32 %0, i32 %1)
%4 = shl i32 %3, 1
ret i32 %4
}
/* Type definitions */
typedef unsigned int uint32_t;
struct hostent {
  scalar_t__ *h_addr_list;
};

/* Variables and functions */
struct hostent *gethostbyname(char *);
uint32_t hostname2ip(char *hostname) {
  struct hostent *phostent;
  unsigned int hostaddr;
  unsigned char *temp;
  phostent = gethostbyname(hostname);
  if (phostent == NULL) {
    return 0;
  }
  temp = ((unsigned char *)phostent->h_addr_list[0]);
  hostaddr = *(unsigned int *)temp;
  return hostaddr;
}


x86 assembly (clang, -O0):
<hostname2ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <gethostbyname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1140 <hostname2ip+0x30>
movl   $0x0,-0x4(%rbp)
jmp    115d <hostname2ip+0x4d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hostname2ip>:
push   %rax
call   1030 <gethostbyname@plt>
test   %rax,%rax
je     1125 <hostname2ip+0x15>
mov    (%rax),%rax
mov    (%rax),%rax
mov    (%rax),%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type { i64* }
define i32 @hostname2ip(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.hostent*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call %struct.hostent* @gethostbyname(i8* %7)
store %struct.hostent* %8, %struct.hostent** %4
%9 = load %struct.hostent*, %struct.hostent** %4
%10 = icmp eq %struct.hostent* %9, null
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %23
12: ; preds = %1
%13 = load %struct.hostent*, %struct.hostent** %4
%14 = getelementptr inbounds %struct.hostent, %struct.hostent* %13, i32 0, i32 0
%15 = load i64*, i64** %14
%16 = getelementptr inbounds i64, i64* %15, i64 0
%17 = load i64, i64* %16
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %20
store i32 %21, i32* %5
%22 = load i32, i32* %5
store i32 %22, i32* %2
br label %23
23: ; preds = %12, %11
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
%struct.hostent = type { i64* }
define i32 @hostname2ip(i8* %0) {
%2 = tail call %struct.hostent* @gethostbyname(i8* %0)
%3 = icmp eq %struct.hostent* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.hostent, %struct.hostent* %2, i64 0, i32 0
%6 = load i64*, i64** %5
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i32*
%9 = load i32, i32* %8
br label %10
10: ; preds = %1, %4
%11 = phi i32 [ %9, %4 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void B11(void) { printf("Test22\n"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Test22\0A\00"
define void @B11() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"Test22\00"
define void @B11() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                         char *);
int /*<<< orphan*/ print_usage(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void error_ocurred() {
  print_usage(stderr);
  error(-errno, errno, "%s\n", strerror(errno));
}


x86 assembly (clang, -O0):
<error_ocurred>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1040 <print_usage@plt>
xor    %eax,%eax
mov    0x2e89(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    %rax,%rcx
lea    0xe82(%rip),%rdx
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_ocurred>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1040 <print_usage@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%ebp
neg    %ebp
mov    %ebx,%edi
call   1050 <strerror@plt>
lea    0xea4(%rip),%rdx
mov    %ebp,%edi
mov    %ebx,%esi
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <error@plt>

LLVM IR (-O0):
@stderr = global i32 0
@errno = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @error_ocurred() {
%1 = load i32, i32* @stderr
%2 = call i32 @print_usage(i32 %1)
%3 = load i32, i32* @errno
%4 = sub nsw i32 0, %3
%5 = load i32, i32* @errno
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @error(i32 %4, i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@errno = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @error_ocurred() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @print_usage(i32 %1)
%3 = load i32, i32* @errno
%4 = sub nsw i32 0, %3
%5 = tail call i8* @strerror(i32 %3)
%6 = tail call i32 @error(i32 %4, i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
/* Variables and functions */
float cos(float);
float fcos(float x) { return cos(x); }


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

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

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

LLVM IR (-O2):
define float @fcos(float %0) {
%2 = tail call float @cos(float %0)
ret float %2
}
void Font_Shutdown(void) {}


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

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

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

LLVM IR (-O2):
define void @Font_Shutdown() {
ret void
}
/* Variables and functions */
int bish(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int n = 3, k = 2, p = 1;
  printf("bish(%d,%d,%d) = %d\n", n, k, p, bish(n, k, p));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <bish@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    %eax,%r8d
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1040 <bish@plt>
lea    0xec4(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"bish(%d,%d,%d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 3, i32* %1
store i32 2, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @bish(i32 %7, i32 %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"bish(%d,%d,%d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @bish(i32 3, i32 2, i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 3, i32 2, i32 1, i32 %1)
ret i32 0
}
int f2(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @f2() {
ret i32 3
}

LLVM IR (-O2):
define i32 @f2() {
ret i32 3
}
/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
unsigned long time_elapsed(void) { return clock() / (CLOCKS_PER_SEC / 1000); }


x86 assembly (clang, -O0):
<time_elapsed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x4(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_elapsed>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
mov    0x2ec9(%rip),%rcx
movslq (%rcx),%rcx
imul   $0x10624dd3,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
cltd
idiv   %ecx
cltq
pop    %rcx
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
define i64 @time_elapsed() {
%1 = call i32 (...) @clock()
%2 = load i32, i32* @CLOCKS_PER_SEC
%3 = sdiv i32 %2, 1000
%4 = sdiv i32 %1, %3
%5 = sext i32 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define i64 @time_elapsed() {
%1 = tail call i32 (...) @clock()
%2 = load i32, i32* @CLOCKS_PER_SEC
%3 = sdiv i32 %2, 1000
%4 = sdiv i32 %1, %3
%5 = sext i32 %4 to i64
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ nlopt_srand(unsigned long);
void NLOSR(const int *seed) { nlopt_srand((unsigned long)*seed); }


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

x86 assembly (clang, -O2):
<NLOSR>:
movslq (%rdi),%rdi
jmp    1030 <nlopt_srand@plt>

LLVM IR (-O0):
define void @NLOSR(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = call i32 @nlopt_srand(i64 %5)
ret void
}

LLVM IR (-O2):
define void @NLOSR(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = sext i32 %2 to i64
%4 = tail call i32 @nlopt_srand(i64 %3)
ret void
}
__attribute__((always_)) int file_check_writeable(struct file *filp) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.file = type opaque
define i32 @file_check_writeable(%struct.file* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int bimaru_anycmp(char *s, size_t num, char c) {
  register size_t i;
  for (i = 0; i < num; i++)
    if (s[i] != c)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<bimaru_anycmp>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1161 <bimaru_anycmp+0x61>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
je     114b <bimaru_anycmp+0x4b>
movl   $0x1,-0x4(%rbp)
jmp    1168 <bimaru_anycmp+0x68>
jmp    1150 <bimaru_anycmp+0x50>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1119 <bimaru_anycmp+0x19>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bimaru_anycmp>:
test   %rsi,%rsi
je     111e <bimaru_anycmp+0x1e>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmp    %dl,(%rdi,%rax,1)
jne    1121 <bimaru_anycmp+0x21>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <bimaru_anycmp+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
bool file_cat(FILE *dest, FILE *src) {
  char buf[500];
  while (fgets(buf, 500, src) != NULL) {
    fputs(buf, dest);
  }
  return true;
}


x86 assembly (clang, -O0):
<file_cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1f4,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1167 <file_cat+0x47>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <fputs@plt>
jmp    1133 <file_cat+0x13>
mov    $0x1,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_cat>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%rdi
mov    $0x1f4,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1170 <file_cat+0x50>
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    1150 <file_cat+0x30>
mov    $0x1,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @file_cat(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [500 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %11, %2
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%8 = load i32*, i32** %4
%9 = call i32* @fgets(i8* %7, i32 500, i32* %8)
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%13 = load i32*, i32** %3
%14 = call i32 @fputs(i8* %12, i32* %13)
br label %6
15: ; preds = %6
ret i32 1
}

LLVM IR (-O2):
define i32 @file_cat(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca [500 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%5 = call i32* @fgets(i8* %4, i32 500, i32* %1)
%6 = icmp eq i32* %5, null
br i1 %6, label %11, label %7
7: ; preds = %2, %7
%8 = call i32 @fputs(i8* %4, i32* %0)
%9 = call i32* @fgets(i8* %4, i32 500, i32* %1)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %7
11: ; preds = %7, %2
ret i32 1
}
int rk_my_strcmp(const char *s1, const char *s2) {
  while (*s1 == *s2) {
    if (!(*s1)) {
      return 0;
    }
    s1++;
    s2++;
  }
  return (*s1) - (*s2);
}


x86 assembly (clang, -O0):
<rk_my_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1158 <rk_my_strcmp+0x58>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113b <rk_my_strcmp+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116b <rk_my_strcmp+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <rk_my_strcmp+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rk_my_strcmp>:
mov    (%rdi),%al
mov    (%rsi),%dl
cmp    %dl,%al
jne    1124 <rk_my_strcmp+0x24>
mov    $0x1,%ecx
nopl   (%rax)
test   %al,%al
je     112d <rk_my_strcmp+0x2d>
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
add    $0x1,%rcx
cmp    %dl,%al
je     1110 <rk_my_strcmp+0x10>
movsbl %dl,%ecx
movsbl %al,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @rk_my_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %23, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %11, %2
%18 = phi i8 [ %3, %2 ], [ %14, %11 ]
%19 = phi i8 [ %4, %2 ], [ %15, %11 ]
%20 = sext i8 %19 to i32
%21 = sext i8 %18 to i32
%22 = sub nsw i32 %21, %20
br label %23
23: ; preds = %6, %17
%24 = phi i32 [ %22, %17 ], [ 0, %6 ]
ret i32 %24
}
/* Variables and functions */
int /*<<< orphan*/ _I8080_CMA();
void do0x2F() { _I8080_CMA(); }


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

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

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

LLVM IR (-O2):
define void @do0x2F() {
%1 = tail call i32 (...) @_I8080_CMA()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ malloc(int);
scalar_t__ nondet();
int main() {
  int *r;
  int y;
  r = (int *)malloc(4);
  *r = 0;
  while (nondet()) {
    *r = *r + 1;
  }
  y = *r;
  assert(y >= 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <nondet@plt>
cmp    $0x0,%rax
je     117c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1157 <main+0x27>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movl   $0x0,(%rax)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <nondet@plt>
test   %rax,%rax
je     1161 <main+0x31>
addl   $0x1,(%rbx)
jmp    1150 <main+0x20>
mov    (%rbx),%edi
not    %edi
shr    $0x1f,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
store i32 0, i32* %6
br label %7
7: ; preds = %10, %0
%8 = call i64 (...) @nondet()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = load i32*, i32** %2
store i32 %13, i32* %14
br label %7
15: ; preds = %7
%16 = load i32*, i32** %2
%17 = load i32, i32* %16
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
store i32 0, i32* %2
%3 = tail call i64 (...) @nondet()
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0, %5
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = tail call i64 (...) @nondet()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %0
%11 = load i32, i32* %2
%12 = xor i32 %11, -1
%13 = lshr i32 %12, 31
%14 = tail call i32 @assert(i32 %13)
ret i32 0
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_clock_getres;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, struct timespec *);
int clock_getres_syscall_wrapper(clockid_t id, struct timespec *ts) {
  return syscall(SYS_clock_getres, id, ts);
}


x86 assembly (clang, -O0):
<clock_getres_syscall_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_getres_syscall_wrapper>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ed4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@SYS_clock_getres = global i32 0
define i32 @clock_getres_syscall_wrapper(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load i32, i32* @SYS_clock_getres
%6 = load i32, i32* %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @syscall(i32 %5, i32 %6, %struct.timespec* %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@SYS_clock_getres = global i32 0
define i32 @clock_getres_syscall_wrapper(i32 %0, %struct.timespec* %1) {
%3 = load i32, i32* @SYS_clock_getres
%4 = tail call i32 @syscall(i32 %3, i32 %0, %struct.timespec* %1)
ret i32 %4
}
int SbiMmCardWrProt(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @SbiMmCardWrProt() {
ret i32 0
}
const char *plugin_api_info_weechat_site_download_cb(const void *pointer,
                                                     void *data,
                                                     const char *info_name,
                                                     const char *arguments) {
  (void)pointer;
  (void)data;
  (void)info_name;
  (void)arguments;
  return "https://weechat.org/download";
}


x86 assembly (clang, -O0):
<plugin_api_info_weechat_site_download_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xee5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [29 x i8] c"https://weechat.org/download\00"
define i8* @plugin_api_info_weechat_site_download_cb(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
ret i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [29 x i8] c"https://weechat.org/download\00"
define i8* @plugin_api_info_weechat_site_download_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
ret i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0)
}
int ft_word(char const *s, char c) {
  int i;
  i = 0;
  while (*s != c && *s != '\0') {
    i++;
    s++;
  }
  return (i);
}


x86 assembly (clang, -O0):
<ft_word>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
movsbl -0x9(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     113d <ft_word+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114d <ft_word+0x4d>
jmp    1167 <ft_word+0x67>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1115 <ft_word+0x15>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_word>:
mov    (%rdi),%cl
xor    %eax,%eax
cmp    %sil,%cl
je     1122 <ft_word+0x22>
test   %cl,%cl
je     1122 <ft_word+0x22>
xor    %eax,%eax
nop
movzbl 0x1(%rdi,%rax,1),%ecx
add    $0x1,%rax
cmp    %sil,%cl
je     1122 <ft_word+0x22>
test   %cl,%cl
jne    1110 <ft_word+0x10>
ret

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

LLVM IR (-O2):
define i32 @ft_word(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
%5 = icmp eq i8 %3, 0
%6 = or i1 %4, %5
br i1 %6, label %16, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ 0, %2 ]
%9 = phi i8* [ %11, %7 ], [ %0, %2 ]
%10 = add nuw nsw i32 %8, 1
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, %1
%14 = icmp eq i8 %12, 0
%15 = or i1 %13, %14
br i1 %15, label %16, label %7
16: ; preds = %7, %2
%17 = phi i32 [ 0, %2 ], [ %10, %7 ]
ret i32 %17
}
int test_imm_5Euint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x5E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Euint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 94
%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_5Euint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 403726925824
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
void child_exit() { printf("child %d exit\n", getpid()); }


x86 assembly (clang, -O0):
<child_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_exit>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"child %d exit\0A\00"
define void @child_exit() {
%1 = call i32 (...) @getpid()
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"child %d exit\0A\00"
define void @child_exit() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("       *\n");
  printf("      * \n");
  printf("     *  \n");
  printf("*   *   \n");
  printf(" * *    \n");
  printf("  *     \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [9 x i8] c" *\00"
@str.6 = [9 x i8] c" * \00"
@str.7 = [9 x i8] c" * \00"
@str.8 = [9 x i8] c"* * \00"
@str.9 = [9 x i8] c" * * \00"
@str.10 = [9 x i8] c" * \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.6, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
float __llvm_amdgcn_rcp_f32(float);
float __frcp_rz(float x) { return __llvm_amdgcn_rcp_f32(x); }


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

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

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

LLVM IR (-O2):
define float @__frcp_rz(float %0) {
%2 = tail call float @__llvm_amdgcn_rcp_f32(float %0)
ret float %2
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t sum(uint32_t n) {
  uint32_t s;
  uint32_t i;
  s = 0;
  for (i = 0; i <= n; i++) {
    s += i;
  }
  return s;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1143 <sum+0x43>
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <sum+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %rdi,%rdi
js     111b <sum+0x1b>
lea    -0x1(%rdi),%rcx
mov    %rdi,%rax
mul    %rcx
shld   $0x3f,%rax,%rdx
add    %rdi,%rdx
mov    %rdx,%rax
ret
xor    %edx,%edx
mov    %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @sum(i64 %0) {
%2 = icmp slt i64 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = zext i64 %0 to i65
%5 = add nsw i64 %0, -1
%6 = zext i64 %5 to i65
%7 = mul i65 %4, %6
%8 = lshr i65 %7, 1
%9 = trunc i65 %8 to i64
%10 = add i64 %9, %0
br label %11
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %10, %3 ]
ret i64 %12
}
char unescape(char ec) {
  switch (ec) {
  case 'n':
    return '\n';
  case 'b':
    return '\b';
  case 'f':
    return '\f';
  case 'r':
    return '\r';
  case 't':
    return '\t';
  case 'v':
    return '\v';
  default:
    return ec;
  };
}


x86 assembly (clang, -O0):
<unescape>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x14,%eax
ja     116a <unescape+0x6a>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0xa,-0x1(%rbp)
jmp    1170 <unescape+0x70>
movb   $0x8,-0x1(%rbp)
jmp    1170 <unescape+0x70>
movb   $0xc,-0x1(%rbp)
jmp    1170 <unescape+0x70>
movb   $0xd,-0x1(%rbp)
jmp    1170 <unescape+0x70>
movb   $0x9,-0x1(%rbp)
jmp    1170 <unescape+0x70>
movb   $0xb,-0x1(%rbp)
jmp    1170 <unescape+0x70>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unescape>:
mov    %edi,%eax
mov    %edi,%ecx
add    $0xffffff9e,%ecx
ror    %ecx
cmp    $0xa,%ecx
ja     1125 <unescape+0x25>
mov    $0x745,%edx
bt     %ecx,%edx
jae    1125 <unescape+0x25>
movslq %ecx,%rax
lea    0xede(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret

LLVM IR (-O0):
define signext i8 @unescape(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %12 [
i32 110, label %6
i32 98, label %7
i32 102, label %8
i32 114, label %9
i32 116, label %10
i32 118, label %11
]
6: ; preds = %1
store i8 10, i8* %2
br label %14
7: ; preds = %1
store i8 8, i8* %2
br label %14
8: ; preds = %1
store i8 12, i8* %2
br label %14
9: ; preds = %1
store i8 13, i8* %2
br label %14
10: ; preds = %1
store i8 9, i8* %2
br label %14
11: ; preds = %1
store i8 11, i8* %2
br label %14
12: ; preds = %1
%13 = load i8, i8* %3
store i8 %13, i8* %2
br label %14
14: ; preds = %12, %11, %10, %9, %8, %7, %6
%15 = load i8, i8* %2
ret i8 %15
}

LLVM IR (-O2):
@switch.table.unescape = [11 x i8] c"\08\0A\0C\0A\0A\0A\0A\0A\0D\09\0B"
define signext i8 @unescape(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -98
%4 = tail call i32 @llvm.fshl.i32(i32 %3, i32 %3, i32 31)
%5 = icmp ult i32 %4, 11
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = trunc i32 %4 to i16
%8 = lshr i16 1861, %7
%9 = and i16 %8, 1
%10 = icmp eq i16 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = sext i32 %4 to i64
%13 = getelementptr inbounds [11 x i8], [11 x i8]* @switch.table.unescape, i64 0, i64 %12
%14 = load i8, i8* %13
br label %15
15: ; preds = %1, %6, %11
%16 = phi i8 [ %14, %11 ], [ %0, %6 ], [ %0, %1 ]
ret i8 %16
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int a = 10, b = 6;
  assert(a / 2 + b / 2 == 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 6, i32* %3
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 2
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 2
%8 = add nsw i32 %5, %7
%9 = icmp eq i32 %8, 8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int CompileYear() {
  const char macro[16] = "Mar 17 2022";
  char stmp[8] = {0};
  stmp[0] = macro[7];
  stmp[1] = macro[8];
  stmp[2] = macro[9];
  stmp[3] = macro[10];
  stmp[4] = '\0';
  return atoi(stmp);
}


x86 assembly (clang, -O0):
<CompileYear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    -0x9(%rbp),%al
mov    %al,-0x18(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0x17(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x16(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x15(%rbp)
movb   $0x0,-0x14(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CompileYear>:
push   %rax
movq   $0x32323032,(%rsp)
32
mov    %rsp,%rdi
call   1030 <atoi@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__const.CompileYear.macro = [16 x i8] c"Mar 17 2022\00\00\00\00\00"
define i32 @CompileYear() {
%1 = alloca [16 x i8]
%2 = alloca [8 x i8]
%3 = bitcast [16 x i8]* %1 to i8*
%4 = bitcast [8 x i8]* %2 to i8*
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 7
%6 = load i8, i8* %5
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
store i8 %6, i8* %7
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 8
%9 = load i8, i8* %8
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 9
%12 = load i8, i8* %11
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
store i8 %12, i8* %13
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 10
%15 = load i8, i8* %14
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
store i8 %15, i8* %16
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
store i8 0, i8* %17
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%19 = call i32 @atoi(i8* %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @CompileYear() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 842149938, i64* %1
%3 = call i32 @atoi(i8* %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int int32_t;

/* Variables and functions */
int var_put_u32(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, int);
int var_put_s32(uint8_t *cp, const uint8_t *endp, int32_t i) {
  return var_put_u32(cp, endp, (i << 1) ^ (i >> 31));
}


x86 assembly (clang, -O0):
<var_put_s32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
mov    -0x14(%rbp),%eax
sar    $0x1f,%eax
xor    %eax,%edx
call   1030 <var_put_u32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_put_s32>:
lea    (%rdx,%rdx,1),%eax
sar    $0x1f,%edx
xor    %eax,%edx
jmp    1030 <var_put_u32@plt>

LLVM IR (-O0):
define i32 @var_put_s32(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = shl i32 %9, 1
%11 = load i32, i32* %6
%12 = ashr i32 %11, 31
%13 = xor i32 %10, %12
%14 = call i32 @var_put_u32(i32* %7, i32* %8, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @var_put_s32(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 1
%5 = ashr i32 %2, 31
%6 = xor i32 %4, %5
%7 = tail call i32 @var_put_u32(i32* %0, i32* %1, i32 %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ return_union_het_vecint();
int /*<<< orphan*/ take_union_het_vecint(int /*<<< orphan*/);
void test_union_het_vecint() {
  take_union_het_vecint(return_union_het_vecint());
}


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

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

LLVM IR (-O0):
define void @test_union_het_vecint() {
%1 = call i32 (...) @return_union_het_vecint()
%2 = call i32 @take_union_het_vecint(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_union_het_vecint() {
%1 = tail call i32 (...) @return_union_het_vecint()
%2 = tail call i32 @take_union_het_vecint(i32 %1)
ret void
}
void f(void) {
  static int xyzzy;
  xyzzy += 3;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x3,%eax
mov    %eax,0x2f11(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
addl   $0x3,0x2f1d(%rip)
ret

LLVM IR (-O0):
@f.xyzzy = internal global i32 0
define void @f() {
%1 = load i32, i32* @f.xyzzy
%2 = add nsw i32 %1, 3
store i32 %2, i32* @f.xyzzy
ret void
}

LLVM IR (-O2):
@f.xyzzy = internal unnamed_addr global i32 0
define void @f() {
%1 = load i32, i32* @f.xyzzy
%2 = add nsw i32 %1, 3
store i32 %2, i32* @f.xyzzy
ret void
}