xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ BUFSIZ;
int /*<<< orphan*/ _IOFBF;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
void setbuf(FILE *stream, char *buf) {
  if (buf == NULL)
    setvbuf(stream, NULL, _IONBF, 0);
  else
    setvbuf(stream, buf, _IOFBF, BUFSIZ);
}


x86 assembly (clang, -O0):
<setbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <setbuf+0x38>
mov    -0x8(%rbp),%rdi
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1030 <setvbuf@plt>
jmp    1167 <setbuf+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
mov    0x2e78(%rip),%rax
mov    (%rax),%ecx
call   1030 <setvbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbuf>:
test   %rsi,%rsi
je     112c <setbuf+0x1c>
mov    0x2eb4(%rip),%rax
mov    (%rax),%edx
mov    0x2eb3(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <setvbuf@plt>
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
jmp    1030 <setvbuf@plt>

LLVM IR (-O0):
@_IONBF = global i32 0
@_IOFBF = global i32 0
@BUFSIZ = global i32 0
define void @setbuf(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = load i32, i32* @_IONBF
%10 = call i32 @setvbuf(i32* %8, i8* null, i32 %9, i32 0)
br label %17
11: ; preds = %2
%12 = load i32*, i32** %3
%13 = load i8*, i8** %4
%14 = load i32, i32* @_IOFBF
%15 = load i32, i32* @BUFSIZ
%16 = call i32 @setvbuf(i32* %12, i8* %13, i32 %14, i32 %15)
br label %17
17: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
@_IONBF = global i32 0
@_IOFBF = global i32 0
@BUFSIZ = global i32 0
define void @setbuf(i32* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @_IONBF
%6 = tail call i32 @setvbuf(i32* %0, i8* null, i32 %5, i32 0)
br label %11
7: ; preds = %2
%8 = load i32, i32* @_IOFBF
%9 = load i32, i32* @BUFSIZ
%10 = tail call i32 @setvbuf(i32* %0, i8* %1, i32 %8, i32 %9)
br label %11
11: ; preds = %7, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
char *strdup(char *);
char *leak2(void) {
  char *ptr = strdup("Hey Hey Hey!\n");
  if (!ptr) {
    printf("Oops, strdup fail!\n");
    return 0;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<leak2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <leak2+0x3c>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1164 <leak2+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leak2>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <leak2+0x21>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hey Hey Hey!\0A\00"
@str = [19 x i8] c"Oops, strdup fail!\00"
define noalias i8* @leak2() {
%1 = tail call dereferenceable_or_null(14) i8* @strdup(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
ret i8* %1
}
/* Variables and functions */
int japi_getparentid(int);
int j_getparentid(int arg0) { return (japi_getparentid(arg0)); }


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

x86 assembly (clang, -O2):
<j_getparentid>:
jmp    1030 <japi_getparentid@plt>

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

LLVM IR (-O2):
define i32 @j_getparentid(i32 %0) {
%2 = tail call i32 @japi_getparentid(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
void __i64_cpy(void *a, void *b) { *(int64_t *)a = *(int64_t *)b; }


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

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

LLVM IR (-O0):
define void @__i64_cpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
store i32 %7, i32* %9
ret void
}

LLVM IR (-O2):
define void @__i64_cpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret void
}
void isr_mem_manage(void) {
  while (1) {
    asm("nop");
  }
}


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

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

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

LLVM IR (-O2):
define void @isr_mem_manage() {
br label %1
1: ; preds = %0, %1
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, struct iovec const *, int, long, long);
ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt,
                   int64_t offset) {
  return syscall(295, fd, iov, iovcnt, (long)offset, (long)(offset >> 32));
}


x86 assembly (clang, -O0):
<uv__preadv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movslq -0x18(%rbp),%r8
mov    -0x18(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    -0x1c(%rbp),%ecx
movslq %eax,%r9
mov    $0x127,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uv__preadv>:
mov    %edx,%eax
mov    %rsi,%rdx
mov    %edi,%esi
movslq %ecx,%r8
mov    $0x127,%edi
mov    %eax,%ecx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.iovec = type { i32 }
define i32 @uv__preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.iovec*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store %struct.iovec* %1, %struct.iovec** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load %struct.iovec*, %struct.iovec** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = load i32, i32* %8
%15 = ashr i32 %14, 32
%16 = sext i32 %15 to i64
%17 = call i32 @syscall(i32 295, i32 %9, %struct.iovec* %10, i32 %11, i64 %13, i64 %16)
ret i32 %17
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
define i32 @uv__preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = sext i32 %3 to i64
%6 = tail call i32 @syscall(i32 295, i32 %0, %struct.iovec* %1, i32 %2, i64 %5, i64 poison)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
main() {
  FILE *fp;
  fp = fopen("/tmp/test.txt", "w+");
  fprintf(fp, "This is testing for fprintf ...\n");
  fputs("this is testing for fputs ...\n", fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xecf(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xec3(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
lea    0xecb(%rip),%rdi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/tmp/test.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [33 x i8] c"This is testing for fprintf ...\0A\00"
@.str.3 = [31 x i8] c"this is testing for fputs ...\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32*, i32** %1
%6 = call i32 @fputs(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%7 = load i32*, i32** %1
%8 = call i32 @fclose(i32* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/tmp/test.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [33 x i8] c"This is testing for fprintf ...\0A\00"
@.str.3 = [31 x i8] c"this is testing for fputs ...\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i64 32, i64 1, i32* %1)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 30, i64 1, i32* %1)
%4 = tail call i32 @fclose(i32* %1)
ret i32 0
}
int __test() { return 4; }


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

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

LLVM IR (-O0):
define i32 @__test() {
ret i32 4
}

LLVM IR (-O2):
define i32 @__test() {
ret i32 4
}
int px_date_year(char *cp) {
  int year, i;
  for (year = 0, i = 0; i < 4; i++)
    year = year * 10 + (cp[i] - '0');
  return year;
}


x86 assembly (clang, -O0):
<px_date_year>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1146 <px_date_year+0x46>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <px_date_year+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<px_date_year>:
movsbl (%rdi),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x1(%rdi),%ecx
lea    (%rcx,%rax,2),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x2(%rdi),%ecx
lea    (%rcx,%rax,2),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x3(%rdi),%ecx
lea    (%rcx,%rax,2),%eax
add    $0xffff2fb0,%eax
ret

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

LLVM IR (-O2):
define i32 @px_date_year(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = mul nsw i32 %3, 10
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = add nsw i32 %4, -528
%9 = add nsw i32 %8, %7
%10 = mul nsw i32 %9, 10
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = add nsw i32 %10, -48
%15 = add nsw i32 %14, %13
%16 = mul nsw i32 %15, 10
%17 = getelementptr inbounds i8, i8* %0, i64 3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = add nsw i32 %16, -48
%21 = add nsw i32 %20, %19
ret i32 %21
}
void subroutine2SUBROUTINE_ALL() {}


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

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

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

LLVM IR (-O2):
define void @subroutine2SUBROUTINE_ALL() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  ptr = realloc(ptr, size);
  if (ptr == NULL)
    abort();
  return ptr;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <xrealloc+0x33>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     112d <xrealloc+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xrealloc(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 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %2
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i8* %3
}
int tfa98xx_bottom_i2c_remove(struct i2c_client *client) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.i2c_client = type opaque
define i32 @tfa98xx_bottom_i2c_remove(%struct.i2c_client* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct zsock_addrinfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ zsock_freeaddrinfo(struct zsock_addrinfo *);
void freeaddrinfo(struct zsock_addrinfo *ai) { zsock_freeaddrinfo(ai); }


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

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

LLVM IR (-O0):
%struct.zsock_addrinfo = type { i32 }
define void @freeaddrinfo(%struct.zsock_addrinfo* %0) {
%2 = alloca %struct.zsock_addrinfo*
store %struct.zsock_addrinfo* %0, %struct.zsock_addrinfo** %2
%3 = load %struct.zsock_addrinfo*, %struct.zsock_addrinfo** %2
%4 = call i32 @zsock_freeaddrinfo(%struct.zsock_addrinfo* %3)
ret void
}

LLVM IR (-O2):
%struct.zsock_addrinfo = type { i32 }
define void @freeaddrinfo(%struct.zsock_addrinfo* %0) {
%2 = tail call i32 @zsock_freeaddrinfo(%struct.zsock_addrinfo* %0)
ret void
}
int test5(int x) {
  int a[x];
  test5(x);
  goto L;
L:
  goto L;
  return sizeof a;
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <test5@plt>
jmp    1131 <test5+0x21>

x86 assembly (clang, -O2):
<test5>:
push   %rax
call   1030 <test5@plt>

LLVM IR (-O0):
define i32 @test5(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %3
%8 = alloca i32, i64 %6
store i64 %6, i64* %4
%9 = load i32, i32* %2
%10 = call i32 @test5(i32 %9)
br label %11
11: ; preds = %11, %1
br label %11
}

LLVM IR (-O2):
define i32 @test5(i32 %0) {
%2 = tail call i32 @test5(i32 %0)
unreachable
}
int reverse(int number) {
  int temp = number, reverse;
  while (temp != 0) {
    reverse = (reverse * 10) + (temp % 10);
    temp /= 10;
  }
  return reverse;
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1144 <reverse+0x44>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    110d <reverse+0xd>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
test   %edi,%edi
je     113f <reverse+0x3f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rax,%rax,4),%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
lea    (%rsi,%rax,2),%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <reverse+0x10>
ret

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

LLVM IR (-O2):
define i32 @reverse(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ undef, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = srem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = sdiv i32 %5, 10
%10 = add i32 %5, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ undef, %1 ], [ %8, %3 ]
ret i32 %13
}
/* Variables and functions */
scalar_t__ floor(float);
__attribute__((const)) int ifloorf(float x) { return (int)floor(x); }


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

x86 assembly (clang, -O2):
<ifloorf>:
jmp    1030 <floor@plt>

LLVM IR (-O0):
define i32 @ifloorf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @floor(float %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @ifloorf(float %0) {
%2 = tail call i64 @floor(float %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
char *skip_whitespace(char *);
char *find_args(char *s) {
  char *args = s;
  while (*args && *args != ' ') {
    ++args;
  }
  return skip_whitespace(args);
}


x86 assembly (clang, -O0):
<find_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1149 <find_args+0x39>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1159 <find_args+0x49>
jmp    116a <find_args+0x5a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <find_args+0x14>
mov    -0x10(%rbp),%rdi
call   1030 <skip_whitespace@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_args>:
testb  $0xdf,(%rdi)
je     1129 <find_args+0x19>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rdi
testb  $0xdf,(%rdi)
jne    1120 <find_args+0x10>
jmp    1030 <skip_whitespace@plt>

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

LLVM IR (-O2):
define i8* @find_args(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 32, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
%8 = tail call i8* @skip_whitespace(i8* %3)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Under construction\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [19 x i8] c"Under construction\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int isPrime(int n) {
  for (int i = 1; i < n; i++) {
    if (n % i == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1149 <isPrime+0x49>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <isPrime+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1150 <isPrime+0x50>
jmp    113b <isPrime+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <isPrime+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
xor    %eax,%eax
cmp    $0x2,%edi
setge  %al
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
void *u_calloc(nelem, elsize)
int nelem, elsize;
{
  if (nelem == 0 || elsize == 0)
    return (0);
  if (nelem < 0 || elsize < 0)
    u_crash("u_calloc: bad size");
  return (calloc(nelem, elsize));
}


x86 assembly (clang, -O0):
<u_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1142 <u_calloc+0x22>
cmpl   $0x0,-0x10(%rbp)
jne    114f <u_calloc+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    1182 <u_calloc+0x62>
cmpl   $0x0,-0xc(%rbp)
jl     1163 <u_calloc+0x43>
cmpl   $0x0,-0x10(%rbp)
jge    1171 <u_calloc+0x51>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <u_crash@plt>
movslq -0xc(%rbp),%rdi
movslq -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_calloc>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     1154 <u_calloc+0x34>
mov    %esi,%ebx
test   %esi,%esi
je     1154 <u_calloc+0x34>
mov    %edi,%ebp
mov    %ebx,%eax
or     %edi,%eax
jns    1143 <u_calloc+0x23>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <u_crash@plt>
movslq %ebp,%rdi
movslq %ebx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <calloc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"u_calloc: bad size\00"
define i8* @u_calloc(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i8* null, i8** %3
br label %26
12: ; preds = %8
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15, %12
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @u_crash to i32 (i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = call i8* @calloc(i64 %22, i64 %24)
store i8* %25, i8** %3
br label %26
26: ; preds = %20, %11
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
@.str = [19 x i8] c"u_calloc: bad size\00"
define i8* @u_calloc(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = or i32 %1, %0
%8 = icmp sgt i32 %7, -1
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @u_crash to i32 (i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %6, %9
%12 = sext i32 %0 to i64
%13 = sext i32 %1 to i64
%14 = tail call i8* @calloc(i64 %12, i64 %13)
br label %15
15: ; preds = %2, %11
%16 = phi i8* [ %14, %11 ], [ null, %2 ]
ret i8* %16
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("\nLab 1 \n\n");
  printf("Hello World\n");
  printf("Hi, Marc Woodyard \n\n");
  printf("\"Everything around you that you call life was made up by people "
         "that were no smarter than you.\" -Steve Jobs\n\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0ALab 1 \0A\0A\00"
@.str.1 = [13 x i8] c"Hello World\0A\00"
@.str.2 = [21 x i8] c"Hi, Marc Woodyard \0A\0A\00"
@.str.3 = [110 x i8] c"\22Everything around you that you call life was made up by people that were no smarter than you.\22 -Steve Jobs\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.3, i64 0, i64 0))
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [9 x i8] c"\0ALab 1 \0A\00"
@str.4 = [12 x i8] c"Hello World\00"
@str.5 = [20 x i8] c"Hi, Marc Woodyard \0A\00"
@str.6 = [109 x i8] c"\22Everything around you that you call life was made up by people that were no smarter than you.\22 -Steve Jobs\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([109 x i8], [109 x i8]* @str.6, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
void foo9() {}


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

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

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

LLVM IR (-O2):
define void @foo9() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TEST02called_from_c(void *);
void call_c(void *Current) { TEST02called_from_c(Current); }


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

x86 assembly (clang, -O2):
<call_c>:
jmp    1030 <TEST02called_from_c@plt>

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

LLVM IR (-O2):
define void @call_c(i8* %0) {
%2 = tail call i32 @TEST02called_from_c(i8* %0)
ret void
}
void __ompc_end_serialized_parallel(int vthread_id) {}


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

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

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

LLVM IR (-O2):
define void @__ompc_end_serialized_parallel(i32 %0) {
ret void
}
int abs_value(int value) {
  if (value < 0) {
    value = -value;
  }
  return value;
}


x86 assembly (clang, -O0):
<abs_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1119 <abs_value+0x19>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs_value(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
char *strcat(char *str1, const char *str2) {
  strcpy(str1 + strlen(str1), str2);
  return str1;
}


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

x86 assembly (clang, -O2):
<strcat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8*, i8** %4
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @strcpy(i8* %5, i8* %1)
ret i8* %0
}
/* Variables and functions */
int strcasecmp(char *, char *);
int p_strcmp(const void *_x, const void *_y) {
  char *x = (char *)_x;
  char *y = (char *)_y;
  return strcasecmp(x, y);
}


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

x86 assembly (clang, -O2):
<p_strcmp>:
jmp    1030 <strcasecmp@plt>

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

LLVM IR (-O2):
define i32 @p_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcasecmp(i8* %0, i8* %1)
ret i32 %3
}
int do_403() { return 403; }


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

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

LLVM IR (-O0):
define i32 @do_403() {
ret i32 403
}

LLVM IR (-O2):
define i32 @do_403() {
ret i32 403
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rec_1(int);
int /*<<< orphan*/ rec_2(int);
int main() {
  printf("Forma recursiva 1:\n");
  rec_1(5);
  printf("Forma recursiva 2:\n");
  rec_2(5);
  printf("\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    $0x5,%edi
call   1030 <rec_1@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1050 <rec_2@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%edi
call   1050 <rec_1@plt>
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%edi
call   1060 <rec_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [19 x i8] c"Forma recursiva 1:\00"
@str.3 = [19 x i8] c"Forma recursiva 2:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @rec_1(i32 5)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @rec_2(i32 5)
%5 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ quickSortRec(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ show_tab(int *, int);
void quickSort(int *tab, int size) {
  quickSortRec(tab, 0, size);
  show_tab(tab, size);
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <quickSortRec@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <show_tab@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <quickSortRec@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <show_tab@plt>

LLVM IR (-O0):
define void @quickSort(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 @quickSortRec(i32* %5, i32 0, i32 %6)
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = call i32 @show_tab(i32* %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @quickSort(i32* %0, i32 %1) {
%3 = tail call i32 @quickSortRec(i32* %0, i32 0, i32 %1)
%4 = tail call i32 @show_tab(i32* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void my_quit_handler(int i) {
  printf("\nAh Ah Ah, you didn't say the magic word\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<my_quit_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_quit_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"\0AAh Ah Ah, you didn't say the magic word\0A\00"
@stdout = global i32 0
define void @my_quit_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [41 x i8] c"\0AAh Ah Ah, you didn't say the magic word\00"
define void @my_quit_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
void start_vet(char vet[], int size) {
  int i;
  for (i = 0; i < size; ++i)
    vet[i] = ' ';
}


x86 assembly (clang, -O0):
<start_vet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <start_vet+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <start_vet+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_vet>:
test   %esi,%esi
jle    1125 <start_vet+0x15>
push   %rax
mov    %esi,%edx
mov    $0x20,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @start_vet(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
long long complementBit_fun_llong(long long x, unsigned i) {
  return x ^ 1 << i;
}


x86 assembly (clang, -O0):
<complementBit_fun_llong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
xor    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<complementBit_fun_llong>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
xor    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @complementBit_fun_llong(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = sext i32 %7 to i64
%9 = xor i64 %5, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @complementBit_fun_llong(i64 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = sext i32 %3 to i64
%5 = xor i64 %4, %0
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ prg16setBank0(int /*<<< orphan*/);
int /*<<< orphan*/ prg16setBank1(int /*<<< orphan*/);
void m200SetPrgROMBank(uint32_t bank) {
  prg16setBank0(bank);
  prg16setBank1(bank);
}


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

x86 assembly (clang, -O2):
push   %rbx
mov    %edi,%ebx
call   1030 <prg16setBank0@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <prg16setBank1@plt>

LLVM IR (-O0):
define void @m200SetPrgROMBank(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @prg16setBank0(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @prg16setBank1(i32 %5)
ret void
}

LLVM IR (-O2):
define void @m200SetPrgROMBank(i32 %0) {
%2 = tail call i32 @prg16setBank0(i32 %0)
%3 = tail call i32 @prg16setBank1(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *version();
main() { printf("\nLIBSQL version info: %s\n", version()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <version@plt>
mov    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <version@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0ALIBSQL version info: %s\0A\00"
define i32 @main() {
%1 = call i8* (...) @version()
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"\0ALIBSQL version info: %s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @version()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PTRACE_SINGLESTEP;
int do_wait(char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ ptrace(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *);
int singlestep(pid_t pid) {
  if (ptrace(PTRACE_SINGLESTEP, pid, NULL, NULL)) {
    perror("PTRACE_SINGLESTEP");
    return -1;
  }
  return do_wait("PTRACE_SINGLESTEP");
}


x86 assembly (clang, -O0):
<singlestep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1040 <ptrace@plt>
cmp    $0x0,%rax
je     1175 <singlestep+0x45>
lea    0xe9c(%rip),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1184 <singlestep+0x54>
lea    0xe84(%rip),%rdi
call   1030 <do_wait@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singlestep>:
push   %rax
mov    %edi,%esi
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <ptrace@plt>
lea    0xeb4(%rip),%rdi
test   %rax,%rax
jne    1157 <singlestep+0x27>
pop    %rax
jmp    1030 <do_wait@plt>
call   1050 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@PTRACE_SINGLESTEP = global i32 0
@.str = [18 x i8] c"PTRACE_SINGLESTEP\00"
define i32 @singlestep(i32 %0) {
%2 = load i32, i32* @PTRACE_SINGLESTEP
%3 = tail call i64 @ptrace(i32 %2, i32 %0, i32* null, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = tail call i32 @do_wait(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ -1, %5 ], [ %8, %7 ]
ret i32 %10
}