xunge/DecIR huggingface dataset:
long extract_sprg(unsigned long insn, int dialect, int *invalid) {
  unsigned long val = (insn >> 16) & 0x1f;
  if (val <= 3 || (val < 0x10 && (insn & 0x100) != 0) ||
      (val - 0x10 > 3 && (dialect & (0x800 | 0x400)) == 0))
    *invalid = 1;
  return val & 7;
}


x86 assembly (clang, -O0):
<extract_sprg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0x1f,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jbe    116c <extract_sprg+0x6c>
cmpq   $0x10,-0x20(%rbp)
jae    1149 <extract_sprg+0x49>
mov    -0x8(%rbp),%rax
and    $0x100,%rax
cmp    $0x0,%rax
jne    116c <extract_sprg+0x6c>
mov    -0x20(%rbp),%rax
sub    $0x10,%rax
cmp    $0x3,%rax
jbe    1176 <extract_sprg+0x76>
mov    -0xc(%rbp),%eax
and    $0xc00,%eax
cmp    $0x0,%eax
jne    1176 <extract_sprg+0x76>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
and    $0x7,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_sprg>:
mov    %rdi,%rax
shr    $0x10,%rax
mov    %eax,%ecx
and    $0x1f,%ecx
cmp    $0x4,%rcx
jb     1135 <extract_sprg+0x35>
test   $0x100,%edi
je     111f <extract_sprg+0x1f>
cmp    $0x10,%ecx
jb     1135 <extract_sprg+0x35>
and    $0x1c0000,%edi
cmp    $0x100000,%edi
je     113b <extract_sprg+0x3b>
and    $0xc00,%esi
jne    113b <extract_sprg+0x3b>
movl   $0x1,(%rdx)
and    $0x7,%eax
ret

LLVM IR (-O0):
define i64 @extract_sprg(i64 %0, i32 %1, i32* %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i64
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i64, i64* %4
%9 = lshr i64 %8, 16
%10 = and i64 %9, 31
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = icmp ule i64 %11, 3
br i1 %12, label %28, label %13
13: ; preds = %3
%14 = load i64, i64* %7
%15 = icmp ult i64 %14, 16
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* %4
%18 = and i64 %17, 256
%19 = icmp ne i64 %18, 0
br i1 %19, label %28, label %20
20: ; preds = %16, %13
%21 = load i64, i64* %7
%22 = sub i64 %21, 16
%23 = icmp ugt i64 %22, 3
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i32, i32* %5
%26 = and i32 %25, 3072
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24, %16, %3
%29 = load i32*, i32** %6
store i32 1, i32* %29
br label %30
30: ; preds = %28, %24, %20
%31 = load i64, i64* %7
%32 = and i64 %31, 7
ret i64 %32
}

LLVM IR (-O2):
define i64 @extract_sprg(i64 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = lshr i64 %0, 16
%5 = and i64 %4, 31
%6 = icmp ult i64 %5, 4
br i1 %6, label %18, label %7
7: ; preds = %3
%8 = icmp ugt i64 %5, 15
%9 = and i64 %0, 256
%10 = icmp eq i64 %9, 0
%11 = or i1 %10, %8
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = and i64 %0, 1835008
%14 = icmp ne i64 %13, 1048576
%15 = and i32 %1, 3072
%16 = icmp eq i32 %15, 0
%17 = and i1 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %12, %7, %3
store i32 1, i32* %2
br label %19
19: ; preds = %18, %12
%20 = and i64 %4, 7
ret i64 %20
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t len = 0;
  for (len = 0; *str++ != '\0'; len++)
    ;
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <strlen+0x49>
jmp    1138 <strlen+0x38>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <strlen+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Variables and functions */
char *getenv(char const *);
const char *nonnull_getenv(const char *key) {
  char *value;
  return ((value = getenv(key)) == NULL) ? "" : value;
}


x86 assembly (clang, -O0):
<nonnull_getenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1143 <nonnull_getenv+0x33>
lea    0xec6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    114b <nonnull_getenv+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonnull_getenv>:
push   %rax
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xee0(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @nonnull_getenv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @getenv(i8* %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
br label %10
8: ; preds = %1
%9 = load i8*, i8** %3
br label %10
10: ; preds = %8, %7
%11 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %7 ], [ %9, %8 ]
ret i8* %11
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @nonnull_getenv(i8* nocapture %0) {
%2 = tail call i8* @getenv(i8* %0)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
ret i8* %4
}
void sync_debug_msg(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @sync_debug_msg(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int setprop2(char const *, char const *, int);
int setprop(const char *name, const char *value) {
  return setprop2(name, value, 1);
}


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

x86 assembly (clang, -O2):
<setprop>:
mov    $0x1,%edx
jmp    1030 <setprop2@plt>

LLVM IR (-O0):
define i32 @setprop(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 @setprop2(i8* %5, i8* %6, i32 1)
ret i32 %7
}

LLVM IR (-O2):
define i32 @setprop(i8* %0, i8* %1) {
%3 = tail call i32 @setprop2(i8* %0, i8* %1, i32 1)
ret i32 %3
}
/* Variables and functions */
int RAND_egd_bytes(char const *, int);
int RAND_egd(const char *path) { return RAND_egd_bytes(path, 255); }


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

x86 assembly (clang, -O2):
<RAND_egd>:
mov    $0xff,%esi
jmp    1030 <RAND_egd_bytes@plt>

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

LLVM IR (-O2):
define i32 @RAND_egd(i8* %0) {
%2 = tail call i32 @RAND_egd_bytes(i8* %0, i32 255)
ret i32 %2
}
void yy_1_Url(char *yytext, int yyleng) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @yy_1_Url(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ExceptionGroup1(int);
void Line_A(void) { ExceptionGroup1(10); }


x86 assembly (clang, -O0):
<Line_A>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <ExceptionGroup1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Line_A>:
mov    $0xa,%edi
jmp    1030 <ExceptionGroup1@plt>

LLVM IR (-O0):
define void @Line_A() {
%1 = call i32 @ExceptionGroup1(i32 10)
ret void
}

LLVM IR (-O2):
define void @Line_A() {
%1 = tail call i32 @ExceptionGroup1(i32 10)
ret void
}
int bar(int a) { return __atomic_always_lock_free(2, a); }


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

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

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
ret i32 1
}
int gcd(int a, int b) {
  int t;
  while (b != 0) {
    t = a % b;
    a = b;
    b = t;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <gcd+0x2f>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void usage(int argc, char **argv) {
  fprintf(stdout,
          "usage: %s\nArguments :\n -v\tShow version\n -h\tShow this help\n",
          argv[0]);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [59 x i8] c"usage: %s\0AArguments :\0A -v\09Show version\0A -h\09Show this help\0A\00"
define void @usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stdout
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [59 x i8] c"usage: %s\0AArguments :\0A -v\09Show version\0A -h\09Show this help\0A\00"
define void @usage(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BUG();
int hugepage_madvise(unsigned long *vm_flags, int advice) {
  BUG();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @hugepage_madvise(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = call i32 (...) @BUG()
ret i32 0
}

LLVM IR (-O2):
define i32 @hugepage_madvise(i64* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (...) @BUG()
ret i32 0
}
long tf_l(long c) { return c / 3; }


x86 assembly (clang, -O0):
<tf_l>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
cqto
idiv   %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf_l>:
mov    %rdi,%rax
movabs $0x5555555555555556,%rcx
55 55 55
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
add    %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @tf_l(i64 %0) {
%2 = sdiv i64 %0, 3
ret i64 %2
}
void f0(void (*fp)(void), void (*fp2)(void)) { int x = fp - fp2; }


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

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

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

LLVM IR (-O2):
define void @f0(void ()* nocapture %0, void ()* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, int /*<<< orphan*/ *, int);
uint randno(void) {
  uint r;
  int fd = open("/dev/urandom", O_RDONLY);
  if (fd > 0) {
    read(fd, &r, sizeof r);
    close(fd);
  }
  return r;
}


x86 assembly (clang, -O0):
<randno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1173 <randno+0x43>
mov    -0x8(%rbp),%edi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randno>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
lea    0xebb(%rip),%rdi
call   1050 <open@plt>
test   %eax,%eax
jle    116e <randno+0x3e>
mov    %eax,%ebx
lea    0xc(%rsp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1040 <read@plt>
mov    %ebx,%edi
call   1030 <close@plt>
mov    0xc(%rsp),%eax
jmp    116e <randno+0x3e>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
define i32 @randno() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 @read(i32 %8, i32* %1, i32 4)
%10 = load i32, i32* %2
%11 = call i32 @close(i32 %10)
br label %12
12: ; preds = %7, %0
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/urandom\00"
@O_RDONLY = global i32 0
define i32 @randno() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @read(i32 %4, i32* %1, i32 4)
%8 = tail call i32 @close(i32 %4)
%9 = load i32, i32* %1
br label %10
10: ; preds = %6, %0
%11 = phi i32 [ %9, %6 ], [ undef, %0 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ CheckedCommand(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  char *, int, int);
void SetTextSize(FILE *p_cmd, FILE *p_res, int i_overlay, int i_size) {
  CheckedCommand(p_cmd, p_res, "SetTextSize %d %d\n", i_overlay, i_size);
}


x86 assembly (clang, -O0):
<SetTextSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xec4(%rip),%rdx
call   1030 <CheckedCommand@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetTextSize>:
mov    %ecx,%r8d
mov    %edx,%ecx
lea    0xee4(%rip),%rdx
jmp    1030 <CheckedCommand@plt>

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

LLVM IR (-O2):
@.str = [19 x i8] c"SetTextSize %d %d\0A\00"
define void @SetTextSize(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i32 @CheckedCommand(i32* %0, i32* %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret void
}
void FinishSound(void) {}


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

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

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

LLVM IR (-O2):
define void @FinishSound() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UPnPResponse_ConnectionManager_ConnectionComplete(void *);
int /*<<< orphan*/ printf(char *, int);
void UPnPConnectionManager_ConnectionComplete(void *upnptoken,
                                              int ConnectionID) {
  printf("Invoke: UPnPConnectionManager_ConnectionComplete(%d);\r\n",
         ConnectionID);
  UPnPResponse_ConnectionManager_ConnectionComplete(upnptoken);
}


x86 assembly (clang, -O0):
<UPnPConnectionManager_ConnectionComplete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <UPnPResponse_ConnectionManager_ConnectionComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UPnPConnectionManager_ConnectionComplete>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <UPnPResponse_ConnectionManager_ConnectionComplete@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"Invoke: UPnPConnectionManager_ConnectionComplete(%d);\0D\0A\00"
define void @UPnPConnectionManager_ConnectionComplete(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @UPnPResponse_ConnectionManager_ConnectionComplete(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"Invoke: UPnPConnectionManager_ConnectionComplete(%d);\0D\0A\00"
define void @UPnPConnectionManager_ConnectionComplete(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @UPnPResponse_ConnectionManager_ConnectionComplete(i8* %0)
ret void
}
int random(int *m_z, int *m_w) {
  *m_z = 36969 * (*m_z & 65535) + (*m_z >> 16);
  *m_w = 18000 * (*m_w & 65535) + (*m_w >> 16);
  return ((*m_z << 16) + *m_w);
}


x86 assembly (clang, -O0):
<random>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xffff,%eax
imul   $0x9069,%eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sar    $0x10,%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0xffff,%eax
imul   $0x4650,%eax,%ecx
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sar    $0x10,%eax
add    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x10,%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<random>:
mov    (%rdi),%eax
movzwl %ax,%ecx
imul   $0x9069,%ecx,%ecx
sar    $0x10,%eax
add    %ecx,%eax
mov    %eax,(%rdi)
mov    (%rsi),%ecx
movzwl %cx,%eax
imul   $0x4650,%eax,%eax
sar    $0x10,%ecx
add    %eax,%ecx
mov    %ecx,(%rsi)
mov    (%rdi),%eax
shl    $0x10,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @random(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* %5
%7 = and i32 %6, 65535
%8 = mul nsw i32 36969, %7
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = ashr i32 %10, 16
%12 = add nsw i32 %8, %11
%13 = load i32*, i32** %3
store i32 %12, i32* %13
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = and i32 %15, 65535
%17 = mul nsw i32 18000, %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = ashr i32 %19, 16
%21 = add nsw i32 %17, %20
%22 = load i32*, i32** %4
store i32 %21, i32* %22
%23 = load i32*, i32** %3
%24 = load i32, i32* %23
%25 = shl i32 %24, 16
%26 = load i32*, i32** %4
%27 = load i32, i32* %26
%28 = add nsw i32 %25, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @random(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = and i32 %3, 65535
%5 = mul nuw nsw i32 %4, 36969
%6 = ashr i32 %3, 16
%7 = add nsw i32 %5, %6
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = and i32 %8, 65535
%10 = mul nuw nsw i32 %9, 18000
%11 = ashr i32 %8, 16
%12 = add nsw i32 %10, %11
store i32 %12, i32* %1
%13 = load i32, i32* %0
%14 = shl i32 %13, 16
%15 = add nsw i32 %14, %12
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void *malloc(int);
scalar_t__ nondet_bool();
int analyze_this() {
  char *p_char = malloc(sizeof(char));
  int *p_int = malloc(sizeof(int));
  void *p;
  p = nondet_bool() ? p_char : p_int;
  p_int = p;
  free(p_int);
  *p_int = 1;
}


x86 assembly (clang, -O0):
<analyze_this>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <nondet_bool@plt>
cmp    $0x0,%rax
je     1172 <analyze_this+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    117a <analyze_this+0x4a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyze_this>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <nondet_bool@plt>
test   %rax,%rax
cmovne %r14,%rbx
mov    %rbx,%rdi
call   1030 <free@plt>
movl   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @analyze_this() {
%1 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%2 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%3 = tail call i64 (...) @nondet_bool()
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* %2, i8* %1
%6 = bitcast i8* %5 to i32*
%7 = tail call i32 @free(i32* %6)
store i32 1, i32* %6
ret i32 undef
}
void ft_ultimate_div_mod(int *a, int *b) {
  int c;
  c = *a;
  *a = *a / *b;
  *b = *b % c;
}


x86 assembly (clang, -O0):
<ft_ultimate_div_mod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cltd
idivl  (%rcx)
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cltd
idivl  -0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_ultimate_div_mod>:
mov    (%rdi),%ecx
mov    %ecx,%eax
cltd
idivl  (%rsi)
mov    %eax,(%rdi)
mov    (%rsi),%eax
cltd
idiv   %ecx
mov    %edx,(%rsi)
ret

LLVM IR (-O0):
define void @ft_ultimate_div_mod(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = sdiv i32 %9, %11
%13 = load i32*, i32** %3
store i32 %12, i32* %13
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = load i32, i32* %5
%17 = srem i32 %15, %16
%18 = load i32*, i32** %4
store i32 %17, i32* %18
ret void
}

LLVM IR (-O2):
define void @ft_ultimate_div_mod(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = sdiv i32 %3, %4
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = srem i32 %6, %3
store i32 %7, i32* %1
ret void
}
unsigned int bswap_32(const unsigned int x) {
  return ((((x)&0xff000000) >> 24) | (((x)&0x00ff0000) >> 8) |
          (((x)&0x0000ff00) << 8) | (((x)&0x000000ff) << 24));
}


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

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

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

LLVM IR (-O2):
define i32 @bswap_32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Type definitions */
struct dep {
  int dummy;
};

/* Variables and functions */
int check_in_no_cards(struct dep *, char);
int is_always_true(struct dep *dep) { return check_in_no_cards(dep, '%'); }


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

x86 assembly (clang, -O2):
<is_always_true>:
mov    $0x25,%esi
jmp    1030 <check_in_no_cards@plt>

LLVM IR (-O0):
%struct.dep = type { i32 }
define i32 @is_always_true(%struct.dep* %0) {
%2 = alloca %struct.dep*
store %struct.dep* %0, %struct.dep** %2
%3 = load %struct.dep*, %struct.dep** %2
%4 = call i32 @check_in_no_cards(%struct.dep* %3, i8 signext 37)
ret i32 %4
}

LLVM IR (-O2):
%struct.dep = type { i32 }
define i32 @is_always_true(%struct.dep* %0) {
%2 = tail call i32 @check_in_no_cards(%struct.dep* %0, i8 signext 37)
ret i32 %2
}
signed hash(char *s) {
  unsigned hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = *s + 31 * hashval;
  return hashval % 101;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1147 <hash+0x47>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ Beep_DD(int, int, int);
void Beep_OFF() {
  Beep_DD(800, 330, 2);
  Beep_DD(600, 400, 2);
}


x86 assembly (clang, -O0):
<Beep_OFF>:
push   %rbp
mov    %rsp,%rbp
mov    $0x320,%edi
mov    $0x14a,%esi
mov    $0x2,%edx
call   1030 <Beep_DD@plt>
mov    $0x258,%edi
mov    $0x190,%esi
mov    $0x2,%edx
call   1030 <Beep_DD@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Beep_OFF>:
push   %rax
mov    $0x320,%edi
mov    $0x14a,%esi
mov    $0x2,%edx
call   1030 <Beep_DD@plt>
mov    $0x258,%edi
mov    $0x190,%esi
mov    $0x2,%edx
pop    %rax
jmp    1030 <Beep_DD@plt>

LLVM IR (-O0):
define void @Beep_OFF() {
%1 = call i32 @Beep_DD(i32 800, i32 330, i32 2)
%2 = call i32 @Beep_DD(i32 600, i32 400, i32 2)
ret void
}

LLVM IR (-O2):
define void @Beep_OFF() {
%1 = tail call i32 @Beep_DD(i32 800, i32 330, i32 2)
%2 = tail call i32 @Beep_DD(i32 600, i32 400, i32 2)
ret void
}
extern int binary_op(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<binary_op>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @binary_op(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @binary_op(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ r_cons_printf(char *, char const *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncmp(char const *, char *, scalar_t__);
int stdprintiffunc(void *p, const char *k, const char *v) {
  if (!strncmp(v, "func", strlen("func") + 1))
    r_cons_printf("%s\n", k);
  return 1;
}


x86 assembly (clang, -O0):
<stdprintiffunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xead(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
add    $0x1,%rdx
lea    0xe96(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1188 <stdprintiffunc+0x58>
mov    -0x10(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1030 <r_cons_printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdprintiffunc>:
push   %rbx
mov    %rdx,%rdi
mov    %rsi,%rbx
lea    0xed2(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    114b <stdprintiffunc+0x2b>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <r_cons_printf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"func\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @stdprintiffunc(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** %6
%8 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = add nsw i64 %8, 1
%10 = call i32 @strncmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32 @r_cons_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %3
ret i32 1
}

LLVM IR (-O2):
@.str = [5 x i8] c"func\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @stdprintiffunc(i8* nocapture readnone %0, i8* %1, i8* nocapture %2) {
%4 = tail call i32 @strncmp(i8* dereferenceable(1) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @r_cons_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %6, %3
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ _test_streams();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("test unique streams... ");
  _test_streams();
  printf("OK!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <_test_streams@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"test unique streams... \00"
@.str.1 = [5 x i8] c"OK!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @_test_streams()
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"test unique streams... \00"
@str = [4 x i8] c"OK!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @_test_streams()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}
char *strchr(char *str, int ch) {
  for (; *str; str++)
    if (*str == (char)ch)
      return str;
  return (char *)0;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1150 <strchr+0x50>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    113a <strchr+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <strchr+0x58>
jmp    113f <strchr+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr+0x23>
mov    %rdi,%rax
movsbl %sil,%edx
nopl   (%rax)
movsbl %cl,%ecx
cmp    %ecx,%edx
je     1125 <strchr+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %13
%9 = phi i8 [ %3, %5 ], [ %15, %13 ]
%10 = phi i8* [ %0, %5 ], [ %14, %13 ]
%11 = sext i8 %9 to i32
%12 = icmp eq i32 %7, %11
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8, %13, %2
%18 = phi i8* [ null, %2 ], [ null, %13 ], [ %10, %8 ]
ret i8* %18
}
void _exit(int status) {}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
unreachable
}

LLVM IR (-O2):
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int y1, y2;
  y1 = __VERIFIER_nondet_int();
  y2 = __VERIFIER_nondet_int();
  if (y1 > 0 && y2 > 0) {
    while (y1 != y2) {
      if (y1 > y2) {
        y1 = y1 - y2;
      } else {
        y2 = y2 - y1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1185 <main+0x75>
cmpl   $0x0,-0xc(%rbp)
jle    1185 <main+0x75>
jmp    114c <main+0x3c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1180 <main+0x70>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1172 <main+0x62>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x6b>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    114c <main+0x3c>
jmp    1185 <main+0x75>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@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
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %30
8: ; preds = %0
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %30
11: ; preds = %8
br label %12
12: ; preds = %28, %11
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %2
br label %28
24: ; preds = %16
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = sub nsw i32 %25, %26
store i32 %27, i32* %3
br label %28
28: ; preds = %24, %20
br label %12
29: ; preds = %12
br label %30
30: ; preds = %29, %8, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
char *Q_strrchr(const char *string, int c) {
  char cc = c;
  char *s;
  char *sp = (char *)0;
  s = (char *)string;
  while (*s) {
    if (*s == cc) {
      sp = s;
    }
    s++;
  }
  if (cc == 0) {
    sp = s;
  }
  return sp;
}


x86 assembly (clang, -O0):
<Q_strrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     115a <Q_strrchr+0x5a>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0xd(%rbp),%ecx
cmp    %ecx,%eax
jne    1149 <Q_strrchr+0x49>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1121 <Q_strrchr+0x21>
movsbl -0xd(%rbp),%eax
cmp    $0x0,%eax
jne    116f <Q_strrchr+0x6f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_strrchr>:
mov    %rdi,%rax
mov    (%rdi),%dl
test   %dl,%dl
je     1127 <Q_strrchr+0x27>
movsbl %sil,%edi
xor    %ecx,%ecx
nop
movsbl %dl,%edx
cmp    %edx,%edi
cmove  %rax,%rcx
movzbl 0x1(%rax),%edx
add    $0x1,%rax
test   %dl,%dl
jne    1110 <Q_strrchr+0x10>
jmp    1129 <Q_strrchr+0x29>
xor    %ecx,%ecx
test   %sil,%sil
cmovne %rcx,%rax
ret

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

LLVM IR (-O2):
define i8* @Q_strrchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %8
%9 = phi i8 [ %3, %5 ], [ %16, %8 ]
%10 = phi i8* [ null, %5 ], [ %14, %8 ]
%11 = phi i8* [ %0, %5 ], [ %15, %8 ]
%12 = sext i8 %9 to i32
%13 = icmp eq i32 %7, %12
%14 = select i1 %13, i8* %11, i8* %10
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %8
18: ; preds = %8, %2
%19 = phi i8* [ %0, %2 ], [ %15, %8 ]
%20 = phi i8* [ null, %2 ], [ %14, %8 ]
%21 = and i32 %1, 255
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* %19, i8* %20
ret i8* %23
}
int do_505() { return 505; }


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

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

LLVM IR (-O0):
define i32 @do_505() {
ret i32 505
}

LLVM IR (-O2):
define i32 @do_505() {
ret i32 505
}
int weight(int t) {
  if (t == 1)
    return (1);
  if (t == 2 * 1)
    return (4);
  if (t == 5)
    return (1);
  if (t == 2 * 5)
    return (2);
  return (0);
}


x86 assembly (clang, -O0):
<weight>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111d <weight+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1166 <weight+0x66>
cmpl   $0x2,-0x8(%rbp)
jne    1133 <weight+0x33>
movl   $0x4,-0x4(%rbp)
jmp    1166 <weight+0x66>
cmpl   $0x5,-0x8(%rbp)
jne    1149 <weight+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1166 <weight+0x66>
cmpl   $0xa,-0x8(%rbp)
jne    115f <weight+0x5f>
movl   $0x2,-0x4(%rbp)
jmp    1166 <weight+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<weight>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x9,%edi
ja     1117 <weight+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.weight = [10 x i32] [i32 1, i32 4, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 2]
define i32 @weight(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 10
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* @switch.table.weight, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}