xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned int string_hash(void const *);
unsigned int stringstruct_hash(const void *o) {
  if (!o)
    return 0;
  return string_hash(o);
}


x86 assembly (clang, -O0):
<stringstruct_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <stringstruct_hash+0x23>
movl   $0x0,-0x4(%rbp)
jmp    113f <stringstruct_hash+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringstruct_hash>:
test   %rdi,%rdi
je     111a <stringstruct_hash+0xa>
jmp    1030 <string_hash@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @stringstruct_hash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @string_hash(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ g();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  for (;;) {
    write(1, "hi\n", 3);
    int count = fprintf(stderr, "hey there: %p %p\n", stdout, stderr);
    g();
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
lea    0xebc(%rip),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    0x2e79(%rip),%rax
mov    (%rax),%ecx
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <g@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1030 <write@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%ecx
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
lea    0xea4(%rip),%rsi
mov    %ecx,%edi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <g@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hi\0A\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"hey there: %p %p\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%4 = load i32, i32* @stderr
%5 = load i32, i32* @stdout
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6)
store i32 %7, i32* %1
%8 = call i32 (...) @g()
br label %9
9: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"hi\0A\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"hey there: %p %p\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%2 = load i32, i32* @stderr
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %2)
%5 = tail call i32 (...) @g()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ BootComCanCheckActivationRequest();
int /*<<< orphan*/ BootComUartCheckActivationRequest();
void BootComCheckActivationRequest(void) {
  BootComUartCheckActivationRequest();
  BootComCanCheckActivationRequest();
}


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

x86 assembly (clang, -O2):
<BootComCheckActivationRequest>:
push   %rax
xor    %eax,%eax
call   1040 <BootComUartCheckActivationRequest@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <BootComCanCheckActivationRequest@plt>

LLVM IR (-O0):
define void @BootComCheckActivationRequest() {
%1 = call i32 (...) @BootComUartCheckActivationRequest()
%2 = call i32 (...) @BootComCanCheckActivationRequest()
ret void
}

LLVM IR (-O2):
define void @BootComCheckActivationRequest() {
%1 = tail call i32 (...) @BootComUartCheckActivationRequest()
%2 = tail call i32 (...) @BootComCanCheckActivationRequest()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EnvPrintRouter(void *, char const *, char const *);
void PrintInChunks(void *theEnv, const char *logicalName,
                   const char *bigString) {
  EnvPrintRouter(theEnv, logicalName, bigString);
}


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

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

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

LLVM IR (-O2):
define void @PrintInChunks(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @EnvPrintRouter(i8* %0, i8* %1, i8* %2)
ret void
}
void *test_anti_range_50(unsigned char n) {
  extern void *alloc_anti_range_50(unsigned char)
      __attribute__((alloc_size(1)));
  if ((0x7f * 2 + 1) - 1 <= n && n <= (0x7f * 2 + 1) - 1)
    n = (0x7f * 2 + 1) - 1 - 1;
  return alloc_anti_range_50(n);
}


x86 assembly (clang, -O0):
<test_anti_range_50>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%ecx
mov    $0xfe,%eax
cmp    %ecx,%eax
jg     1142 <test_anti_range_50+0x32>
movzbl -0x1(%rbp),%eax
cmp    $0xfe,%eax
jg     1142 <test_anti_range_50+0x32>
movb   $0xfd,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <alloc_anti_range_50@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_50>:
cmp    $0xfe,%dil
mov    $0xfd,%eax
cmove  %eax,%edi
jmp    1030 <alloc_anti_range_50@plt>

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

LLVM IR (-O2):
define i8* @test_anti_range_50(i8 zeroext %0) {
%2 = icmp eq i8 %0, -2
%3 = select i1 %2, i8 -3, i8 %0
%4 = tail call i8* @alloc_anti_range_50(i8 zeroext %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main() {
  if ((!L'\400') != 0)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
f() {
  static union { int i, j; } x;
  static int q;
  int ret;
  if (q)
    ret = x.i++;
  else
    ret = x.j++;
  q = !q;
  return ret;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f1d(%rip)
je     112a <f+0x2a>
mov    0x2f0d(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f02(%rip)
mov    %eax,-0x4(%rbp)
jmp    113e <f+0x3e>
mov    0x2ef4(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ee9(%rip)
mov    %eax,-0x4(%rbp)
cmpl   $0x0,0x2ee3(%rip)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,0x2ed3(%rip)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    0x2f1e(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f15(%rip)
xor    %ecx,%ecx
cmpl   $0x0,0x2f10(%rip)
sete   %cl
mov    %ecx,0x2f07(%rip)
ret

LLVM IR (-O0):
%union.anon = type { i32 }
@f.x = internal global %union.anon zeroinitializer
@f.q = internal global i32 0
define i32 @f() {
%1 = alloca i32
%2 = load i32, i32* @f.q
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* getelementptr inbounds (%union.anon, %union.anon* @f.x, i32 0, i32 0)
%6 = add nsw i32 %5, 1
store i32 %6, i32* getelementptr inbounds (%union.anon, %union.anon* @f.x, i32 0, i32 0)
store i32 %5, i32* %1
br label %10
7: ; preds = %0
%8 = load i32, i32* getelementptr inbounds (%union.anon, %union.anon* @f.x, i32 0, i32 0)
%9 = add nsw i32 %8, 1
store i32 %9, i32* getelementptr inbounds (%union.anon, %union.anon* @f.x, i32 0, i32 0)
store i32 %8, i32* %1
br label %10
10: ; preds = %7, %4
%11 = load i32, i32* @f.q
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
store i32 %14, i32* @f.q
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@f.x.0 = internal unnamed_addr global i32 0
@f.q = internal unnamed_addr global i32 0
define i32 @f() {
%1 = load i32, i32* @f.x.0
%2 = add nsw i32 %1, 1
store i32 %2, i32* @f.x.0
%3 = load i32, i32* @f.q
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
store i32 %5, i32* @f.q
ret i32 %1
}
int is_quantifier(const char *re) {
  return re[0] == '*' || re[0] == '+' || re[0] == '?';
}


x86 assembly (clang, -O0):
<is_quantifier>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x2a,%ecx
mov    %al,-0x9(%rbp)
je     1142 <is_quantifier+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x9(%rbp)
je     1142 <is_quantifier+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_quantifier>:
mov    (%rdi),%al
mov    %eax,%ecx
and    $0xfe,%cl
cmp    $0x2a,%cl
sete   %cl
cmp    $0x3f,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @is_quantifier(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -2
%4 = icmp eq i8 %3, 42
%5 = icmp eq i8 %2, 63
%6 = or i1 %5, %4
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
char *strcpy(char *, char const *);
char *MCP_HAL_STRING_StrCpy(char *StrDest, const char *StrSource) {
  return strcpy(StrDest, StrSource);
}


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

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

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

LLVM IR (-O2):
define i8* @MCP_HAL_STRING_StrCpy(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
int affirm(prompt)
char *prompt;
{ return (waffirm(prompt, 0, 0)); }


x86 assembly (clang, -O0):
<affirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <waffirm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<affirm>:
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
jmp    1030 <waffirm@plt>

LLVM IR (-O0):
define i32 @affirm(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @waffirm to i32 (i8*, i32, i32, ...)*)(i8* %3, i32 0, i32 0)
ret i32 %4
}

LLVM IR (-O2):
define i32 @affirm(i8* %0) {
%2 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @waffirm to i32 (i8*, i32, i32, ...)*)(i8* %0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  printf("hello world hello world \n");
  printf("test git commit -a\n");
  return 0;
}


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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"hello world hello world \0A\00"
@.str.1 = [20 x i8] c"test git commit -a\0A\00"
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 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"hello world hello world \00"
@str.2 = [19 x i8] c"test git commit -a\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void print_time(char const *prompt, double diff) {}


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

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

LLVM IR (-O0):
define void @print_time(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
ret void
}

LLVM IR (-O2):
define void @print_time(i8* nocapture %0, double %1) {
ret void
}
/* Variables and functions */
int EXIT_FAILURE;
int main(int argc, char **argv) { return EXIT_FAILURE; }


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

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

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
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 = load i32, i32* @EXIT_FAILURE
ret i32 %6
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EXIT_FAILURE
ret i32 %3
}
void byte_reverse_int(int *inum) {
  register unsigned int x;
  x = *inum;
  *inum = ((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
          ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24);
}


x86 assembly (clang, -O0):
<byte_reverse_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
mov    -0xc(%rbp),%eax
and    $0xff00,%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0xc(%rbp),%eax
and    $0xff0000,%eax
shr    $0x8,%eax
or     %eax,%ecx
mov    -0xc(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @byte_reverse_int(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = shl i32 %7, 24
%9 = load i32, i32* %3
%10 = and i32 %9, 65280
%11 = shl i32 %10, 8
%12 = or i32 %8, %11
%13 = load i32, i32* %3
%14 = and i32 %13, 16711680
%15 = lshr i32 %14, 8
%16 = or i32 %12, %15
%17 = load i32, i32* %3
%18 = and i32 %17, -16777216
%19 = lshr i32 %18, 24
%20 = or i32 %16, %19
%21 = load i32*, i32** %2
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
define void @byte_reverse_int(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cp(char *, char *);
int /*<<< orphan*/ unlink(char *);
void restore_resolv_conf(char *saved_file, char *resolv_conf) {
  cp(saved_file, resolv_conf);
  unlink(saved_file);
}


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

x86 assembly (clang, -O2):
<restore_resolv_conf>:
push   %rbx
mov    %rdi,%rbx
call   1040 <cp@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <unlink@plt>

LLVM IR (-O0):
define void @restore_resolv_conf(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @cp(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @unlink(i8* %8)
ret void
}

LLVM IR (-O2):
define void @restore_resolv_conf(i8* %0, i8* %1) {
%3 = tail call i32 @cp(i8* %0, i8* %1)
%4 = tail call i32 @unlink(i8* %0)
ret void
}
int Operand_bs16_decode(unsigned int *valp) {
  *valp = *valp << 4;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_bs16_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x4,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_bs16_decode>:
shll   $0x4,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @Operand_bs16_decode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 4
store i32 %3, i32* %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int __get_array_size(char const *);
int __infer_nondet_int();
int creat(const char *path, mode_t mode) {
  int size;
  size = __get_array_size(path);
  int ret = __infer_nondet_int();
  if (ret < -1)
    while (1)
      ;
  return ret;
}


x86 assembly (clang, -O0):
<creat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__get_array_size@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jge    1159 <creat+0x39>
jmp    1154 <creat+0x34>
jmp    1154 <creat+0x34>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<creat>:
push   %rax
call   1040 <__get_array_size@plt>
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
cmp    $0xfffffffe,%eax
jg     1142 <creat+0x22>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1140 <creat+0x20>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @creat(i8* %0, i32 %1) {
%3 = tail call i32 @__get_array_size(i8* %0)
%4 = tail call i32 (...) @__infer_nondet_int()
%5 = icmp slt i32 %4, -1
br i1 %5, label %6, label %7
6: ; preds = %2, %6
br label %6
7: ; preds = %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ FrisFatal(char *);
int IGMPSendQuery(void) { FrisFatal("IGMPSendQuery not implemented"); }


x86 assembly (clang, -O0):
<IGMPSendQuery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <FrisFatal@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [30 x i8] c"IGMPSendQuery not implemented\00"
define i32 @IGMPSendQuery() {
%1 = alloca i32
%2 = call i32 @FrisFatal(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [30 x i8] c"IGMPSendQuery not implemented\00"
define i32 @IGMPSendQuery() {
%1 = tail call i32 @FrisFatal(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
void sleep_until(scalar_t__);
scalar_t__ time(int /*<<< orphan*/);
void sleep_for(time_t interval) { return sleep_until(time(0) + interval); }


x86 assembly (clang, -O0):
<sleep_for>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,%rdi
add    -0x8(%rbp),%rdi
call   1030 <sleep_until@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_for>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <sleep_until@plt>

LLVM IR (-O0):
define void @sleep_for(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i64 @time(i32 0)
%4 = load i64, i64* %2
%5 = add nsw i64 %3, %4
ret void
}

LLVM IR (-O2):
define void @sleep_for(i64 %0) {
%2 = tail call i64 @time(i32 0)
%3 = add nsw i64 %2, %0
tail call void @sleep_until(i64 %3)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void vlogical_imm_andminus1_int32_t(int32_t *dst, int count) {
  for (int i = 0; i < count; i++)
    dst[i] = dst[i] & -1;
}


x86 assembly (clang, -O0):
<vlogical_imm_andminus1_int32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1145 <vlogical_imm_andminus1_int32_t+0x45>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
and    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <vlogical_imm_andminus1_int32_t+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @vlogical_imm_andminus1_int32_t(i32* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int st_sizcmp(const void *a, const void *b, void *data) {
  return (*(const size_t *)a == *(const size_t *)b) ? 0 : -1;
}


x86 assembly (clang, -O0):
<st_sizcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_sizcmp>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmp    (%rsi),%rcx
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @st_sizcmp(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i64*
%12 = load i64, i64* %11
%13 = icmp eq i64 %9, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 0, i32 -1
ret i32 %15
}

LLVM IR (-O2):
define i32 @st_sizcmp(i8* nocapture %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = bitcast i8* %0 to i64*
%5 = load i64, i64* %4
%6 = bitcast i8* %1 to i64*
%7 = load i64, i64* %6
%8 = icmp ne i64 %5, %7
%9 = sext i1 %8 to i32
ret i32 %9
}
int getPayloadLength(unsigned int *const length,
                     int (*spiTransfer)(unsigned char *const, unsigned int,
                                        void *const customData),
                     void *const customData) {
  unsigned char data[] = {0x38, 0x00};
  int res = (*spiTransfer)(data, 2, customData);
  if (res < 0) {
    return res;
  }
  *length = (unsigned int)data[1];
  return 0;
}


x86 assembly (clang, -O0):
<getPayloadLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0xee5(%rip),%ax
mov    %ax,-0x22(%rbp)
mov    -0x18(%rbp),%rax
lea    -0x22(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2,%esi
call   *%rax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    114a <getPayloadLength+0x4a>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <getPayloadLength+0x5b>
movzbl -0x21(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPayloadLength>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
movw   $0x38,0xe(%rsp)
lea    0xe(%rsp),%rdi
mov    $0x2,%esi
call   *%rax
test   %eax,%eax
js     112b <getPayloadLength+0x2b>
movzbl 0xf(%rsp),%eax
mov    %eax,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.getPayloadLength.data = [2 x i8] c"8\00"
define i32 @getPayloadLength(i32* %0, i32 (i8*, i32, i8*)* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32 (i8*, i32, i8*)*
%7 = alloca i8*
%8 = alloca [2 x i8]
%9 = alloca i32
store i32* %0, i32** %5
store i32 (i8*, i32, i8*)* %1, i32 (i8*, i32, i8*)** %6
store i8* %2, i8** %7
%10 = bitcast [2 x i8]* %8 to i8*
%11 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** %6
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%13 = load i8*, i8** %7
%14 = call i32 %11(i8* %12, i32 2, i8* %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = load i32, i32* %9
store i32 %18, i32* %4
br label %24
19: ; preds = %3
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i32*, i32** %5
store i32 %22, i32* %23
store i32 0, i32* %4
br label %24
24: ; preds = %19, %17
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @getPayloadLength(i32* nocapture writeonly %0, i32 (i8*, i32, i8*)* nocapture %1, i8* %2) {
%4 = alloca i16
%5 = bitcast i16* %4 to i8*
store i16 56, i16* %4
%6 = call i32 %1(i8* %5, i32 2, i8* %2)
%7 = icmp slt i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = bitcast i16* %4 to [2 x i8]*
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
store i32 %12, i32* %0
br label %13
13: ; preds = %3, %8
%14 = phi i32 [ 0, %8 ], [ %6, %3 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ getchar();
int lis(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {10, 22, 9, 33, 21, 50, 41, 60};
  int n = sizeof(arr) / sizeof(arr[0]);
  printf("Length of LIS is %d\n", lis(arr, n));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <lis@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <lis@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [8 x i32] [i32 10, i32 22, i32 9, i32 33, i32 21, i32 50, i32 41, i32 60]
@.str = [21 x i8] c"Length of LIS is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @lis(i32* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [8 x i32] [i32 10, i32 22, i32 9, i32 33, i32 21, i32 50, i32 41, i32 60]
@.str = [21 x i8] c"Length of LIS is %d\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @lis(i32* %3, i32 8)
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
int /*<<< orphan*/ addlong(int /*<<< orphan*/);
void ADD_HOST_REG_IMM(int host_reg, uint32_t imm) {
  if (host_reg & 8)
    addbyte(0x41);
  addbyte(0x81);
  addbyte(0xC0 | (host_reg & 7));
  addlong(imm);
}


x86 assembly (clang, -O0):
<ADD_HOST_REG_IMM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1147 <ADD_HOST_REG_IMM+0x27>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x81,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
call   1040 <addbyte@plt>
mov    -0x8(%rbp),%edi
call   1030 <addlong@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADD_HOST_REG_IMM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   $0x8,%bpl
je     1137 <ADD_HOST_REG_IMM+0x17>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x81,%edi
call   1040 <addbyte@plt>
and    $0x7,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
call   1040 <addbyte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addlong@plt>

LLVM IR (-O0):
define void @ADD_HOST_REG_IMM(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 = and i32 %5, 8
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @addbyte(i32 65)
br label %10
10: ; preds = %8, %2
%11 = call i32 @addbyte(i32 129)
%12 = load i32, i32* %3
%13 = and i32 %12, 7
%14 = or i32 192, %13
%15 = call i32 @addbyte(i32 %14)
%16 = load i32, i32* %4
%17 = call i32 @addlong(i32 %16)
ret void
}

LLVM IR (-O2):
define void @ADD_HOST_REG_IMM(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @addbyte(i32 65)
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @addbyte(i32 129)
%9 = and i32 %0, 7
%10 = or i32 %9, 192
%11 = tail call i32 @addbyte(i32 %10)
%12 = tail call i32 @addlong(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void magic(void) { printf("HI\n"); }


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

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

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

LLVM IR (-O2):
@str = [3 x i8] c"HI\00"
define void @magic() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int equals_string(void *value1, void *value2) {
  char *str1 = value1;
  char *str2 = value2;
  return strcmp(str1, str2) == 0;
}


x86 assembly (clang, -O0):
<equals_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equals_string>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @equals_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @equals_string(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t return_uint64_0() { return 1073741823; }


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

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

LLVM IR (-O0):
define i32 @return_uint64_0() {
ret i32 1073741823
}

LLVM IR (-O2):
define i32 @return_uint64_0() {
ret i32 1073741823
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
scalar_t__ strncmp(int /*<<< orphan*/, char *, int);
int binlogfilter(const struct dirent *ent) {
  return (0 == strncmp(ent->d_name, "bin_log.", 8)) ? 1 : 0;
}


x86 assembly (clang, -O0):
<binlogfilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    %rax,%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binlogfilter>:
push   %rax
mov    (%rdi),%edi
lea    0xee6(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@.str = [9 x i8] c"bin_log.\00"
define i32 @binlogfilter(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i64 @strncmp(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%7 = icmp eq i64 0, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
ret i32 %9
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str = [9 x i8] c"bin_log.\00"
define i32 @binlogfilter(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i64 @strncmp(i32 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
char const *_dns_get_answered_ip(char const *, size_t, int);
const char *dns_get_answered_ipv6(const char *rsp, size_t len) {
  return _dns_get_answered_ip(rsp, len, 28);
}


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

x86 assembly (clang, -O2):
<dns_get_answered_ipv6>:
mov    $0x1c,%edx
jmp    1030 <_dns_get_answered_ip@plt>

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

LLVM IR (-O2):
define i8* @dns_get_answered_ipv6(i8* %0, i64 %1) {
%3 = tail call i8* @_dns_get_answered_ip(i8* %0, i64 %1, i32 28)
ret i8* %3
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int isDIV(const char *comm) { return strcmp(comm, "div") == 0; }


x86 assembly (clang, -O0):
<isDIV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDIV>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"div\00"
define i32 @isDIV(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"div\00"
define i32 @isDIV(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int ti_asin_start(double const *options) {
  (void)options;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @ti_asin_start(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @ti_asin_start(double* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int helloworld();
int main(void) {
  int rc;
  rc = helloworld();
  return (rc);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @helloworld()
ret i32 %1
}
int getLowerControlPoint(int v) { return v / 16; }


x86 assembly (clang, -O0):
<getLowerControlPoint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLowerControlPoint>:
lea    0xf(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x4,%eax
ret

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

LLVM IR (-O2):
define i32 @getLowerControlPoint(i32 %0) {
%2 = sdiv i32 %0, 16
ret i32 %2
}
/* Variables and functions */
int SU_Number_Of_Char(char, char *, int /*<<< orphan*/);
int num_folders_in_pathname(char *path) {
  int num_chars;
  num_chars = SU_Number_Of_Char('/', path, 0);
  return num_chars;
}


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

x86 assembly (clang, -O2):
<num_folders_in_pathname>:
mov    %rdi,%rsi
mov    $0x2f,%edi
xor    %edx,%edx
jmp    1030 <SU_Number_Of_Char@plt>

LLVM IR (-O0):
define i32 @num_folders_in_pathname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @SU_Number_Of_Char(i8 signext 47, i8* %4, i32 0)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @num_folders_in_pathname(i8* %0) {
%2 = tail call i32 @SU_Number_Of_Char(i8 signext 47, i8* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int v4l1_dup(int);
__attribute__((visibility("default"))) int dup(int fd) { return v4l1_dup(fd); }


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

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

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

LLVM IR (-O2):
define i32 @dup(i32 %0) {
%2 = tail call i32 @v4l1_dup(i32 %0)
ret i32 %2
}
/* Variables and functions */
int isprint(int);
int sim_isprint(int c) { return ((c < 0) || (c >= 128)) ? 0 : isprint(c); }


x86 assembly (clang, -O0):
<sim_isprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1132 <sim_isprint+0x22>
cmpl   $0x80,-0x4(%rbp)
jl     113c <sim_isprint+0x2c>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <sim_isprint+0x37>
mov    -0x4(%rbp),%edi
call   1030 <isprint@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sim_isprint>:
cmp    $0x7f,%edi
jbe    1118 <sim_isprint+0x8>
xor    %eax,%eax
ret
jmp    1030 <isprint@plt>

LLVM IR (-O0):
define i32 @sim_isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 128
br i1 %7, label %8, label %9
8: ; preds = %5, %1
br label %12
9: ; preds = %5
%10 = load i32, i32* %2
%11 = call i32 @isprint(i32 %10)
br label %12
12: ; preds = %9, %8
%13 = phi i32 [ 0, %8 ], [ %11, %9 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @sim_isprint(i32 %0) {
%2 = icmp ugt i32 %0, 127
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @isprint(i32 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
int Kit_DsdLitNot(int Lit) { return Lit ^ 1; }


x86 assembly (clang, -O0):
<Kit_DsdLitNot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Kit_DsdLitNot>:
mov    %edi,%eax
xor    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @Kit_DsdLitNot(i32 %0) {
%2 = xor i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
int32_t get_int32_be(uint8_t *buf) {
  int32_t res;
  res = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
  return res;
}


x86 assembly (clang, -O0):
<get_int32_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
or     0xc(%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int32_be>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
shl    $0x18,%eax
shl    $0x10,%ecx
or     %eax,%ecx
mov    0x8(%rdi),%eax
shl    $0x8,%eax
or     %ecx,%eax
or     0xc(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get_int32_be(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = shl i32 %6, 24
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = shl i32 %10, 16
%12 = or i32 %7, %11
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 2
%15 = load i32, i32* %14
%16 = shl i32 %15, 8
%17 = or i32 %12, %16
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 3
%20 = load i32, i32* %19
%21 = or i32 %17, %20
store i32 %21, i32* %3
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @get_int32_be(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = or i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = or i32 %11, %13
ret i32 %14
}
int get_shift_bits(int user_port) {
  return 8 * (user_port / 8) + (8 - (user_port % 8));
}


x86 assembly (clang, -O0):
<get_shift_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
shl    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_shift_bits>:
lea    0x7(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffff8,%eax
mov    %eax,%ecx
sub    %edi,%ecx
add    %ecx,%eax
add    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @get_shift_bits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 8
%5 = mul nsw i32 8, %4
%6 = load i32, i32* %2
%7 = srem i32 %6, 8
%8 = sub nsw i32 8, %7
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_shift_bits(i32 %0) {
%2 = sdiv i32 %0, 8
%3 = shl nsw i32 %2, 3
%4 = srem i32 %0, 8
%5 = sub nsw i32 8, %4
%6 = add nsw i32 %5, %3
ret i32 %6
}