xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strstr(char *, char *);
int findString(char *to_find, char *where_to_look) {
  int result = -1;
  char *ptstr;
  ptstr = strstr(where_to_look, to_find);
  if (ptstr == NULL) {
    return result;
  }
  result = ptstr - where_to_look;
  return result;
}


x86 assembly (clang, -O0):
<findString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    114e <findString+0x3e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <findString+0x52>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findString>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rbx,%rdi
call   1030 <strstr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @findString(i8* nocapture %0, i8* %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %1, i8* dereferenceable(1) %0)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %1 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int request;
};
typedef TYPE_1__ XMappingEvent;

/* Variables and functions */
void set_XMappingEvent_request(void *_p, int _v) {
  ((XMappingEvent *)_p)->request = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XMappingEvent_request>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XMappingEvent_request(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 i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XMappingEvent_request(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _PROCEDURE_LINKAGE_TABLE_();
void wait() {
  _PROCEDURE_LINKAGE_TABLE_();
  return;
}


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

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

LLVM IR (-O0):
define void @wait() {
%1 = call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}

LLVM IR (-O2):
define void @wait() {
%1 = tail call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}
/* Variables and functions */
double __ieee754_acosh(double);
double acosh(double x) { return __ieee754_acosh(x); }


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

x86 assembly (clang, -O2):
<acosh>:
jmp    1030 <__ieee754_acosh@plt>

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

LLVM IR (-O2):
define double @acosh(double %0) {
%2 = tail call double @__ieee754_acosh(double %0)
ret double %2
}
long InterlockedExchange(long *p, long v) {
  long old = *p;
  *p = v;
  return old;
}


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

x86 assembly (clang, -O2):
<InterlockedExchange>:
mov    (%rdi),%rax
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
define i64 @InterlockedExchange(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
store i64 %7, i64* %5
%8 = load i64, i64* %4
%9 = load i64*, i64** %3
store i64 %8, i64* %9
%10 = load i64, i64* %5
ret i64 %10
}

LLVM IR (-O2):
define i64 @InterlockedExchange(i64* nocapture %0, i64 %1) {
%3 = load i64, i64* %0
store i64 %1, i64* %0
ret i64 %3
}
/* Variables and functions */
int power(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", power(3, 3));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <power@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @power(i32 3, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct link_map {
  int dummy;
};
typedef int /*<<< orphan*/ lm;

/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
int /*<<< orphan*/ STDOUT_FILENO;
scalar_t__ dlopen(char *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int /*<<< orphan*/, struct link_map **, int);
void do_get_linkmap() {
  struct link_map *lm = (struct link_map *)dlopen("libc.so.6", RTLD_LAZY);
  write(STDOUT_FILENO, &lm, sizeof(lm));
}


x86 assembly (clang, -O0):
<do_get_linkmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1040 <dlopen@plt>
mov    %rax,-0x8(%rbp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_get_linkmap>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <dlopen@plt>
mov    %rax,(%rsp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.link_map = type { i32 }
@.str = [10 x i8] c"libc.so.6\00"
@RTLD_LAZY = global i32 0
@STDOUT_FILENO = global i32 0
define void @do_get_linkmap() {
%1 = alloca %struct.link_map*
%2 = load i32, i32* @RTLD_LAZY
%3 = call i64 @dlopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = inttoptr i64 %3 to %struct.link_map*
store %struct.link_map* %4, %struct.link_map** %1
%5 = load i32, i32* @STDOUT_FILENO
%6 = call i32 @write(i32 %5, %struct.link_map** %1, i32 8)
ret void
}

LLVM IR (-O2):
%struct.link_map = type { i32 }
@.str = [10 x i8] c"libc.so.6\00"
@RTLD_LAZY = global i32 0
@STDOUT_FILENO = global i32 0
define void @do_get_linkmap() {
%1 = alloca %struct.link_map*
%2 = bitcast %struct.link_map** %1 to i8*
%3 = load i32, i32* @RTLD_LAZY
%4 = tail call i64 @dlopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = inttoptr i64 %4 to %struct.link_map*
store %struct.link_map* %5, %struct.link_map** %1
%6 = load i32, i32* @STDOUT_FILENO
%7 = call i32 @write(i32 %6, %struct.link_map** %1, i32 8)
ret void
}
/* Variables and functions */
void *realloc(void *, unsigned long);
void *tcc_realloc(void *ptr, unsigned long size) {
  void *ptr1;
  ptr1 = realloc(ptr, size);
  return ptr1;
}


x86 assembly (clang, -O0):
<tcc_realloc>:
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 <realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcc_realloc>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @tcc_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
struct addrinfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
void xgetaddrinfo_cleanup(void *data) { freeaddrinfo((struct addrinfo *)data); }


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

x86 assembly (clang, -O2):
<xgetaddrinfo_cleanup>:
jmp    1030 <freeaddrinfo@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32 }
define void @xgetaddrinfo_cleanup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.addrinfo*
%5 = call i32 @freeaddrinfo(%struct.addrinfo* %4)
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32 }
define void @xgetaddrinfo_cleanup(i8* %0) {
%2 = bitcast i8* %0 to %struct.addrinfo*
%3 = tail call i32 @freeaddrinfo(%struct.addrinfo* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char karakter;
  printf("Bir karakter giriniz:");
  scanf("%c", &karakter);
  printf("Karakterin tam sayi degeri %d dir.", karakter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%esi
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Bir karakter giriniz:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [35 x i8] c"Karakterin tam sayi degeri %d dir.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Bir karakter giriniz:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [35 x i8] c"Karakterin tam sayi degeri %d dir.\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
char *read_file(const char *file) {
  FILE *f = fopen(file, "r");
  if (f == NULL)
    return NULL;
  fclose(f);
}


x86 assembly (clang, -O0):
<read_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <read_file+0x38>
movq   $0x0,-0x8(%rbp)
jmp    1161 <read_file+0x41>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_file>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     113a <read_file+0x1a>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define noalias i8* @read_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
ret i8* null
}
void foo045(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo045(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int x, y;
  scanf("%i%d", &x, &y);
  printf("%d %d\n", x, y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%i%d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}
int odd_even(int reg) { return (reg & 1); }


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

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

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

LLVM IR (-O2):
define i32 @odd_even(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef char *uint16_t;

/* Variables and functions */
uint16_t get_ds(void) {
  uint16_t result;
  asm volatile("movw %%"
               "ds"
               ", %0"
               : "=m"(result));
  return result;
}


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

x86 assembly (clang, -O2):
<get_ds>:
mov    %ds,-0x8(%rsp)
mov    -0x8(%rsp),%rax
ret

LLVM IR (-O0):
define i8* @get_ds() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define i8* @get_ds() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = load i8*, i8** %1
ret i8* %3
}
/* Type definitions */
struct battle_char {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_status(struct battle_char *, int);
scalar_t__ get_random(int /*<<< orphan*/, int);
scalar_t__ mod6(struct battle_char *, struct battle_char *, int);
void shell(struct battle_char *origin, struct battle_char *target) {
  if (get_random(0, 100) < mod6(origin, target, 200))
    add_status(target, 20);
}


x86 assembly (clang, -O0):
<shell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <get_random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xc8,%edx
call   1040 <mod6@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jge    1180 <shell+0x50>
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1050 <add_status@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shell>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <get_random@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xc8,%edx
call   1040 <mod6@plt>
cmp    %rax,%rbx
jge    1171 <shell+0x41>
mov    %r14,%rdi
mov    $0x14,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <add_status@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.battle_char = type { i32 }
define void @shell(%struct.battle_char* %0, %struct.battle_char* %1) {
%3 = alloca %struct.battle_char*
%4 = alloca %struct.battle_char*
store %struct.battle_char* %0, %struct.battle_char** %3
store %struct.battle_char* %1, %struct.battle_char** %4
%5 = call i64 @get_random(i32 0, i32 100)
%6 = load %struct.battle_char*, %struct.battle_char** %3
%7 = load %struct.battle_char*, %struct.battle_char** %4
%8 = call i64 @mod6(%struct.battle_char* %6, %struct.battle_char* %7, i32 200)
%9 = icmp slt i64 %5, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load %struct.battle_char*, %struct.battle_char** %4
%12 = call i32 @add_status(%struct.battle_char* %11, i32 20)
br label %13
13: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
%struct.battle_char = type { i32 }
define void @shell(%struct.battle_char* %0, %struct.battle_char* %1) {
%3 = tail call i64 @get_random(i32 0, i32 100)
%4 = tail call i64 @mod6(%struct.battle_char* %0, %struct.battle_char* %1, i32 200)
%5 = icmp slt i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @add_status(%struct.battle_char* %1, i32 20)
br label %8
8: ; preds = %6, %2
ret void
}
char _q_x2c(char hex_up, char hex_low) {
  char digit;
  digit = 16 * (hex_up >= 'A' ? ((hex_up & 0xdf) - 'A') + 10 : (hex_up - '0'));
  digit += (hex_low >= 'A' ? ((hex_low & 0xdf) - 'A') + 10 : (hex_low - '0'));
  return digit;
}


x86 assembly (clang, -O0):
<_q_x2c>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1134 <_q_x2c+0x34>
movsbl -0x1(%rbp),%eax
and    $0xdf,%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <_q_x2c+0x3e>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
mov    %al,-0x3(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     116b <_q_x2c+0x6b>
movsbl -0x2(%rbp),%eax
and    $0xdf,%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <_q_x2c+0x75>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
movsbl -0x3(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_q_x2c>:
mov    %esi,%eax
and    $0xdf,%al
add    $0xc9,%al
lea    -0x30(%rsi),%ecx
cmp    $0x41,%sil
movzbl %cl,%ecx
movzbl %al,%edx
cmovl  %ecx,%edx
mov    %edi,%eax
shl    $0x4,%al
lea    -0x70(%rax),%ecx
cmp    $0x41,%dil
movzbl %al,%esi
movzbl %cl,%eax
cmovl  %esi,%eax
add    %dl,%al
ret

LLVM IR (-O0):
define signext i8 @_q_x2c(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 65
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = and i32 %11, 223
%13 = sub nsw i32 %12, 65
%14 = add nsw i32 %13, 10
br label %19
15: ; preds = %2
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 48
br label %19
19: ; preds = %15, %9
%20 = phi i32 [ %14, %9 ], [ %18, %15 ]
%21 = mul nsw i32 16, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %5
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 65
br i1 %25, label %26, label %32
26: ; preds = %19
%27 = load i8, i8* %4
%28 = sext i8 %27 to i32
%29 = and i32 %28, 223
%30 = sub nsw i32 %29, 65
%31 = add nsw i32 %30, 10
br label %36
32: ; preds = %19
%33 = load i8, i8* %4
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
br label %36
36: ; preds = %32, %26
%37 = phi i32 [ %31, %26 ], [ %35, %32 ]
%38 = load i8, i8* %5
%39 = sext i8 %38 to i32
%40 = add nsw i32 %39, %37
%41 = trunc i32 %40 to i8
store i8 %41, i8* %5
%42 = load i8, i8* %5
ret i8 %42
}

LLVM IR (-O2):
define signext i8 @_q_x2c(i8 signext %0, i8 signext %1) {
%3 = icmp sgt i8 %0, 64
%4 = icmp sgt i8 %1, 64
%5 = and i8 %1, -33
%6 = add i8 %5, -55
%7 = add i8 %1, -48
%8 = select i1 %4, i8 %6, i8 %7
%9 = shl i8 %0, 4
%10 = add i8 %9, -112
%11 = select i1 %3, i8 %10, i8 %9
%12 = add i8 %8, %11
ret i8 %12
}
int main(int argc, char const *argv[]) {
  int x, i, soma, n;
  x = 1;
  for (i = 0; x != 0; i++) {
  }
  i = 0;
  x = 1;
  while (x != 0) {
  }
  i = 0;
  do {
  } while (x != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     113d <main+0x3d>
jmp    112f <main+0x2f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1120 <main+0x20>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     115a <main+0x5a>
jmp    114b <main+0x4b>
movl   $0x0,-0x18(%rbp)
jmp    1166 <main+0x66>
cmpl   $0x0,-0x14(%rbp)
jne    1161 <main+0x61>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O2):
int test_ctrldev(const struct ctrldev *_odev) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.ctrldev = type opaque
define i32 @test_ctrldev(%struct.ctrldev* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ fwrite(char const *, int, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void silly_log_lstr(const char *str, size_t sz) {
  fwrite(str, sizeof(char), sz, stdout);
}


x86 assembly (clang, -O0):
<silly_log_lstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    0x2eb1(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<silly_log_lstr>:
mov    %rsi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @silly_log_lstr(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = load i32, i32* @stdout
%8 = call i32 @fwrite(i8* %5, i32 1, i64 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @silly_log_lstr(i8* %0, i64 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fwrite(i8* %0, i32 1, i64 %1, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  int n = 0;
  while (n < 3)
    printf("n is %d\n", n);
  n++;
  printf("That 's all this program does\n");
  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   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    114d <main+0x3d>
mov    -0x14(%rbp),%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112d <main+0x1d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [9 x i8] c"n is %d\0A\00"
@.str.1 = [31 x i8] c"That 's all this program does\0A\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 0, i32* %6
br label %7
7: ; preds = %10, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %7
13: ; preds = %7
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"n is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  for (int i = 0; i < argc; i++) {
    printf("%s\n", argv[i]);
  }
  return 1;
}


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   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <main+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1145 <main+0x35>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\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 0, i32* %6
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %7
21: ; preds = %7
ret i32 1
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %7, %2
ret i32 1
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
int parse_to_int(char *isbn_number, int *parsed_isbn_number) {
  int position_counter = 0;
  while (isbn_number[position_counter] != '\0') {
    parsed_isbn_number[position_counter] = isbn_number[position_counter] - 48;
    position_counter++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<parse_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1150 <parse_to_int+0x50>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
sub    $0x30,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <parse_to_int+0x13>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_to_int>:
mov    (%rdi),%al
test   %al,%al
je     1126 <parse_to_int+0x26>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movsbl %al,%eax
add    $0xffffffd0,%eax
mov    %eax,(%rsi,%rcx,4)
movzbl 0x1(%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <parse_to_int+0x10>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @parse_to_int(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %11, %5 ], [ 0, %2 ]
%7 = phi i8 [ %13, %5 ], [ %3, %2 ]
%8 = sext i8 %7 to i32
%9 = add nsw i32 %8, -48
%10 = getelementptr inbounds i32, i32* %1, i64 %6
store i32 %9, i32* %10
%11 = add nuw nsw i64 %6, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
ret i32 1
}
double ret_double(double arg1) { return arg1; }


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

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

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

LLVM IR (-O2):
define double @ret_double(double returned %0) {
ret double %0
}
int alg2index(const char *alg) {
  return ((7 ^ ('h' - alg[0])) + (('8' - alg[1]) * 8));
}


x86 assembly (clang, -O0):
<alg2index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x68,%eax
sub    %ecx,%eax
xor    $0x7,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%edx
mov    $0x38,%ecx
sub    %edx,%ecx
shl    $0x3,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<alg2index>:
movsbl (%rdi),%ecx
mov    $0x68,%eax
sub    %ecx,%eax
xor    $0x7,%eax
movsbl 0x1(%rdi),%ecx
shl    $0x3,%ecx
sub    %ecx,%eax
add    $0x1c0,%eax
ret

LLVM IR (-O0):
define i32 @alg2index(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = sub nsw i32 104, %6
%8 = xor i32 7, %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = sub nsw i32 56, %12
%14 = mul nsw i32 %13, 8
%15 = add nsw i32 %8, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @alg2index(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = sub nsw i32 104, %3
%5 = xor i32 %4, 7
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = mul nsw i32 %8, -8
%10 = add nsw i32 %9, 448
%11 = add nsw i32 %10, %5
ret i32 %11
}
int addone(int x) { return x + 1; }


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

x86 assembly (clang, -O2):
<addone>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @addone(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ foo();
void __attribute__((destructor)) bar(void) {
  static int i;
  foo();
  ++i;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <foo@plt>
mov    0x2f0b(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f02(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
addl   $0x1,0x2f0d(%rip)
pop    %rax
ret

LLVM IR (-O0):
@bar.i = internal global i32 0
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* null }]
define void @bar() {
%1 = call i32 (...) @foo()
%2 = load i32, i32* @bar.i
%3 = add nsw i32 %2, 1
store i32 %3, i32* @bar.i
ret void
}

LLVM IR (-O2):
@bar.i = internal unnamed_addr global i32 0
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* null }]
define void @bar() {
%1 = tail call i32 (...) @foo()
%2 = load i32, i32* @bar.i
%3 = add nsw i32 %2, 1
store i32 %3, i32* @bar.i
ret void
}
/* Type definitions */
struct mux_socket {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mux_socket_close(struct mux_socket *);
int /*<<< orphan*/ printf(char *, int);
void eventcb(struct mux_socket *sock, int event, void *arg) {
  printf("user event(%d) call\n", event);
  mux_socket_close(sock);
}


x86 assembly (clang, -O0):
<eventcb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <mux_socket_close@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mux_socket = type { i32 }
@.str = [21 x i8] c"user event(%d) call\0A\00"
define void @eventcb(%struct.mux_socket* %0, i32 %1, i8* %2) {
%4 = alloca %struct.mux_socket*
%5 = alloca i32
%6 = alloca i8*
store %struct.mux_socket* %0, %struct.mux_socket** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load %struct.mux_socket*, %struct.mux_socket** %4
%10 = call i32 @mux_socket_close(%struct.mux_socket* %9)
ret void
}

LLVM IR (-O2):
%struct.mux_socket = type { i32 }
@.str = [21 x i8] c"user event(%d) call\0A\00"
define void @eventcb(%struct.mux_socket* %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = tail call i32 @mux_socket_close(%struct.mux_socket* %0)
ret void
}
/* Variables and functions */
int cmp_vector_array_idxs_lex(void *, void const *, void const *);
int rcmp_vector_array_idxs_lex(void *qsort_thunk_vp, const void *xvp,
                               const void *yvp) {
  return -1 * cmp_vector_array_idxs_lex(qsort_thunk_vp, xvp, yvp);
}


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

x86 assembly (clang, -O2):
<rcmp_vector_array_idxs_lex>:
push   %rax
call   1030 <cmp_vector_array_idxs_lex@plt>
neg    %eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @rcmp_vector_array_idxs_lex(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @cmp_vector_array_idxs_lex(i8* %0, i8* %1, i8* %2)
%5 = sub nsw i32 0, %4
ret i32 %5
}
int _sasl_seterror_usererr(int saslerr) {
  if (saslerr == -20)
    return -13;
  return saslerr;
}


x86 assembly (clang, -O0):
<_sasl_seterror_usererr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xffffffec,-0x8(%rbp)
jne    111d <_sasl_seterror_usererr+0x1d>
movl   $0xfffffff3,-0x4(%rbp)
jmp    1123 <_sasl_seterror_usererr+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sasl_seterror_usererr>:
cmp    $0xffffffec,%edi
mov    $0xfffffff3,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define i32 @_sasl_seterror_usererr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, -20
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -13, i32* %2
br label %9
7: ; preds = %1
%8 = load i32, i32* %3
store i32 %8, i32* %2
br label %9
9: ; preds = %7, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @_sasl_seterror_usererr(i32 %0) {
%2 = icmp eq i32 %0, -20
%3 = select i1 %2, i32 -13, i32 %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("usage: descramble [options] <input file> <output file>\n");
  printf("options:\n"
         "\t-fm     Archos FM recorder format\n"
         "\t-v2     Archos V2 recorder format\n"
         "\t-mm     Archos Multimedia format\n"
         "\t-iriver iRiver format\n"
         "\t-gigabeat Toshiba Gigabeat format\n"
         "\t-iaudio iAudio format\n"
         "\nNo option assumes Archos standard player/recorder format.\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [56 x i8] c"usage: descramble [options] <input file> <output file>\0A\00"
@.str.1 = [254 x i8] c"options:\0A\09-fm Archos FM recorder format\0A\09-v2 Archos V2 recorder format\0A\09-mm Archos Multimedia format\0A\09-iriver iRiver format\0A\09-gigabeat Toshiba Gigabeat format\0A\09-iaudio iAudio format\0A\0ANo option assumes Archos standard player/recorder format.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([254 x i8], [254 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [55 x i8] c"usage: descramble [options] <input file> <output file>\00"
@str.2 = [253 x i8] c"options:\0A\09-fm Archos FM recorder format\0A\09-v2 Archos V2 recorder format\0A\09-mm Archos Multimedia format\0A\09-iriver iRiver format\0A\09-gigabeat Toshiba Gigabeat format\0A\09-iaudio iAudio format\0A\0ANo option assumes Archos standard player/recorder format.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([253 x i8], [253 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_88int64_highword_reg(long long val) {
  return ((val >> 32) & (0x88 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_88int64_highword_reg(i64 %0) {
%2 = and i64 %0, 584115552256
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *progname) {
  printf("Usage:\n");
  printf("%s [opt] [files/folders]\n", progname);
  printf("\t -a\t\t to append to last copy/cut operation.\n");
  printf("\t -h/--help\t to display this info\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [26 x i8] c"%s [opt] [files/folders]\0A\00"
@.str.2 = [46 x i8] c"\09 -a\09\09 to append to last copy/cut operation.\0A\00"
@.str.3 = [35 x i8] c"\09 -h/--help\09 to display this info\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"%s [opt] [files/folders]\0A\00"
@str = [7 x i8] c"Usage:\00"
@str.4 = [45 x i8] c"\09 -a\09\09 to append to last copy/cut operation.\00"
@str.5 = [34 x i8] c"\09 -h/--help\09 to display this info\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ GENERAL_NAME;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ GENERAL_NAME_it;
int i2d_GENERAL_NAME(GENERAL_NAME *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &GENERAL_NAME_it);
}


x86 assembly (clang, -O0):
<i2d_GENERAL_NAME>:
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    0x2eb1(%rip),%rdx
call   1030 <ASN1_item_i2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_GENERAL_NAME>:
mov    0x2ec9(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

LLVM IR (-O0):
@GENERAL_NAME_it = global i32 0
define i32 @i2d_GENERAL_NAME(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 = call i32 @ASN1_item_i2d(i32* %5, i8** %6, i32* @GENERAL_NAME_it)
ret i32 %7
}

LLVM IR (-O2):
@GENERAL_NAME_it = global i32 0
define i32 @i2d_GENERAL_NAME(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @GENERAL_NAME_it)
ret i32 %3
}