xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: extract gen-file decoded-file extracted-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 = [53 x i8] c"Usage: extract gen-file decoded-file extracted-file\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Usage: extract gen-file decoded-file extracted-file\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int max(int *tab, unsigned int len) {
  int i;
  int max_nb;
  max_nb = tab[0];
  i = 0;
  while (i < len) {
    if (tab[i] > max_nb) {
      max_nb = tab[i];
      i++;
    }
    i++;
  }
  return (max_nb);
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1160 <max+0x60>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jle    1152 <max+0x52>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111b <max+0x1b>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    (%rdi),%eax
cmp    $0x2,%esi
jb     112b <max+0x2b>
mov    $0x1,%ecx
nopl   0x0(%rax)
movslq %ecx,%r8
mov    (%rdi,%r8,4),%edx
xor    %ecx,%ecx
cmp    %eax,%edx
setg   %cl
cmovg  %edx,%eax
add    %r8d,%ecx
add    $0x1,%ecx
cmp    %esi,%ecx
jb     1110 <max+0x10>
ret

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

LLVM IR (-O2):
define i32 @max(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = icmp ult i32 %1, 2
br i1 %4, label %17, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %15, %5 ], [ 1, %2 ]
%7 = phi i32 [ %13, %5 ], [ %3, %2 ]
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp sgt i32 %10, %7
%12 = zext i1 %11 to i32
%13 = select i1 %11, i32 %10, i32 %7
%14 = add i32 %6, 1
%15 = add i32 %14, %12
%16 = icmp ult i32 %15, %1
br i1 %16, label %5, label %17
17: ; preds = %5, %2
%18 = phi i32 [ %3, %2 ], [ %13, %5 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ SIZE_MAX;
int strncmp(char const *, char const *, int /*<<< orphan*/);
int strcmp(const char *s1, const char *s2) { return strncmp(s1, s2, SIZE_MAX); }


x86 assembly (clang, -O0):
<strcmp>:
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    0x2ea9(%rip),%rax
mov    (%rax),%edx
call   1030 <strncmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <strncmp@plt>

LLVM IR (-O0):
@SIZE_MAX = global i32 0
define i32 @strcmp(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 = load i32, i32* @SIZE_MAX
%8 = call i32 @strncmp(i8* %5, i8* %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@SIZE_MAX = global i32 0
define i32 @strcmp(i8* %0, i8* %1) {
%3 = load i32, i32* @SIZE_MAX
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %3)
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void pack_list(uint32_t mask, const uint32_t *src, uint32_t *dest) {
  for (; mask; mask >>= 1, src++)
    if (mask & 1)
      *dest++ = *src;
}


x86 assembly (clang, -O0):
<pack_list>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     115e <pack_list+0x5e>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113f <pack_list+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x18(%rbp)
mov    %ecx,(%rax)
jmp    1144 <pack_list+0x44>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    110f <pack_list+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_list>:
test   %edi,%edi
jne    111f <pack_list+0x1f>
ret
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edi,%eax
sar    %eax
add    $0x4,%rsi
cmp    $0x1,%edi
mov    %eax,%edi
jbe    1104 <pack_list+0x4>
test   $0x1,%dil
je     1110 <pack_list+0x10>
mov    (%rsi),%eax
mov    %eax,(%rdx)
add    $0x4,%rdx
jmp    1110 <pack_list+0x10>

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

LLVM IR (-O2):
define void @pack_list(i32 %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %19, label %5
5: ; preds = %3, %14
%6 = phi i32* [ %15, %14 ], [ %2, %3 ]
%7 = phi i32* [ %17, %14 ], [ %1, %3 ]
%8 = phi i32 [ %16, %14 ], [ %0, %3 ]
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = load i32, i32* %7
%13 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %12, i32* %6
br label %14
14: ; preds = %5, %11
%15 = phi i32* [ %13, %11 ], [ %6, %5 ]
%16 = ashr i32 %8, 1
%17 = getelementptr inbounds i32, i32* %7, i64 1
%18 = icmp ult i32 %8, 2
br i1 %18, label %19, label %5
19: ; preds = %14, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ val;

/* Variables and functions */
int /*<<< orphan*/ err(int, char *);
int /*<<< orphan*/ sleep(int);
scalar_t__ sysctlbyname(char *, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                        int *, int);
int main(int argc, char **argv) {
  int val = 1;
  while (1) {
    if (sysctlbyname("debug.dtracetest.sdttest", NULL, NULL, &val, sizeof(val)))
      err(1, "sysctlbyname");
    sleep(1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeac(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x14(%rbp),%rcx
mov    $0x4,%r8d
mov    %rdx,%rsi
call   1040 <sysctlbyname@plt>
cmp    $0x0,%rax
je     1185 <main+0x55>
mov    $0x1,%edi
lea    0xe99(%rip),%rsi
call   1030 <err@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    114d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
lea    0xeb8(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xec5(%rip),%r15
jmp    116a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1040 <sysctlbyname@plt>
test   %rax,%rax
je     1160 <main+0x30>
mov    $0x1,%edi
mov    %r15,%rsi
call   1030 <err@plt>
jmp    1160 <main+0x30>

LLVM IR (-O0):
@.str = [25 x i8] c"debug.dtracetest.sdttest\00"
@.str.1 = [13 x i8] c"sysctlbyname\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %7
7: ; preds = %2, %12
%8 = call i64 @sysctlbyname(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32* null, i32* null, i32* %6, i32 4)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = call i32 @sleep(i32 1)
br label %7
}

LLVM IR (-O2):
@.str = [25 x i8] c"debug.dtracetest.sdttest\00"
@.str.1 = [13 x i8] c"sysctlbyname\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 1, i32* %3
br label %5
5: ; preds = %10, %2
%6 = call i64 @sysctlbyname(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32* null, i32* null, i32* %3, i32 4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = call i32 @sleep(i32 1)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ bug(int *);
void test_bug_2() {
  int *p = 0;
  bug(p);
}


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

x86 assembly (clang, -O2):
<test_bug_2>:
xor    %edi,%edi
jmp    1030 <bug@plt>

LLVM IR (-O0):
define void @test_bug_2() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
%3 = call i32 @bug(i32* %2)
ret void
}

LLVM IR (-O2):
define void @test_bug_2() {
%1 = tail call i32 @bug(i32* null)
ret void
}
int longCmp(void *a, void *b) {
  long la = (long)a;
  long lb = (long)b;
  return la - lb;
}


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

x86 assembly (clang, -O2):
<longCmp>:
mov    %rdi,%rax
sub    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @longCmp(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub nsw i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
int main() {
  if (((int[]){1, 2, 3, 4})[1] != 2) {
    printf("Error %d\n", (int)1);
    exit(1);
  };
  ((int[]){1, 2, 3, 4})[1] = 15;
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0xf,-0x10(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@str = [8 x i8] c"Success\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))
tail call void @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ power(int, int);
int main() {
  power(2, 20);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @power(i32 2, i32 20)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Usage: \r\n"
          "-p <port> <must exist>\r\n"
          "-i <ip>   \r\n"
          "-n <number of threads:default %d>\r\n"
          "-h help \r\n",
          4);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x4,%edx
call   1030 <fprintf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [91 x i8] c"Usage: \0D\0A-p <port> <must exist>\0D\0A-i <ip> \0D\0A-n <number of threads:default %d>\0D\0A-h help \0D\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [91 x i8] c"Usage: \0D\0A-p <port> <must exist>\0D\0A-i <ip> \0D\0A-n <number of threads:default %d>\0D\0A-h help \0D\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
void ECRYPT_init() { return; }


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

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

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

LLVM IR (-O2):
define void @ECRYPT_init() {
ret void
}
/* Variables and functions */
unsigned short inw(int);
unsigned short inw_p(int port) { return (inw(port)); }


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

x86 assembly (clang, -O2):
<inw_p>:
jmp    1030 <inw@plt>

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

LLVM IR (-O2):
define zeroext i16 @inw_p(i32 %0) {
%2 = tail call zeroext i16 @inw(i32 %0)
ret i16 %2
}
int safe(int i, int j, int m, int n) {
  if (i != m && (j == m || m == n))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<safe>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1140 <safe+0x40>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1134 <safe+0x34>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1140 <safe+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1147 <safe+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe>:
cmp    %edx,%edi
je     110e <safe+0xe>
xor    %eax,%eax
cmp    %edx,%esi
je     1113 <safe+0x13>
cmp    %ecx,%edx
je     1113 <safe+0x13>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @safe(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %2
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = icmp eq i32 %1, %2
%8 = icmp eq i32 %2, %3
%9 = or i1 %7, %8
br i1 %9, label %11, label %10
10: ; preds = %6, %4
br label %11
11: ; preds = %6, %10
%12 = phi i32 [ 1, %10 ], [ 0, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ _Error(long, char *);
void Error_TooManyArgumentsPassedToHandler(long p_position) {
  _Error(p_position, "Too many arguments for specified handler");
}


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

x86 assembly (clang, -O2):
<Error_TooManyArgumentsPassedToHandler>:
lea    0xee9(%rip),%rsi
jmp    1030 <_Error@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Too many arguments for specified handler\00"
define void @Error_TooManyArgumentsPassedToHandler(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Error(i64 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Too many arguments for specified handler\00"
define void @Error_TooManyArgumentsPassedToHandler(i64 %0) {
%2 = tail call i32 @_Error(i64 %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void Key(unsigned char key, int x, int y) {
  switch (key) {
  case 27:
    exit(0);
  }
}


x86 assembly (clang, -O0):
<Key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x1(%rbp),%al
sub    $0x1b,%al
jne    113b <Key+0x2b>
jmp    1134 <Key+0x24>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Key>:
cmp    $0x1b,%dil
je     1117 <Key+0x7>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @Key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %11 [
i32 27, label %9
]
9: ; preds = %3
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @Key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
ret void
}
int phys_to_epnum(int phys_epnum) { return phys_epnum >> 1; }


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

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

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

LLVM IR (-O2):
define i32 @phys_to_epnum(i32 %0) {
%2 = ashr i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void USBIntDisableEndpoint(uint32_t ui32Base, uint32_t ui32Flags) {
  ;
  (*((volatile unsigned short *)(ui32Base + 0x00000006))) &=
      ~(ui32Flags & (0x0000FFFE | 0x0000FFFE | 0x00000001));
  (*((volatile unsigned short *)(ui32Base + 0x00000008))) &=
      ~((ui32Flags & (0xFFFE0000 | 0xFFFE0000)) >> 16);
}


x86 assembly (clang, -O0):
<USBIntDisableEndpoint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
and    $0xffff,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x6,%eax
cltq
mov    (%rax),%cx
movzwl %cx,%ecx
and    %edx,%ecx
mov    %cx,(%rax)
mov    -0x8(%rbp),%edx
and    $0xfffe0000,%edx
shr    $0x10,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%cx
movzwl %cx,%ecx
and    %edx,%ecx
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntDisableEndpoint>:
movslq %edi,%rax
mov    %esi,%ecx
not    %ecx
and    %cx,0x6(%rax)
shr    $0x10,%esi
not    %esi
or     $0x1,%esi
and    %si,0x8(%rax)
ret

LLVM IR (-O0):
define void @USBIntDisableEndpoint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 65535
%7 = xor i32 %6, -1
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 6
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i16*
%12 = load volatile i16, i16* %11
%13 = zext i16 %12 to i32
%14 = and i32 %13, %7
%15 = trunc i32 %14 to i16
store volatile i16 %15, i16* %11
%16 = load i32, i32* %4
%17 = and i32 %16, -131072
%18 = lshr i32 %17, 16
%19 = xor i32 %18, -1
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 8
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i16*
%24 = load volatile i16, i16* %23
%25 = zext i16 %24 to i32
%26 = and i32 %25, %19
%27 = trunc i32 %26 to i16
store volatile i16 %27, i16* %23
ret void
}

LLVM IR (-O2):
define void @USBIntDisableEndpoint(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 6
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i16*
%6 = load volatile i16, i16* %5
%7 = trunc i32 %1 to i16
%8 = xor i16 %7, -1
%9 = and i16 %6, %8
store volatile i16 %9, i16* %5
%10 = lshr i32 %1, 16
%11 = add nsw i32 %0, 8
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i16*
%14 = load volatile i16, i16* %13
%15 = trunc i32 %10 to i16
%16 = and i16 %15, -2
%17 = xor i16 %16, -1
%18 = and i16 %14, %17
store volatile i16 %18, i16* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void SerialPuts(int fd, char *s) { write(fd, s, strlen(s)); }


x86 assembly (clang, -O0):
<SerialPuts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SerialPuts>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @SerialPuts(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @write(i32 %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @SerialPuts(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret void
}
void YUY2ToI422() {}


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

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

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

LLVM IR (-O2):
define void @YUY2ToI422() {
ret void
}
/* Variables and functions */
void bz(void *o, size_t l) {
  register char *s = o;
  size_t i;
  for (i = 0; i < l; ++i)
    s[i] = 0;
}


x86 assembly (clang, -O0):
<bz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1147 <bz+0x47>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111c <bz+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bz>:
test   %rsi,%rsi
je     1124 <bz+0x14>
push   %rax
mov    %rsi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @bz(i8* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %2
br label %5
5: ; preds = %4, %2
ret void
}
/* Variables and functions */
int fc8080_reset(void *);
int bbm_com_reset(void *handle) {
  int res;
  res = fc8080_reset(handle);
  return res;
}


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

x86 assembly (clang, -O2):
<bbm_com_reset>:
jmp    1030 <fc8080_reset@plt>

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

LLVM IR (-O2):
define i32 @bbm_com_reset(i8* %0) {
%2 = tail call i32 @fc8080_reset(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ ARMDisableInterrupt();
int /*<<< orphan*/ ARMEnableInterrupt();
int /*<<< orphan*/ swi_uninstall_irq(int);
void uninstallVBlank() {
  ARMDisableInterrupt();
  swi_uninstall_irq(14);
  ARMEnableInterrupt();
}


x86 assembly (clang, -O0):
<uninstallVBlank>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ARMDisableInterrupt@plt>
mov    $0xe,%edi
call   1050 <swi_uninstall_irq@plt>
mov    $0x0,%al
call   1030 <ARMEnableInterrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninstallVBlank>:
push   %rax
xor    %eax,%eax
call   1040 <ARMDisableInterrupt@plt>
mov    $0xe,%edi
call   1050 <swi_uninstall_irq@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ARMEnableInterrupt@plt>

LLVM IR (-O0):
define void @uninstallVBlank() {
%1 = call i32 (...) @ARMDisableInterrupt()
%2 = call i32 @swi_uninstall_irq(i32 14)
%3 = call i32 (...) @ARMEnableInterrupt()
ret void
}

LLVM IR (-O2):
define void @uninstallVBlank() {
%1 = tail call i32 (...) @ARMDisableInterrupt()
%2 = tail call i32 @swi_uninstall_irq(i32 14)
%3 = tail call i32 (...) @ARMEnableInterrupt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void printErr(char *msg) {
  fprintf(stderr, "%s\n", msg);
  printf("Pro ziskani napovedy pouzijte: ./proj1 --help\n");
}


x86 assembly (clang, -O0):
<printErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printErr>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xec4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [47 x i8] c"Pro ziskani napovedy pouzijte: ./proj1 --help\0A\00"
define void @printErr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@str = [46 x i8] c"Pro ziskani napovedy pouzijte: ./proj1 --help\00"
define void @printErr(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LDA_();
int /*<<< orphan*/ c64_memAbsoluteAddrY();
void LDA_absy(void) {
  c64_memAbsoluteAddrY();
  LDA_();
}


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

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

LLVM IR (-O0):
define void @LDA_absy() {
%1 = call i32 (...) @c64_memAbsoluteAddrY()
%2 = call i32 (...) @LDA_()
ret void
}

LLVM IR (-O2):
define void @LDA_absy() {
%1 = tail call i32 (...) @c64_memAbsoluteAddrY()
%2 = tail call i32 (...) @LDA_()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void std_err(void) {
  perror("\nError");
  exit(1);
}


x86 assembly (clang, -O0):
<std_err>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<std_err>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\0AError\00"
define void @std_err() {
%1 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"\0AError\00"
define void @std_err() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
void aa(int b, int x[sizeof b]) {}


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

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

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

LLVM IR (-O2):
define void @aa(i32 %0, i32* nocapture %1) {
ret void
}
const char *I_TempSaveDir(void) { return ""; }


x86 assembly (clang, -O0):
<I_TempSaveDir>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @I_TempSaveDir() {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @I_TempSaveDir() {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISREG(int /*<<< orphan*/);
int stat(char const *, struct stat *);
int isRegularFile(const char *pathName) {
  struct stat statbuf;
  if (stat(pathName, &statbuf) == -1)
    return 0;
  else
    return S_ISREG(statbuf.st_mode);
}


x86 assembly (clang, -O0):
<isRegularFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
jne    114e <isRegularFile+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1159 <isRegularFile+0x39>
mov    -0x18(%rbp),%edi
call   1040 <S_ISREG@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isRegularFile>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
je     1137 <isRegularFile+0x17>
mov    (%rsp),%edi
pop    %rax
jmp    1040 <S_ISREG@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @isRegularFile(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %13
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @S_ISREG(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isRegularFile(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @S_ISREG(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ print_char(int /*<<< orphan*/);
void print_str(char *s) {
  while (*s) {
    print_char(*s++);
  }
}


x86 assembly (clang, -O0):
<print_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <print_str+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <print_char@plt>
jmp    111c <print_str+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_str>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <print_str+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <print_char@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <print_str+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @print_char(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int rev_bits(int n) {
  const int a = (n & 1) << 2;
  const int b = (n & 2);
  const int c = (n & 4) >> 2;
  return a | b | c;
}


x86 assembly (clang, -O0):
<rev_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
shl    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
sar    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_bits>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %al,%dil
mov    %edi,%eax
and    $0x50,%al
add    %al,%al
shr    %dil
and    $0x40,%dil
or     %al,%dil
shr    $0x5,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @rev_bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = and i32 %6, 1
%8 = shl i32 %7, 2
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = and i32 %9, 2
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = and i32 %11, 4
%13 = ashr i32 %12, 2
store i32 %13, i32* %5
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = or i32 %14, %15
%17 = load i32, i32* %5
%18 = or i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @rev_bits(i32 %0) {
%2 = trunc i32 %0 to i3
%3 = tail call i3 @llvm.bitreverse.i3(i3 %2)
%4 = zext i3 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ ReadUint8Be(void const *, int /*<<< orphan*/ *);
int32_t ReadInt8Be(const void *in, int8_t *value) {
  return ReadUint8Be(in, (uint8_t *)value);
}


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

x86 assembly (clang, -O2):
<ReadInt8Be>:
jmp    1030 <ReadUint8Be@plt>

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

LLVM IR (-O2):
define i32 @ReadInt8Be(i8* %0, i32* %1) {
%3 = tail call i32 @ReadUint8Be(i8* %0, i32* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ CurrentTime;
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ GrabModeAsync;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XGrabKeyboard(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/);
int32_t grab_root_window_keyboard(Display *display) {
  Window root_window = DefaultRootWindow(display);
  return XGrabKeyboard(display, root_window, True, GrabModeAsync, GrabModeAsync,
                       CurrentTime);
}


x86 assembly (clang, -O0):
<grab_root_window_keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <DefaultRootWindow@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
mov    0x2e81(%rip),%rax
mov    (%rax),%ecx
mov    0x2e78(%rip),%rax
mov    (%rax),%r8d
mov    0x2e86(%rip),%rax
mov    (%rax),%r9d
call   1040 <XGrabKeyboard@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grab_root_window_keyboard>:
push   %rbx
mov    %rdi,%rbx
call   1030 <DefaultRootWindow@plt>
mov    0x2eb0(%rip),%rcx
mov    (%rcx),%edx
mov    0x2e97(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2ea6(%rip),%rsi
mov    (%rsi),%r9d
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ecx,%r8d
pop    %rbx
jmp    1040 <XGrabKeyboard@plt>

LLVM IR (-O0):
@True = global i32 0
@GrabModeAsync = global i32 0
@CurrentTime = global i32 0
define i32 @grab_root_window_keyboard(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @DefaultRootWindow(i32* %4)
store i32 %5, i32* %3
%6 = load i32*, i32** %2
%7 = load i32, i32* %3
%8 = load i32, i32* @True
%9 = load i32, i32* @GrabModeAsync
%10 = load i32, i32* @GrabModeAsync
%11 = load i32, i32* @CurrentTime
%12 = call i32 @XGrabKeyboard(i32* %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@True = global i32 0
@GrabModeAsync = global i32 0
@CurrentTime = global i32 0
define i32 @grab_root_window_keyboard(i32* %0) {
%2 = tail call i32 @DefaultRootWindow(i32* %0)
%3 = load i32, i32* @True
%4 = load i32, i32* @GrabModeAsync
%5 = load i32, i32* @CurrentTime
%6 = tail call i32 @XGrabKeyboard(i32* %0, i32 %2, i32 %3, i32 %4, i32 %4, i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t next(char **in, uint16_t *ctrl) {
  if (*ctrl & 0x7f) {
    *ctrl <<= 1;
  } else {
    *ctrl = (((uint8_t)(*(*in)++)) << 1) + 1;
    ;
  }
  return *ctrl >> 8 & 1;
}


x86 assembly (clang, -O0):
<next>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x7f,%eax
cmp    $0x0,%eax
je     112e <next+0x2e>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    %ecx,(%rax)
jmp    114e <next+0x4e>
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl (%rax),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sar    $0x8,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next>:
mov    (%rsi),%eax
test   $0x7f,%al
je     110a <next+0xa>
add    %eax,%eax
jmp    111c <next+0x1c>
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
movsbl (%rax),%eax
add    %eax,%eax
add    $0x1,%eax
mov    %eax,(%rsi)
shr    $0x8,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @next(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 = load i32, i32* %5
%7 = and i32 %6, 127
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = shl i32 %11, 1
store i32 %12, i32* %10
br label %22
13: ; preds = %2
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %14
%17 = load i8, i8* %15
%18 = sext i8 %17 to i32
%19 = shl i32 %18, 1
%20 = add nsw i32 %19, 1
%21 = load i32*, i32** %4
store i32 %20, i32* %21
br label %22
22: ; preds = %13, %9
%23 = load i32*, i32** %4
%24 = load i32, i32* %23
%25 = ashr i32 %24, 8
%26 = and i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
define i32 @next(i8** nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = and i32 %3, 127
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = shl i32 %3, 1
br label %15
8: ; preds = %2
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %0
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = shl nsw i32 %12, 1
%14 = or i32 %13, 1
br label %15
15: ; preds = %8, %6
%16 = phi i32 [ %14, %8 ], [ %7, %6 ]
store i32 %16, i32* %1
%17 = lshr i32 %16, 8
%18 = and i32 %17, 1
ret i32 %18
}
int test_imm_70uint16_reg(unsigned short val) {
  return ((val) & (-0x70 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_70uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff90,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_70uint16_reg>:
test   $0xff90,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_70uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -112
%6 = icmp ne i32 %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_70uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -112
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int get_max_stack_size(void) { return 8 * 1024 * 1024; }


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

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

LLVM IR (-O0):
define i32 @get_max_stack_size() {
ret i32 8388608
}

LLVM IR (-O2):
define i32 @get_max_stack_size() {
ret i32 8388608
}
/* Variables and functions */
scalar_t__ blk_oversized_queue_0(int *);
int __attribute__((no)) get_request_0(int *q, int rw) {
  if (blk_oversized_queue_0(q)) {
    if ((rw == 1) || (rw == 0))
      return -33;
    return 0;
  }
  return -100;
}


x86 assembly (clang, -O0):
<get_request_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <blk_oversized_queue_0@plt>
cmp    $0x0,%rax
je     115e <get_request_0+0x4e>
cmpl   $0x1,-0x14(%rbp)
je     1146 <get_request_0+0x36>
cmpl   $0x0,-0x14(%rbp)
jne    1152 <get_request_0+0x42>
movl   $0xffffffdf,-0x4(%rbp)
jmp    1165 <get_request_0+0x55>
movl   $0x0,-0x4(%rbp)
jmp    1165 <get_request_0+0x55>
movl   $0xffffff9c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_request_0>:
push   %rbx
mov    %esi,%ebx
call   1030 <blk_oversized_queue_0@plt>
xor    %ecx,%ecx
cmp    $0x2,%ebx
mov    $0xffffffdf,%edx
cmovae %ecx,%edx
test   %rax,%rax
mov    $0xffffff9c,%eax
cmovne %edx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @get_request_0(i32* %0, i32 %1) {
%3 = tail call i64 @blk_oversized_queue_0(i32* %0)
%4 = icmp eq i64 %3, 0
%5 = icmp ult i32 %1, 2
%6 = select i1 %5, i32 -33, i32 0
%7 = select i1 %4, i32 -100, i32 %6
ret i32 %7
}