xunge/DecIR huggingface dataset:
int exit() {
  int retval;
  __asm__("int $0x80      \n\t"
          "mov %%eax, %0"
          : "=m"(retval)
          : "a"(1)
          : "memory");
  return retval;
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
int    $0x80
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)

x86 assembly (clang, -O2):
<exit>:
mov    $0x1,%eax
int    $0x80
mov    %eax,-0x4(%rsp)

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

LLVM IR (-O2):
define i32 @exit() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  unsigned int a = 0xffffffff;
  a >>= 1;
  if ((signed int)a < 0)
    printf("arithmetic\n");
  else
    printf("logical\n");
  printf("a: %d | ua: %u\n", a, a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    114c <main+0x3c>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115a <main+0x4a>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
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    0xecc(%rip),%rdi
mov    $0x7fffffff,%esi
mov    $0x7fffffff,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"arithmetic\0A\00"
@.str.1 = [9 x i8] c"logical\0A\00"
@.str.2 = [16 x i8] c"a: %d | ua: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c"a: %d | ua: %u\0A\00"
@str = [8 x i8] c"logical\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 2147483647, i32 2147483647)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: m4 [-gPs] [-Dname[=value]] [-d flags] "
                  "[-I dirname] [-o filename]\n"
                  "\t[-t macro] [-Uname] [file ...]\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [105 x i8] c"usage: m4 [-gPs] [-Dname[=value]] [-d flags] [-I dirname] [-o filename]\0A\09[-t macro] [-Uname] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [105 x i8] c"usage: m4 [-gPs] [-Dname[=value]] [-d flags] [-I dirname] [-o filename]\0A\09[-t macro] [-Uname] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void __vector_unused_irq() {
  for (;;) {
    __asm__ volatile("nop");
  }
}


x86 assembly (clang, -O0):
<__vector_unused_irq>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <__vector_unused_irq+0x9>
nop
jmp    1109 <__vector_unused_irq+0x9>

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

LLVM IR (-O0):
define void @__vector_unused_irq() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @__vector_unused_irq() {
br label %1
1: ; preds = %1, %0
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void logger(char *str) {
  char *file = "server.log";
  printf("%s", str);
}


x86 assembly (clang, -O0):
<logger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"server.log\00"
@.str.1 = [3 x i8] c"%s\00"
define void @logger(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
define void @logger(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  extern char **environ;
  char **env = environ;
  while (*env != NULL) {
    printf("%s\n", *env);
    env++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     115f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%rax
mov    (%rax),%rbx
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1154 <main+0x44>
add    $0x8,%rbx
lea    0xecf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@environ = external global i8**
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i8**, i8*** @environ
%2 = load i8*, i8** %1
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %0, %4
%5 = phi i8* [ %9, %4 ], [ %2, %0 ]
%6 = phi i8** [ %8, %4 ], [ %1, %0 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char *argv[]) {
  enum { a, b, c };
  printf("a = %d, b = %d, c = %d\n", a, b, c);
  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
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"a = %d, b = %d, c = %d\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 ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"a = %d, b = %d, c = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i32 2)
ret i32 0
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ change_state(int, int);
int getchar();
int /*<<< orphan*/ output_char(int);
int main() {
  int last_char, cur_char;
  extern int state;
  state = 0;
  last_char = ' ';
  while ((cur_char = getchar()) != EOF) {
    output_char(cur_char);
    change_state(cur_char, last_char);
    last_char = cur_char;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
movl   $0x0,(%rax)
movl   $0x20,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%eax
je     118a <main+0x5a>
mov    -0xc(%rbp),%edi
call   1030 <output_char@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <change_state@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e9d(%rip),%rax
movl   $0x0,(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e99(%rip),%r14
cmp    (%r14),%eax
je     1180 <main+0x50>
mov    $0x20,%ebx
nopl   0x0(%rax)
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <output_char@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <change_state@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebp,%ebx
cmp    (%r14),%eax
jne    1160 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@state = external global i32
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* @state
store i32 32, i32* %2
br label %4
4: ; preds = %8, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %3
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i32 @output_char(i32 %9)
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = call i32 @change_state(i32 %11, i32 %12)
%14 = load i32, i32* %3
store i32 %14, i32* %2
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@state = external global i32
@EOF = global i32 0
define i32 @main() {
store i32 0, i32* @state
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %12, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %9, %4 ], [ %1, %0 ]
%6 = phi i32 [ %5, %4 ], [ 32, %0 ]
%7 = tail call i32 @output_char(i32 %5)
%8 = tail call i32 @change_state(i32 %5, i32 %6)
%9 = tail call i32 (...) @getchar()
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %4
12: ; preds = %4, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ readide(int /*<<< orphan*/, int /*<<< orphan*/);
uint8_t ide_read_pri(uint16_t addr, void *priv) { return readide(0, addr); }


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

x86 assembly (clang, -O2):
<ide_read_pri>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <readide@plt>

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

LLVM IR (-O2):
define i32 @ide_read_pri(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i32 @readide(i32 0, i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ String_test();
int main() {
  String_test();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @String_test()
ret i32 0
}
int Aig_BitWordNum(int nBits) { return (nBits >> 5) + ((nBits & 31) > 0); }


x86 assembly (clang, -O0):
<Aig_BitWordNum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x5,%eax
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
cmp    $0x0,%ecx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Aig_BitWordNum>:
mov    %edi,%eax
sar    $0x5,%eax
and    $0x1f,%edi
cmp    $0x1,%edi
sbb    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @Aig_BitWordNum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 5
%5 = load i32, i32* %2
%6 = and i32 %5, 31
%7 = icmp sgt i32 %6, 0
%8 = zext i1 %7 to i32
%9 = add nsw i32 %4, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @Aig_BitWordNum(i32 %0) {
%2 = ashr i32 %0, 5
%3 = and i32 %0, 31
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = add nsw i32 %2, %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGUSR1;
int kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int pausetimer(pid_t pid) {
  int err;
  if ((err = kill(pid, SIGUSR1)) != 0) {
    printf("Error: Couldn't pause the timer.\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<pausetimer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1154 <pausetimer+0x34>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pausetimer>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
test   %eax,%eax
je     113f <pausetimer+0x1f>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGUSR1 = global i32 0
@.str = [34 x i8] c"Error: Couldn't pause the timer.\0A\00"
define i32 @pausetimer(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @SIGUSR1
%6 = call i32 @kill(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret i32 0
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
@str = [33 x i8] c"Error: Couldn't pause the timer.\00"
define i32 @pausetimer(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = tail call i32 @kill(i32 %0, i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
long int gethostid() {
  __set_errno(ENOSYS);
  return -1L;
}


x86 assembly (clang, -O0):
<gethostid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gethostid>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i64 @gethostid() {
%1 = load i32, i32* @ENOSYS
%2 = call i32 @__set_errno(i32 %1)
ret i64 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i64 @gethostid() {
%1 = load i32, i32* @ENOSYS
%2 = tail call i32 @__set_errno(i32 %1)
ret i64 -1
}
/* Type definitions */
struct nlmsghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
void gendump(struct nlmsghdr *header, ssize_t bytes, const char *name) {}


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

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

LLVM IR (-O0):
%struct.nlmsghdr = type { i32 }
define void @gendump(%struct.nlmsghdr* %0, i32 %1, i8* %2) {
%4 = alloca %struct.nlmsghdr*
%5 = alloca i32
%6 = alloca i8*
store %struct.nlmsghdr* %0, %struct.nlmsghdr** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
%struct.nlmsghdr = type { i32 }
define void @gendump(%struct.nlmsghdr* nocapture %0, i32 %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *n_malloc(size_t);
int /*<<< orphan*/ nomem();
char *n_strdupl(const char *s, size_t length) {
  register char *new;
  if ((new = n_malloc(length + 1)) == NULL) {
    nomem();
    return NULL;
  }
  memcpy(new, s, length);
  new[length] = '\0';
  return new;
}


x86 assembly (clang, -O0):
<n_strdupl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <n_malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    116f <n_strdupl+0x3f>
mov    $0x0,%al
call   1040 <nomem@plt>
movq   $0x0,-0x8(%rbp)
jmp    1194 <n_strdupl+0x64>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_strdupl>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rsi),%rdi
call   1050 <n_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <n_strdupl+0x31>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r14,1)
jmp    1168 <n_strdupl+0x38>
xor    %eax,%eax
call   1040 <nomem@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @n_strdupl(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @n_malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @nomem()
br label %11
8: ; preds = %2
%9 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%10 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %10
br label %11
11: ; preds = %8, %6
ret i8* %4
}
int test_imm_22uint32_reg(unsigned int val) {
  return ((val) & (0x22 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_22uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x22,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_22uint32_reg>:
test   $0x22,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_22uint32_reg(i32 %0) {
%2 = and i32 %0, 34
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void payment_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @payment_exit() {
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ (*xdrproc_t)(int /*<<< orphan*/ *, scalar_t__ *);
typedef scalar_t__ caddr_t;
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;
struct TYPE_3__ {
  scalar_t__ xp_p1;
};
typedef TYPE_1__ SVCXPRT;

/* Variables and functions */
int /*<<< orphan*/ stub1(int /*<<< orphan*/ *, scalar_t__ *);
bool_t byz_getargs(SVCXPRT *xpt, xdrproc_t p, caddr_t b) {
  return (*p)(((XDR *)((xpt)->xp_p1)), (caddr_t *)b);
}


x86 assembly (clang, -O0):
<byz_getargs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rdi
mov    -0x18(%rbp),%rsi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<byz_getargs>:
mov    %rsi,%rax
mov    (%rdi),%rdi
mov    %rdx,%rsi
jmp    *%rax

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
define i32 @byz_getargs(%struct.TYPE_3__* %0, i32 (i32*, i64*)* %1, i64 %2) {
%4 = alloca %struct.TYPE_3__*
%5 = alloca i32 (i32*, i64*)*
%6 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %4
store i32 (i32*, i64*)* %1, i32 (i32*, i64*)** %5
store i64 %2, i64* %6
%7 = load i32 (i32*, i64*)*, i32 (i32*, i64*)** %5
%8 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = inttoptr i64 %10 to i32*
%12 = load i64, i64* %6
%13 = inttoptr i64 %12 to i64*
%14 = call i32 %7(i32* %11, i64* %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
define i32 @byz_getargs(%struct.TYPE_3__* nocapture %0, i32 (i32*, i64*)* nocapture %1, i64 %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to i32*
%7 = inttoptr i64 %2 to i64*
%8 = tail call i32 %1(i32* %6, i64* %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ strchr(char *, char);
bool separator(char c) { strchr("()[]+-*/%,", c); }


x86 assembly (clang, -O0):
<separator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <strchr@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<separator>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <strchr@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"()[]+-*/%,\00"
define i32 @separator(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i32 @strchr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [11 x i8] c"()[]+-*/%,\00"
define i32 @separator(i8 signext %0) {
%2 = tail call i32 @strchr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(size_t);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, size_t);
void *xmalloc(size_t size) {
  void *p = malloc(size);
  if (p == NULL) {
    syslog(LOG_ERR, "malloc() failed to allocate %d bytes", size);
    exit(EXIT_FAILURE);
  }
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117b <xmalloc+0x4b>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1040 <syslog@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %rdi,%rbx
call   1030 <malloc@plt>
test   %rax,%rax
je     1140 <xmalloc+0x10>
pop    %rbx
ret
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1040 <syslog@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [37 x i8] c"malloc() failed to allocate %d bytes\00"
@EXIT_FAILURE = global i32 0
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* @LOG_ERR
%10 = load i64, i64* %2
%11 = call i32 @syslog(i32 %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [37 x i8] c"malloc() failed to allocate %d bytes\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @LOG_ERR
%6 = tail call i32 @syslog(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i8* %2
}
/* Variables and functions */
double exp(double);
double sqrt(double);
double G(double x) {
  double value = exp(x);
  value = sqrt(value);
  value = value / 2;
  return value;
}


x86 assembly (clang, -O0):
<G>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G>:
push   %rax
call   1030 <exp@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1136 <G+0x16>
sqrtsd %xmm0,%xmm0
jmp    113b <G+0x1b>
call   1040 <sqrt@plt>
mulsd  0xebd(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @G(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @exp(double %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call double @sqrt(double %6)
store double %7, double* %3
%8 = load double, double* %3
%9 = fdiv double %8, 2.000000e+00
store double %9, double* %3
%10 = load double, double* %3
ret double %10
}

LLVM IR (-O2):
define double @G(double %0) {
%2 = tail call double @exp(double %0)
%3 = tail call double @sqrt(double %2)
%4 = fmul double %3, 5.000000e-01
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ UART1_Write(unsigned char);
void send(unsigned char c) { UART1_Write(c); }


x86 assembly (clang, -O0):
<send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <UART1_Write@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @send(i8 zeroext %0) {
%2 = tail call i32 @UART1_Write(i8 zeroext %0)
ret void
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t fixmul32b(int32_t x, int32_t y) {
  int64_t temp;
  temp = x;
  temp *= y;
  temp >>= 31;
  return (int32_t)temp;
}


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

x86 assembly (clang, -O2):
<fixmul32b>:
mov    %edi,%eax
imul   %esi,%eax
sar    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @fixmul32b(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
store i32 %6, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 %8, %7
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = ashr i32 %10, 31
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @fixmul32b(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = ashr i32 %3, 31
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ bad();
int main() {
  bad();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bad()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *argv0, char *text) {
  printf("%s\n", text);
  printf("\n\nUsage:\n\n%s <number> <summand> <factor>\n\n", argv0);
  printf("allocates number pieces of memory of sizes 1..number");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [43 x i8] c"\0A\0AUsage:\0A\0A%s <number> <summand> <factor>\0A\0A\00"
@.str.2 = [53 x i8] c"allocates number pieces of memory of sizes 1..number\00"
define void @usage(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str.1 = [43 x i8] c"\0A\0AUsage:\0A\0A%s <number> <summand> <factor>\0A\0A\00"
@.str.2 = [53 x i8] c"allocates number pieces of memory of sizes 1..number\00"
define void @usage(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int setgid(gid_t gid) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<setgid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec1(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setgid>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @setgid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @setgid(i32 %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void aes_decrypt_deinit(void *ctx) { free(ctx); }


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

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

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

LLVM IR (-O2):
define void @aes_decrypt_deinit(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int test_imm_94uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x94 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_94uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 9699328
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int f(int b) {
  printf("f(%d)\n", b);
  return 7 * b;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
imul   $0x7,-0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0x0(,%rbx,8),%eax
sub    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"f(%d)\0A\00"
define i32 @f(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = mul nsw i32 %0, 7
ret i32 %3
}
void _M2_ChanConsts_finish(__attribute__((unused)) int argc,
                           __attribute__((unused)) char *argv[]) {}


x86 assembly (clang, -O0):
<_M2_ChanConsts_finish>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @_M2_ChanConsts_finish(i32 %0, i8** nocapture %1) {
ret void
}
void *test_anti_range_134(int n) {
  extern void *alloc_anti_range_134(int) __attribute__((alloc_size(1)));
  if ((-0x7fffffff - 1) + 2 <= n && n <= 2)
    n = (-0x7fffffff - 1) + 2 - 1;
  return alloc_anti_range_134(n);
}


x86 assembly (clang, -O0):
<test_anti_range_134>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x80000002,%eax
cmp    -0x4(%rbp),%eax
jg     113a <test_anti_range_134+0x2a>
cmpl   $0x2,-0x4(%rbp)
jg     113a <test_anti_range_134+0x2a>
movl   $0x80000001,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <alloc_anti_range_134@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_134>:
lea    0x7ffffffe(%rdi),%eax
cmp    $0x80000001,%eax
mov    $0x80000001,%eax
cmovb  %eax,%edi
jmp    1030 <alloc_anti_range_134@plt>

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

LLVM IR (-O2):
define i8* @test_anti_range_134(i32 %0) {
%2 = add i32 %0, 2147483646
%3 = icmp ult i32 %2, -2147483647
%4 = select i1 %3, i32 -2147483647, i32 %0
%5 = tail call i8* @alloc_anti_range_134(i32 %4)
ret i8* %5
}
int gpio_debug_register(struct gpio_debug *debug) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.gpio_debug = type opaque
define i32 @gpio_debug_register(%struct.gpio_debug* nocapture readnone %0) {
ret i32 0
}
int main() {
  int sum = 0;
  if (0 || 0 || 0 || -1) {
    sum += 1;
  }
  if (0 || 0 || 0 || 0 || sum) {
    sum += 2;
  }
  if (!!0) {
    sum += 4;
  }
  if (!sum) {
    sum += 8;
  }
  if (0 || 1 || 0 || 0) {
    sum += 16;
  }
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112e <main+0x2e>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1141 <main+0x41>
mov    -0x8(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 19
}
int main() {
  unsigned int arg = 0x1234;
  unsigned int out = 0;
  __asm__("xchgb %%al, %%ah" : "=a"(out) : "a"(arg));
  return (out == 0x3412);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1234,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xchg   %ah,%al
mov    %eax,-0xc(%rbp)
cmpl   $0x3412,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1234,%eax
xchg   %ah,%al
xor    %ecx,%ecx
cmp    $0x3412,%eax
sete   %cl
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 4660, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 asm "xchgb %al, %ah", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 13330
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm "xchgb %al, %ah", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 4660)
%2 = icmp eq i32 %1, 13330
%3 = zext i1 %2 to i32
ret i32 %3
}
int test_imm_99int64_highword_reg(long long val) {
  return ((val >> 32) & (0x99 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_99int64_highword_reg>:
movabs $0x9900000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_99int64_highword_reg(i64 %0) {
%2 = and i64 %0, 657129996288
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
double d_prod(float *x, float *y) { return ((double)(*x) * (double)(*y)); }


x86 assembly (clang, -O0):
<d_prod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_prod>:
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm1
movss  (%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @d_prod(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = fpext float %6 to double
%8 = load float*, float** %4
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = fmul double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @d_prod(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = fpext float %3 to double
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fmul double %4, %6
ret double %7
}
/* Type definitions */
struct file_tags {
  int dummy;
};

/* Variables and functions */
struct file_tags *recv_tags_from_srv();
int /*<<< orphan*/ wait_for_data();
struct file_tags *get_data_tags() {
  wait_for_data();
  return recv_tags_from_srv();
}


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

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

LLVM IR (-O0):
%struct.file_tags = type { i32 }
define %struct.file_tags* @get_data_tags() {
%1 = call i32 (...) @wait_for_data()
%2 = call %struct.file_tags* (...) @recv_tags_from_srv()
ret %struct.file_tags* %2
}

LLVM IR (-O2):
%struct.file_tags = type { i32 }
define %struct.file_tags* @get_data_tags() {
%1 = tail call i32 (...) @wait_for_data()
%2 = tail call %struct.file_tags* (...) @recv_tags_from_srv()
ret %struct.file_tags* %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(void *);
void _Memrel(void *p) {
  assert(p != NULL);
  free(p);
}


x86 assembly (clang, -O0):
<_Memrel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Memrel>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @_Memrel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i8*, i8** %2
%8 = call i32 @free(i8* %7)
ret void
}

LLVM IR (-O2):
define void @_Memrel(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ testcq();
int /*<<< orphan*/ testcqp2();
int /*<<< orphan*/ testlnv();
int main(void) {
  testcq();
  testlnv();
  testcqp2();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @testcq()
%2 = tail call i32 (...) @testlnv()
%3 = tail call i32 (...) @testcqp2()
ret i32 0
}