xunge/DecIR huggingface dataset:
/* Type definitions */
struct dirent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ errno;
int skip_all(const struct dirent *dirbuf) {
  errno = EBADF;
  return 0;
}


x86 assembly (clang, -O0):
<skip_all>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_all>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@EBADF = global i32 0
@errno = global i32 0
define i32 @skip_all(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load i32, i32* @EBADF
store i32 %3, i32* @errno
ret i32 0
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@EBADF = global i32 0
@errno = global i32 0
define i32 @skip_all(%struct.dirent* nocapture readnone %0) {
%2 = load i32, i32* @EBADF
store i32 %2, i32* @errno
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int w5100_read(int, int /*<<< orphan*/ *, int);
unsigned w5100_readGAR(uint8_t *buff) { return w5100_read(0x0001, buff, 4); }


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

x86 assembly (clang, -O2):
mov    %rdi,%rsi
mov    $0x1,%edi
mov    $0x4,%edx
jmp    1030 <w5100_read@plt>

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

LLVM IR (-O2):
define i32 @w5100_readGAR(i32* %0) {
%2 = tail call i32 @w5100_read(i32 1, i32* %0, i32 4)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ getStat(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  if (argv[1] != NULL) {
    printf("Info about: %s\n", argv[1]);
    getStat(argv[1]);
  } else {
    puts("no argument given");
  }
  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)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     117b <main+0x4b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe9c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <getStat@plt>
jmp    1187 <main+0x57>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
test   %rsi,%rsi
je     1154 <main+0x24>
lea    0xebc(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%rbx),%rdi
call   1040 <getStat@plt>
jmp    1160 <main+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Info about: %s\0A\00"
@.str.1 = [18 x i8] c"no argument given\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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @getStat(i8* %17)
br label %21
19: ; preds = %2
%20 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Info about: %s\0A\00"
@.str.1 = [18 x i8] c"no argument given\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = load i8*, i8** %3
%9 = tail call i32 @getStat(i8* %8)
br label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ my_fatal(char *, char *, int);
int file_from_char(int c) {
  {
    if (!(c >= 'a' && c <= 'h'))
      my_fatal("file \"%s\", line %d, assertion \""
               "c>='a'&&c<='h'"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/square.c",
               164);
  };
  return c - 'a';
}


x86 assembly (clang, -O0):
<file_from_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     112f <file_from_char+0x1f>
cmpl   $0x68,-0x4(%rbp)
jle    1147 <file_from_char+0x37>
lea    0xeca(%rip),%rdi
lea    0xefa(%rip),%rsi
mov    $0xa4,%edx
call   1030 <my_fatal@plt>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_from_char>:
push   %rbx
mov    %edi,%ebx
add    $0xffffff9f,%ebx
cmp    $0x8,%ebx
jb     1133 <file_from_char+0x23>
lea    0xede(%rip),%rdi
lea    0xf0e(%rip),%rsi
mov    $0xa4,%edx
call   1030 <my_fatal@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [55 x i8] c"file \22%s\22, line %d, assertion \22c>='a'&&c<='h'\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/square.c\00"
define i32 @file_from_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 104
br i1 %7, label %10, label %8
8: ; preds = %5, %1
%9 = call i32 @my_fatal(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 164)
br label %10
10: ; preds = %8, %5
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 97
ret i32 %12
}

LLVM IR (-O2):
@.str = [55 x i8] c"file \22%s\22, line %d, assertion \22c>='a'&&c<='h'\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/square.c\00"
define i32 @file_from_char(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 8
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @my_fatal(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 164)
br label %6
6: ; preds = %1, %4
ret i32 %2
}
unsigned char *zcpy(void *a, void *b) {
  strcpy((char *)a, (char *)b);
  return a;
}


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

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

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

LLVM IR (-O2):
define i8* @zcpy(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ runTests();
int main() { runTests(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @runTests()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @runTests()
ret i32 0
}
/* Variables and functions */
int f(int);
int main() { return f(1); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%edi
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1)
ret i32 %1
}
int __ocl_convert_int_float(float src) { return (int)src; }


x86 assembly (clang, -O0):
<__ocl_convert_int_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_convert_int_float>:
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @__ocl_convert_int_float(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fptosi float %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @__ocl_convert_int_float(float %0) {
%2 = fptosi float %0 to i32
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
scalar_t__ sdnv_decode(int /*<<< orphan*/ const *, int /*<<< orphan*/ *);
int bundle_raw_get_proc_flags(const uint8_t *primary_raw, uint64_t *flags) {
  int off = 0, ret = 0;
  off++;
  if (sdnv_decode(primary_raw + off, flags) == 0)
    ret = 1;
  return ret;
}


x86 assembly (clang, -O0):
<bundle_raw_get_proc_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <sdnv_decode@plt>
cmp    $0x0,%rax
jne    1160 <bundle_raw_get_proc_flags+0x50>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bundle_raw_get_proc_flags>:
push   %rax
add    $0x4,%rdi
call   1030 <sdnv_decode@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bundle_raw_get_proc_flags(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
store i32 0, i32* %5
store i32 0, i32* %6
%7 = load i32, i32* %5
%8 = add nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i32*, i32** %3
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32*, i32** %4
%14 = call i64 @sdnv_decode(i32* %12, i32* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1, i32* %6
br label %17
17: ; preds = %16, %2
%18 = load i32, i32* %6
ret i32 %18
}

LLVM IR (-O2):
define i32 @bundle_raw_get_proc_flags(i32* %0, i32* %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = tail call i64 @sdnv_decode(i32* %3, i32* %1)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
void rop3_180_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = S & stk3;
  stk1 = T ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_180_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_180_1_0>:
mov    (%rdi),%al
xor    %dl,%al
and    %sil,%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_180_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %9
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = load i8, i8* %9
%18 = zext i8 %17 to i32
%19 = and i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %8
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = xor i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = and i32 %28, %31
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = load i8, i8* %5
%37 = zext i8 %36 to i32
%38 = and i32 %35, %37
%39 = or i32 %32, %38
%40 = trunc i32 %39 to i8
%41 = load i8*, i8** %4
store i8 %40, i8* %41
ret void
}

LLVM IR (-O2):
define void @rop3_180_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %1, -1
%6 = and i8 %5, %2
%7 = and i8 %4, %1
%8 = or i8 %7, %6
store i8 %8, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sort(int *, int /*<<< orphan*/, int);
int findKthLargest1(int *nums, int size, int k) {
  sort(nums, 0, size - 1);
  return nums[size - k];
}


x86 assembly (clang, -O0):
<findKthLargest1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <sort@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findKthLargest1>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%rbp
lea    -0x1(%rbx),%edx
xor    %esi,%esi
call   1030 <sort@plt>
sub    %r14d,%ebx
movslq %ebx,%rax
mov    0x0(%rbp,%rax,4),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @findKthLargest1(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = call i32 @sort(i32* %7, i32 0, i32 %9)
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = sub nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %11, i64 %15
%17 = load i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @findKthLargest1(i32* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @sort(i32* %0, i32 0, i32 %4)
%6 = sub nsw i32 %1, %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}
int bitcount_2(int n) {
  unsigned int uCount;
  uCount = n - ((n >> 1) & 033333333333) - ((n >> 2) & 011111111111);
  return (int)(((uCount + (uCount >> 3)) & 030707070707) % 63);
}


x86 assembly (clang, -O0):
<bitcount_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
and    $0xdb6db6db,%ecx
sub    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
and    $0x49249249,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x3,%ecx
add    %ecx,%eax
and    $0xc71c71c7,%eax
mov    $0x3f,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount_2>:
mov    %edi,%eax
sar    %eax
and    $0xdb6db6db,%eax
mov    %edi,%ecx
sar    $0x2,%ecx
and    $0x49249249,%ecx
add    %eax,%ecx
sub    %ecx,%edi
mov    %edi,%ecx
shr    $0x3,%ecx
add    %edi,%ecx
and    $0xc71c71c7,%ecx
imul   $0x4104105,%rcx,%rdx
shr    $0x20,%rdx
mov    %ecx,%eax
sub    %edx,%eax
shr    %eax
add    %edx,%eax
shr    $0x5,%eax
mov    %eax,%edx
shl    $0x6,%edx
sub    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @bitcount_2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = and i32 %6, -613566757
%8 = sub i32 %4, %7
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = and i32 %10, 1227133513
%12 = sub i32 %8, %11
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = load i32, i32* %3
%15 = lshr i32 %14, 3
%16 = add i32 %13, %15
%17 = and i32 %16, -954437177
%18 = urem i32 %17, 63
ret i32 %18
}

LLVM IR (-O2):
define i32 @bitcount_2(i32 %0) {
%2 = ashr i32 %0, 1
%3 = and i32 %2, -613566757
%4 = ashr i32 %0, 2
%5 = and i32 %4, 1227133513
%6 = add i32 %5, %3
%7 = sub i32 %0, %6
%8 = lshr i32 %7, 3
%9 = add i32 %8, %7
%10 = and i32 %9, -954437177
%11 = urem i32 %10, 63
ret i32 %11
}
/* Variables and functions */
int load();
int /*<<< orphan*/ logfile_message(char *);
int preferences_init() {
  logfile_message("preferences_init()");
  return load();
}


x86 assembly (clang, -O0):
<preferences_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <logfile_message@plt>
mov    $0x0,%al
call   1040 <load@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<preferences_init>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <logfile_message@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <load@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"preferences_init()\00"
define i32 @preferences_init() {
%1 = call i32 @logfile_message(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @load()
ret i32 %2
}

LLVM IR (-O2):
@.str = [19 x i8] c"preferences_init()\00"
define i32 @preferences_init() {
%1 = tail call i32 @logfile_message(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @load()
ret i32 %2
}
void DYNPropagateDidToThread(struct DYNInstanceData *did) { ; }


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

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

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

LLVM IR (-O2):
%struct.DYNInstanceData = type opaque
define void @DYNPropagateDidToThread(%struct.DYNInstanceData* nocapture %0) {
ret void
}
void genround_l_d() {}


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

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

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

LLVM IR (-O2):
define void @genround_l_d() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void error(const char *err) {
  fprintf(stderr, "ERROR => %s\n", err);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
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   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"ERROR => %s\0A\00"
define void @error(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 ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"ERROR => %s\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ edie(char *);
int open(char const *, int /*<<< orphan*/);
void xopen(const char *fn) {
  int fd = open(fn, O_RDONLY);
  if (fd < 0)
    edie("open");
  close(fd);
}


x86 assembly (clang, -O0):
<xopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1167 <xopen+0x37>
lea    0xe9e(%rip),%rdi
call   1040 <edie@plt>
mov    -0xc(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xopen>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1151 <xopen+0x21>
lea    0xeb4(%rip),%rdi
call   1040 <edie@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>

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

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [5 x i8] c"open\00"
define void @xopen(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @edie(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @close(i32 %3)
ret void
}
void gtk_accel_label_refetch() {}


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

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

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

LLVM IR (-O2):
define void @gtk_accel_label_refetch() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int netkeyer(int, char *);
void catchint(__attribute__((unused)) int signal) {
  __attribute__((unused)) int result = netkeyer(4, "");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<catchint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
lea    0xec9(%rip),%rsi
call   1030 <netkeyer@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<catchint>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x4,%edi
call   1030 <netkeyer@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@EXIT_SUCCESS = global i32 0
define void @catchint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @netkeyer(i32 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* %3
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@EXIT_SUCCESS = global i32 0
define void @catchint(i32 %0) {
%2 = tail call i32 @netkeyer(i32 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int square(int a) { return a * a; }


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

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

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

LLVM IR (-O2):
define i32 @square(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(int /*<<< orphan*/);
int _strisdigit(const char *str) {
  while (*str) {
    if (!isdigit(*str++))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<_strisdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115a <_strisdigit+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1155 <_strisdigit+0x45>
movl   $0x0,-0x4(%rbp)
jmp    1161 <_strisdigit+0x51>
jmp    111c <_strisdigit+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strisdigit>:
movsbl (%rdi),%eax
test   %eax,%eax
je     1116 <_strisdigit+0x16>
add    $0x1,%rdi
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     1100 <_strisdigit>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @_strisdigit(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = sext i8 %4 to i32
%9 = add nsw i32 %8, -48
%10 = icmp ult i32 %9, 10
br i1 %10, label %2, label %11
11: ; preds = %2, %6
%12 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %12
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ xalloc_die();
void *xcalloc(size_t n, size_t s) {
  void *p;
  p = calloc(n, s);
  if (p == 0 && n && s)
    xalloc_die();
  return p;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1169 <xcalloc+0x49>
cmpq   $0x0,-0x8(%rbp)
je     1169 <xcalloc+0x49>
cmpq   $0x0,-0x10(%rbp)
je     1169 <xcalloc+0x49>
mov    $0x0,%al
call   1040 <xalloc_die@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <calloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1149 <xcalloc+0x29>
test   %r15,%r15
je     1149 <xcalloc+0x29>
test   %r14,%r14
jne    1149 <xcalloc+0x29>
xor    %eax,%eax
call   1040 <xalloc_die@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %0, 0
%6 = and i1 %5, %4
%7 = icmp ne i64 %1, 0
%8 = and i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @xalloc_die()
br label %11
11: ; preds = %9, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ getCurrentProcessPid();
int /*<<< orphan*/ uart_puts(char *);
char *uintToString(int /*<<< orphan*/, int);
void printPid(void) {
  uart_puts("Pid de la consola = ");
  uart_puts(uintToString(getCurrentProcessPid(), 10));
  uart_puts("\n\r");
}


x86 assembly (clang, -O0):
<printPid>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <uart_puts@plt>
mov    $0x0,%al
call   1040 <getCurrentProcessPid@plt>
mov    %eax,%edi
mov    $0xa,%esi
call   1030 <uintToString@plt>
mov    %rax,%rdi
call   1050 <uart_puts@plt>
lea    0xeb3(%rip),%rdi
call   1050 <uart_puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPid>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <uart_puts@plt>
xor    %eax,%eax
call   1040 <getCurrentProcessPid@plt>
mov    %eax,%edi
mov    $0xa,%esi
call   1030 <uintToString@plt>
mov    %rax,%rdi
call   1050 <uart_puts@plt>
lea    0xeb6(%rip),%rdi
pop    %rax
jmp    1050 <uart_puts@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Pid de la consola = \00"
@.str.1 = [3 x i8] c"\0A\0D\00"
define void @printPid() {
%1 = call i32 @uart_puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @getCurrentProcessPid()
%3 = call i8* @uintToString(i32 %2, i32 10)
%4 = call i32 @uart_puts(i8* %3)
%5 = call i32 @uart_puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Pid de la consola = \00"
@.str.1 = [3 x i8] c"\0A\0D\00"
define void @printPid() {
%1 = tail call i32 @uart_puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getCurrentProcessPid()
%3 = tail call i8* @uintToString(i32 %2, i32 10)
%4 = tail call i32 @uart_puts(i8* %3)
%5 = tail call i32 @uart_puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mrpx(unsigned long);
int /*<<< orphan*/ putc(char);
void mprintx(unsigned long x) {
  if (x == 0)
    putc('0');
  else
    mrpx(x);
  putc(' ');
}


x86 assembly (clang, -O0):
<mprintx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1146 <mprintx+0x26>
mov    $0x30,%edi
call   1030 <putc@plt>
jmp    114f <mprintx+0x2f>
mov    -0x8(%rbp),%rdi
call   1040 <mrpx@plt>
mov    $0x20,%edi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mprintx>:
push   %rax
test   %rdi,%rdi
je     112d <mprintx+0xd>
call   1040 <mrpx@plt>
jmp    1137 <mprintx+0x17>
mov    $0x30,%edi
call   1030 <putc@plt>
mov    $0x20,%edi
pop    %rax
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @mprintx(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @putc(i8 signext 48)
br label %10
7: ; preds = %1
%8 = load i64, i64* %2
%9 = call i32 @mrpx(i64 %8)
br label %10
10: ; preds = %7, %5
%11 = call i32 @putc(i8 signext 32)
ret void
}

LLVM IR (-O2):
define void @mprintx(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @putc(i8 signext 48)
br label %7
5: ; preds = %1
%6 = tail call i32 @mrpx(i64 %0)
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @putc(i8 signext 32)
ret void
}
/* Variables and functions */
bool numeric(const char c) { return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <numeric+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numeric>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @numeric(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @numeric(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
void dopr_outch(char *buffer, unsigned int *currlen, unsigned int maxlen,
                char c) {
  if (*currlen < maxlen) {
    buffer[(*currlen)] = c;
  }
  (*currlen)++;
}


x86 assembly (clang, -O0):
<dopr_outch>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jae    1133 <dopr_outch+0x33>
mov    -0x15(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dopr_outch>:
mov    (%rsi),%eax
cmp    %edx,%eax
jae    110b <dopr_outch+0xb>
mov    %cl,(%rdi,%rax,1)
mov    (%rsi),%eax
add    $0x1,%eax
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @dopr_outch(i8* nocapture writeonly %0, i32* nocapture %1, i32 %2, i8 signext %3) {
%5 = load i32, i32* %1
%6 = icmp ult i32 %5, %2
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = zext i32 %5 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %3, i8* %9
%10 = load i32, i32* %1
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ %10, %7 ], [ %5, %4 ]
%13 = add i32 %12, 1
store i32 %13, i32* %1
ret void
}
unsigned short csum_fold(unsigned int sum) {
  sum = (sum & 0xffff) + (sum >> 16);
  sum = (sum & 0xffff) + (sum >> 16);
  return ~sum;
}


x86 assembly (clang, -O0):
<csum_fold>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_fold>:
movzwl %di,%ecx
shr    $0x10,%edi
add    %edi,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
add    %ecx,%eax
not    %eax
ret

LLVM IR (-O0):
define zeroext i16 @csum_fold(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65535
%5 = load i32, i32* %2
%6 = lshr i32 %5, 16
%7 = add i32 %4, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 65535
%10 = load i32, i32* %2
%11 = lshr i32 %10, 16
%12 = add i32 %9, %11
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = xor i32 %13, -1
%15 = trunc i32 %14 to i16
ret i16 %15
}

LLVM IR (-O2):
define zeroext i16 @csum_fold(i32 %0) {
%2 = and i32 %0, 65535
%3 = lshr i32 %0, 16
%4 = add nuw nsw i32 %2, %3
%5 = lshr i32 %4, 16
%6 = add nuw nsw i32 %5, %4
%7 = trunc i32 %6 to i16
%8 = xor i16 %7, -1
ret i16 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
char *null_array_SINT16(int16_t *arr) {
  if (arr == NULL) {
    return "null";
  } else {
    return "non_null";
  }
}


x86 assembly (clang, -O0):
<null_array_SINT16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1123 <null_array_SINT16+0x23>
lea    0xeea(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    112e <null_array_SINT16+0x2e>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<null_array_SINT16>:
test   %rdi,%rdi
lea    0xefa(%rip),%rcx
lea    0xeef(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"null\00"
@.str.1 = [9 x i8] c"non_null\00"
define i8* @null_array_SINT16(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"null\00"
@.str.1 = [9 x i8] c"non_null\00"
define i8* @null_array_SINT16(i32* readnone %0) {
%2 = icmp eq i32* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
__attribute__((no, noclone)) signed __int128 t111_4sub(signed __int128 x) {
  signed __int128 y = (-1);
  signed __int128 r;
  if (__builtin_sub_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t111_4sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movq   $0xffffffffffffffff,-0x38(%rbp)
ff
movq   $0xffffffffffffffff,-0x40(%rbp)
ff
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rax
sub    %rsi,%rdx
sbb    %rax,%rcx
seto   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    116e <t111_4sub+0x5e>
jmp    1175 <t111_4sub+0x65>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t111_4sub>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
adc    $0x0,%r14
jno    112b <t111_4sub+0x1b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t111_4sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 -1, i128* %6
%12 = load i128, i128* %5
%13 = load i128, i128* %6
%14 = call { i128, i1 } @llvm.ssub.with.overflow.i128(i128 %12, i128 %13)
%15 = extractvalue { i128, i1 } %14, 1
%16 = extractvalue { i128, i1 } %14, 0
store i128 %16, i128* %7
br i1 %15, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %2
%20 = load i128, i128* %7
store i128 %20, i128* %3
%21 = bitcast i128* %3 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t111_4sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %6, i128 1)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
long long zuzz() { return 0x00007fff00000000LL; }


x86 assembly (clang, -O0):
<zuzz>:
push   %rbp
mov    %rsp,%rbp
movabs $0x7fff00000000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zuzz>:
movabs $0x7fff00000000,%rax
ret

LLVM IR (-O0):
define i64 @zuzz() {
ret i64 140733193388032
}

LLVM IR (-O2):
define i64 @zuzz() {
ret i64 140733193388032
}
OP(ed, e2) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
void _on_reload(void) {}


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

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

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

LLVM IR (-O2):
define void @_on_reload() {
ret void
}
/* Variables and functions */
int DigitSum(int);
int DigitRoot(int n) {
  if (n / 10 == 0)
    return n;
  else {
    int sum;
    sum = DigitSum(n);
    return DigitRoot(sum);
  }
}


x86 assembly (clang, -O0):
<DigitRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jne    114a <DigitRoot+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <DigitRoot+0x40>
mov    -0x8(%rbp),%edi
call   1030 <DigitSum@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <DigitRoot@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DigitRoot>:
push   %rax
mov    %edi,%eax
lea    0x9(%rax),%ecx
cmp    $0x13,%ecx
jb     1131 <DigitRoot+0x21>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <DigitSum@plt>
mov    %eax,%ecx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1120 <DigitRoot+0x10>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @DigitRoot(i32 %0) {
%2 = add i32 %0, 9
%3 = icmp ult i32 %2, 19
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %6, %4 ], [ %0, %1 ]
%6 = tail call i32 @DigitSum(i32 %5)
%7 = add i32 %6, 9
%8 = icmp ult i32 %7, 19
br i1 %8, label %9, label %4
9: ; preds = %4, %1
%10 = phi i32 [ %0, %1 ], [ %6, %4 ]
ret i32 %10
}
void splay_tree_xmalloc_deallocate(object, data) void *object;
void *data __attribute__((__unused__));
{ free(object); }


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

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

LLVM IR (-O0):
define void @splay_tree_xmalloc_deallocate(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
ret void
}

LLVM IR (-O2):
define void @splay_tree_xmalloc_deallocate(i8* nocapture %0, i8* nocapture readnone %1) {
tail call void @free(i8* %0)
ret void
}
void f7(void) {
  _Bool b;
  switch (b = 1) {
  case 3:
    break;
  }
}


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
movb   $0x1,-0x1(%rbp)
mov    $0x1,%al
test   %al,%al
jne    111c <f7+0x1c>
jmp    1117 <f7+0x17>
jmp    111c <f7+0x1c>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f7() {
%1 = alloca i8
store i8 1, i8* %1
switch i32 1, label %3 [
i32 3, label %2
]
2: ; preds = %0
br label %3
3: ; preds = %0, %2
ret void
}

LLVM IR (-O2):
define void @f7() {
ret void
}
/* Variables and functions */
char *strchr(char const *, char const);
char *strrchr(char const *, char);
char *xbasename(const char *path) {
  char *bn;
  bn = strrchr(path, '/');
  if (bn == NULL) {
    return strchr(path, *path);
  }
  return bn + 1;
}


x86 assembly (clang, -O0):
<xbasename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1162 <xbasename+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
jmp    116e <xbasename+0x4e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xbasename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1139 <xbasename+0x19>
add    $0x1,%rax
pop    %rbx
ret
movsbl (%rbx),%esi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strchr@plt>

LLVM IR (-O0):
define i8* @xbasename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = call i8* @strchr(i8* %10, i8 signext %12)
store i8* %13, i8** %2
br label %17
14: ; preds = %1
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %2
br label %17
17: ; preds = %14, %9
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
define i8* @xbasename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i8, i8* %0
%6 = tail call i8* @strchr(i8* %0, i8 signext %5)
br label %9
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %2, i64 1
br label %9
9: ; preds = %7, %4
%10 = phi i8* [ %6, %4 ], [ %8, %7 ]
ret i8* %10
}