xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t strlcpy(char *, char const *, size_t);
void strappend(char **dst, size_t *size, const char *src) {
  size_t len = strlcpy(*dst, src, *size);
  if (len >= *size)
    len = *size;
  *dst += len;
  *size -= len;
}


x86 assembly (clang, -O0):
<strappend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
call   1030 <strlcpy@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jb     115b <strappend+0x4b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
sub    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strappend>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
mov    (%rsi),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <strlcpy@plt>
mov    (%rbx),%rcx
cmp    %rcx,%rax
cmovae %rcx,%rax
add    %rax,(%r14)
sub    %rax,%rcx
mov    %rcx,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @strappend(i8** nocapture %0, i64* nocapture %1, i8* %2) {
%4 = load i8*, i8** %0
%5 = load i64, i64* %1
%6 = tail call i64 @strlcpy(i8* %4, i8* %2, i64 %5)
%7 = load i64, i64* %1
%8 = icmp ult i64 %6, %7
%9 = select i1 %8, i64 %6, i64 %7
%10 = load i8*, i8** %0
%11 = getelementptr inbounds i8, i8* %10, i64 %9
store i8* %11, i8** %0
%12 = sub i64 %7, %9
store i64 %12, i64* %1
ret void
}
/* Variables and functions */
char *malloc(int);
char *malloc_heap(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<malloc_heap>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @malloc_heap(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ f1(int, double, ...);
int main(int argc, char **argv) {
  f1(0, 3.4);
  f1(2, 3.4, 4.5);
  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)
xor    %edi,%edi
movsd  0xed0(%rip),%xmm0
mov    $0x1,%al
call   1030 <f1@plt>
mov    $0x2,%edi
movsd  0xebc(%rip),%xmm0
movsd  0xebc(%rip),%xmm1
mov    $0x2,%al
call   1030 <f1@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
xor    %edi,%edi
mov    $0x1,%al
call   1030 <f1@plt>
movsd  0xede(%rip),%xmm1
mov    $0x2,%edi
movsd  0xec9(%rip),%xmm0
mov    $0x2,%al
call   1030 <f1@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i32, double, ...) @f1(i32 0, double 3.400000e+00)
%7 = call i32 (i32, double, ...) @f1(i32 2, double 3.400000e+00, double 4.500000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i32, double, ...) @f1(i32 0, double 3.400000e+00)
%4 = tail call i32 (i32, double, ...) @f1(i32 2, double 3.400000e+00, double 4.500000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void Print_array(int array_of_elements[], int size) {
  int i;
  for (i = 0; i < size; i++)
    printf("%d", array_of_elements[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<Print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <Print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <Print_array+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <Print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <Print_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @Print_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
char *savestr(cp)
char *cp;
{ return savenstr(cp, strlen(cp)); }


x86 assembly (clang, -O0):
<savestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rsi
mov    $0x0,%al
call   1040 <savenstr@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<savestr>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <savenstr@plt>
cltq
pop    %rbx
ret

LLVM IR (-O0):
define i8* @savestr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @savenstr to i32 (i8*, i64, ...)*)(i8* %3, i64 %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @savestr(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = tail call i32 (i8*, i64, ...) bitcast (i32 (...)* @savenstr to i32 (i8*, i64, ...)*)(i8* %0, i64 %2)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
void OSDSoftDeInit(void) {}


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

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

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

LLVM IR (-O2):
define void @OSDSoftDeInit() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ CheckedCommand(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  char *);
void StartAtomic(FILE *p_cmd, FILE *p_res) {
  CheckedCommand(p_cmd, p_res, "StartAtomic\n");
}


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

x86 assembly (clang, -O2):
<StartAtomic>:
lea    0xee9(%rip),%rdx
jmp    1030 <CheckedCommand@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"StartAtomic\0A\00"
define void @StartAtomic(i32* %0, i32* %1) {
%3 = tail call i32 @CheckedCommand(i32* %0, i32* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f1(int *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int *p;
  f1(p);
  printf("set heap\n");
  *p = 4;
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <f1@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [9 x i8] c"set heap\00"
define i32 @main() {
%1 = tail call i32 @f1(i32* undef)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ generalizacao();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ treinamento();
int main() {
  printf("Iniciando treinamento...\n");
  treinamento();
  printf("Treinamento encerrado. Iniciando generalizacao\n");
  generalizacao();
  printf("Processo concluido\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <treinamento@plt>
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <generalizacao@plt>
lea    0xede(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"Iniciando treinamento...\0A\00"
@.str.1 = [48 x i8] c"Treinamento encerrado. Iniciando generalizacao\0A\00"
@.str.2 = [20 x i8] c"Processo concluido\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @treinamento()
%4 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @generalizacao()
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"Iniciando treinamento...\00"
@str.3 = [47 x i8] c"Treinamento encerrado. Iniciando generalizacao\00"
@str.4 = [19 x i8] c"Processo concluido\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @treinamento()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 (...) @generalizacao()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}
int __attribute__((no)) foo(unsigned short *p) {
  int a = (short)*p;
  asm volatile("nop" : : "D"((int)*p));
  asm volatile("nop" : : "D"((int)*p));
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edi
nop
mov    -0x8(%rbp),%rax
movzwl (%rax),%edi
nop
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rax
movzwl (%rdi),%edi
nop
movzwl (%rax),%edi
nop
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @foo(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = load i16, i16* %4
%6 = sext i16 %5 to i32
store i32 %6, i32* %3
%7 = load i16*, i16** %2
%8 = load i16, i16* %7
%9 = zext i16 %8 to i32
%10 = load i16*, i16** %2
%11 = load i16, i16* %10
%12 = zext i16 %11 to i32
ret i32 0
}

LLVM IR (-O2):
define i32 @foo(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = zext i16 %2 to i32
tail call void asm sideeffect "nop", "{di},~{dirflag},~{fpsr},~{flags}"(i32 %3)
%4 = load i16, i16* %0
%5 = zext i16 %4 to i32
tail call void asm sideeffect "nop", "{di},~{dirflag},~{fpsr},~{flags}"(i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int reboot(int);
int /*<<< orphan*/ sync();
void cmd_shutdown(int argc, char *argv[]) {
  sync();
  if (reboot(0x4321fedc) == -1)
    perror("shutdown");
}


x86 assembly (clang, -O0):
<cmd_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <sync@plt>
mov    $0x4321fedc,%edi
call   1050 <reboot@plt>
cmp    $0xffffffff,%eax
jne    1165 <cmd_shutdown+0x35>
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_shutdown>:
push   %rax
xor    %eax,%eax
call   1030 <sync@plt>
mov    $0x4321fedc,%edi
call   1050 <reboot@plt>
cmp    $0xffffffff,%eax
je     1149 <cmd_shutdown+0x19>
pop    %rax
ret
lea    0xeb0(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"shutdown\00"
define void @cmd_shutdown(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @sync()
%6 = call i32 @reboot(i32 1126301404)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"shutdown\00"
define void @cmd_shutdown(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @sync()
%4 = tail call i32 @reboot(i32 1126301404)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
unsigned int readl(int);
int /*<<< orphan*/ wait_ms(int);
int /*<<< orphan*/ writel(unsigned int, int);
void hiusb_stop_hcd(void) {
  unsigned int reg;
  reg = readl((0x12040000 + 0xb8));
  writel(reg | ((1 << 13)), (0x12040000 + 0xb8));
  wait_ms(500);
}


x86 assembly (clang, -O0):
<hiusb_stop_hcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x120400b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
or     $0x2000,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x1f4,%edi
call   1050 <wait_ms@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hiusb_stop_hcd>:
push   %rax
mov    $0x120400b8,%edi
call   1030 <readl@plt>
or     $0x2000,%eax
mov    %eax,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x1f4,%edi
pop    %rax
jmp    1050 <wait_ms@plt>

LLVM IR (-O0):
define void @hiusb_stop_hcd() {
%1 = alloca i32
%2 = call i32 @readl(i32 302252216)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = or i32 %3, 8192
%5 = call i32 @writel(i32 %4, i32 302252216)
%6 = call i32 @wait_ms(i32 500)
ret void
}

LLVM IR (-O2):
define void @hiusb_stop_hcd() {
%1 = tail call i32 @readl(i32 302252216)
%2 = or i32 %1, 8192
%3 = tail call i32 @writel(i32 %2, i32 302252216)
%4 = tail call i32 @wait_ms(i32 500)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void puts2(char *s) {
  while (*s != 0) {
    putchar(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<puts2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <puts2+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <puts2+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @puts2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @putchar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void cpufreq_put_driver(char *ptr) {
  if (!ptr)
    return;
  free(ptr);
}


x86 assembly (clang, -O0):
<cpufreq_put_driver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <cpufreq_put_driver+0x1c>
jmp    1135 <cpufreq_put_driver+0x25>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpufreq_put_driver>:
test   %rdi,%rdi
je     111a <cpufreq_put_driver+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @cpufreq_put_driver(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @free(i8* %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @cpufreq_put_driver(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %1, %3
ret void
}
int VAlign(int x, int n) {
  int over = x % n;
  return over ? (x + n - over) : x;
}


x86 assembly (clang, -O0):
<VAlign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     112f <VAlign+0x2f>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <VAlign+0x35>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<VAlign>:
mov    %edi,%eax
cltd
idiv   %esi
lea    (%rsi,%rdi,1),%eax
sub    %edx,%eax
test   %edx,%edx
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @VAlign(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
%5 = add nsw i32 %1, %0
%6 = sub i32 %5, %3
%7 = select i1 %4, i32 %0, i32 %6
ret i32 %7
}
void type_base_cast_placeholder(void) {}


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

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

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

LLVM IR (-O2):
define void @type_base_cast_placeholder() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *,
                           int);
int /*<<< orphan*/ stderr;
char *strerror(int);
void check_rc(int rc, const char *what) {
  if (rc != 0) {
    fprintf(stderr, "unexpected error from %s: %s (%d)\n", what, strerror(rc),
            rc);
    assert(0);
  }
}


x86 assembly (clang, -O0):
<check_rc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1186 <check_rc+0x56>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
mov    -0x4(%rbp),%r8d
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_rc>:
test   %edi,%edi
je     116d <check_rc+0x3d>
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x2e9c(%rip),%rax
mov    (%rax),%ebp
call   1050 <strerror@plt>
lea    0xeae(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
mov    %ebx,%r8d
call   1040 <fprintf@plt>
xor    %edi,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <assert@plt>
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"unexpected error from %s: %s (%d)\0A\00"
define void @check_rc(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = load i32, i32* %3
%11 = call i8* @strerror(i32 %10)
%12 = load i32, i32* %3
%13 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %11, i32 %12)
%14 = call i32 @assert(i32 0)
br label %15
15: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"unexpected error from %s: %s (%d)\0A\00"
define void @check_rc(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i8* @strerror(i32 %0)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %6, i32 %0)
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void fphandler(int sig) {
  { printf("%s\n", "Floating point exception."); };
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [26 x i8] c"Floating point exception.\00"
define void @fphandler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int egsy_gcm_csr_dataout3_set(unsigned int dev_id,
                              union egsy_gcm_csr_dataout3_u *value) {
  return 1;
}


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

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

LLVM IR (-O0):
%union.egsy_gcm_csr_dataout3_u = type opaque
define i32 @egsy_gcm_csr_dataout3_set(i32 %0, %union.egsy_gcm_csr_dataout3_u* %1) {
%3 = alloca i32
%4 = alloca %union.egsy_gcm_csr_dataout3_u*
store i32 %0, i32* %3
store %union.egsy_gcm_csr_dataout3_u* %1, %union.egsy_gcm_csr_dataout3_u** %4
ret i32 1
}

LLVM IR (-O2):
%union.egsy_gcm_csr_dataout3_u = type opaque
define i32 @egsy_gcm_csr_dataout3_set(i32 %0, %union.egsy_gcm_csr_dataout3_u* nocapture readnone %1) {
ret i32 1
}
void foo$$1(struct _Data$$1 *this$1) { printf("foo\n"); }


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

x86 assembly (clang, -O2):
<foo$$1>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
%"struct._Data$$1" = type opaque
@.str = [5 x i8] c"foo\0A\00"
define void @"foo$$1"(%"struct._Data$$1"* %0) {
%2 = alloca %"struct._Data$$1"*
store %"struct._Data$$1"* %0, %"struct._Data$$1"** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%"struct._Data$$1" = type opaque
@str = [4 x i8] c"foo\00"
define void @"foo$$1"(%"struct._Data$$1"* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
signed short t4(signed short x) { return x++; }


x86 assembly (clang, -O0):
<t4>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,%cx
add    $0x1,%cx
mov    %cx,-0x2(%rbp)
cwtl
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i16 @t4(i16 returned signext %0) {
ret i16 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int pthread_rwlock_destroy(pthread_rwlock_t *lock) {}


x86 assembly (clang, -O0):
<pthread_rwlock_destroy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @pthread_rwlock_destroy(i32* nocapture readnone %0) {
ret i32 undef
}
void wdog1_iomux_config() {}


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

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

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

LLVM IR (-O2):
define void @wdog1_iomux_config() {
ret void
}
void Rotate(int rotatecmd, int rotatespd) {}


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

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

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

LLVM IR (-O2):
define void @Rotate(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int bobMcBob();
int main(int argc, char **argv) { return bobMcBob() != 42; }


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    $0x0,%al
call   1030 <bobMcBob@plt>
cmp    $0x2a,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bobMcBob@plt>
xor    %ecx,%ecx
cmp    $0x2a,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @bobMcBob()
%7 = icmp ne i32 %6, 42
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bobMcBob()
%4 = icmp ne i32 %3, 42
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int strlen(const char *s1) {
  int i = 0;
  while (s1[i] != 0)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ do_pages(int /*<<< orphan*/);
void no_switch_pages(void) { do_pages(0); }


x86 assembly (clang, -O0):
<no_switch_pages>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <do_pages@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @no_switch_pages() {
%1 = call i32 @do_pages(i32 0)
ret void
}

LLVM IR (-O2):
define void @no_switch_pages() {
%1 = tail call i32 @do_pages(i32 0)
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ test_multithreaded(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  srand(time(NULL));
  test_multithreaded("multithreaded");
  return EXIT_SUCCESS;
}


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)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xea3(%rip),%rdi
call   1030 <test_multithreaded@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xeba(%rip),%rdi
call   1030 <test_multithreaded@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"multithreaded\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
%8 = call i32 @test_multithreaded(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}

LLVM IR (-O2):
@.str = [14 x i8] c"multithreaded\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 @test_multithreaded(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
int abs(int x) { return ((x >= 0) ? x : (-x)); }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     111c <abs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @abs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ fh_log_open_facility(int /*<<< orphan*/);
void fh_log_open() { fh_log_open_facility(LOG_USER); }


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

x86 assembly (clang, -O2):
<fh_log_open>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fh_log_open_facility@plt>

LLVM IR (-O0):
@LOG_USER = global i32 0
define void @fh_log_open() {
%1 = load i32, i32* @LOG_USER
%2 = call i32 @fh_log_open_facility(i32 %1)
ret void
}

LLVM IR (-O2):
@LOG_USER = global i32 0
define void @fh_log_open() {
%1 = load i32, i32* @LOG_USER
%2 = tail call i32 @fh_log_open_facility(i32 %1)
ret void
}
void testMath() {
  int c = 32;
  "";
  c = -32;
  "";
}


x86 assembly (clang, -O0):
<testMath>:
push   %rbp
mov    %rsp,%rbp
movl   $0x20,-0x4(%rbp)
movl   $0xffffffe0,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @testMath() {
%1 = alloca i32
store i32 32, i32* %1
store i32 -32, i32* %1
ret void
}

LLVM IR (-O2):
define void @testMath() {
ret void
}
int max_int(int a, int b) {
  if (a >= b) {
    return a;
  }
  return b;
}


x86 assembly (clang, -O0):
<max_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1121 <max_int+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <max_int+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_int>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @max_int(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int fseek(void *, long, int);
long ftell(void *);
long def_seek(long offset, int whence, void *uptr) {
  if (!uptr || fseek(uptr, offset, whence) == -1) {
    return -1;
  }
  return ftell(uptr);
}


x86 assembly (clang, -O0):
<def_seek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1157 <def_seek+0x37>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <fseek@plt>
cmp    $0xffffffff,%eax
jne    1164 <def_seek+0x44>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1171 <def_seek+0x51>
mov    -0x20(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<def_seek>:
push   %rbx
mov    %rdx,%rbx
test   %rdx,%rdx
je     1144 <def_seek+0x24>
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rbx,%rdi
call   1040 <fseek@plt>
cmp    $0xffffffff,%eax
je     1144 <def_seek+0x24>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <ftell@plt>
mov    $0xffffffffffffffff,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @def_seek(i64 %0, i32 %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = tail call i32 @fseek(i8* %2, i64 %0, i32 %1)
%7 = icmp eq i32 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i64 @ftell(i8* %2)
br label %10
10: ; preds = %3, %5, %8
%11 = phi i64 [ %9, %8 ], [ -1, %5 ], [ -1, %3 ]
ret i64 %11
}
/* Variables and functions */
double gammaDev(int);
double beta(int a, int b) { return gammaDev(a) / (gammaDev(a) + gammaDev(b)); }


x86 assembly (clang, -O0):
<beta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <gammaDev@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <gammaDev@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <gammaDev@plt>
movsd  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beta>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <gammaDev@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
call   1030 <gammaDev@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <gammaDev@plt>
addsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @beta(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call double @gammaDev(i32 %5)
%7 = load i32, i32* %3
%8 = call double @gammaDev(i32 %7)
%9 = load i32, i32* %4
%10 = call double @gammaDev(i32 %9)
%11 = fadd double %8, %10
%12 = fdiv double %6, %11
ret double %12
}

LLVM IR (-O2):
define double @beta(i32 %0, i32 %1) {
%3 = tail call double @gammaDev(i32 %0)
%4 = tail call double @gammaDev(i32 %0)
%5 = tail call double @gammaDev(i32 %1)
%6 = fadd double %4, %5
%7 = fdiv double %3, %6
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
int main() {
  unsigned char c;
  for (c = 0; (unsigned)c < 128; c++) {
    printf("%c", c);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x80,%eax
jae    114f <main+0x3f>
lea    0xec7(%rip),%rdi
movzbl -0x5(%rbp),%esi
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1123 <main+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
movzbl %bl,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%bl
cmp    $0x80,%bl
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i8 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %2)
%4 = add nuw i8 %2, 1
%5 = icmp eq i8 %4, -128
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};

/* Variables and functions */
int htons(int /*<<< orphan*/);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int);
void printSource(struct sockaddr_in source) {
  printf("Pacote recebido de %s:%d\n", inet_ntoa(source.sin_addr),
         htons(source.sin_port));
}


x86 assembly (clang, -O0):
<printSource>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <htons@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xea3(%rip),%rdi
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSource>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
shr    $0x20,%rdi
call   1030 <inet_ntoa@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1040 <htons@plt>
lea    0xeaf(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <printf@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
@.str = [26 x i8] c"Pacote recebido de %s:%d\0A\00"
define void @printSource(i64 %0) {
%2 = alloca %struct.sockaddr_in
%3 = bitcast %struct.sockaddr_in* %2 to i64*
store i64 %0, i64* %3
%4 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%5 = load i32, i32* %4
%6 = call i8* @inet_ntoa(i32 %5)
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @htons(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Pacote recebido de %s:%d\0A\00"
define void @printSource(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i64 %0, 32
%4 = trunc i64 %3 to i32
%5 = tail call i8* @inet_ntoa(i32 %4)
%6 = tail call i32 @htons(i32 %2)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ chunk_write_rsvd(unsigned long, int /*<<< orphan*/,
                                    unsigned long, unsigned long,
                                    int /*<<< orphan*/ *);
void chunk_write(unsigned long type, unsigned long items, unsigned long size,
                 FILE *fp) {
  chunk_write_rsvd(type, 0, items, size, fp);
}


x86 assembly (clang, -O0):
<chunk_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
xor    %esi,%esi
call   1030 <chunk_write_rsvd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chunk_write>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <chunk_write_rsvd@plt>

LLVM IR (-O0):
define void @chunk_write(i64 %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i32 @chunk_write_rsvd(i64 %9, i32 0, i64 %10, i64 %11, i32* %12)
ret void
}

LLVM IR (-O2):
define void @chunk_write(i64 %0, i64 %1, i64 %2, i32* %3) {
%5 = tail call i32 @chunk_write_rsvd(i64 %0, i32 0, i64 %1, i64 %2, i32* %3)
ret void
}