xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ RB_AUTOBOOT;
int /*<<< orphan*/ reboot(int /*<<< orphan*/);
int board_flash_reboot_common() {
  reboot(RB_AUTOBOOT);
  return 0;
}


x86 assembly (clang, -O0):
<board_flash_reboot_common>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <reboot@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_flash_reboot_common>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <reboot@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RB_AUTOBOOT = global i32 0
define i32 @board_flash_reboot_common() {
%1 = load i32, i32* @RB_AUTOBOOT
%2 = call i32 @reboot(i32 %1)
ret i32 0
}

LLVM IR (-O2):
@RB_AUTOBOOT = global i32 0
define i32 @board_flash_reboot_common() {
%1 = load i32, i32* @RB_AUTOBOOT
%2 = tail call i32 @reboot(i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ getsid(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(void) {
  (void)getsid((pid_t)0);
  printf("#define HAVE_GETSID /* yes */\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [30 x i8] c"#define HAVE_GETSID /* yes */\00"
define i32 @main() {
%1 = tail call i32 @getsid(i32 0)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n, i;
  n = 1;
  for (i = 1; i <= 10; i++) {
    n = n * i;
  }
  printf("%d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     114f <main+0x3f>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xea7(%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
mov    $0x375f00,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3628800)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int string_begins_with(const char *cmp, const char *str) {
  return strncmp(str, cmp, strlen(cmp)) == 0;
}


x86 assembly (clang, -O0):
<string_begins_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_begins_with>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @string_begins_with(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 = load i8*, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = call i64 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @string_begins_with(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i64 @strncmp(i8* %1, i8* %0, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int ply_type_check(void) {
  assert(sizeof(char) == 1);
  assert(sizeof(unsigned char) == 1);
  assert(sizeof(short) == 2);
  assert(sizeof(unsigned short) == 2);
  assert(sizeof(int) == 4);
  assert(sizeof(unsigned int) == 4);
  assert(sizeof(float) == 4);
  assert(sizeof(double) == 8);
  if (sizeof(char) != 1)
    return 0;
  if (sizeof(unsigned char) != 1)
    return 0;
  if (sizeof(short) != 2)
    return 0;
  if (sizeof(unsigned short) != 2)
    return 0;
  if (sizeof(int) != 4)
    return 0;
  if (sizeof(unsigned int) != 4)
    return 0;
  if (sizeof(float) != 4)
    return 0;
  if (sizeof(double) != 8)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<ply_type_check>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ply_type_check>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ply_type_check() {
%1 = call i32 @assert(i32 1)
%2 = call i32 @assert(i32 1)
%3 = call i32 @assert(i32 1)
%4 = call i32 @assert(i32 1)
%5 = call i32 @assert(i32 1)
%6 = call i32 @assert(i32 1)
%7 = call i32 @assert(i32 1)
%8 = call i32 @assert(i32 1)
ret i32 1
}

LLVM IR (-O2):
define i32 @ply_type_check() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int /*<<< orphan*/);
const char *cJSON_Version(void) {
  static char version[15];
  sprintf(version, "%i.%i.%i", 1, 5, 0);
  return version;
}


x86 assembly (clang, -O0):
<cJSON_Version>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f0e(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x1,%edx
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1030 <sprintf@plt>
lea    0x2eee(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cJSON_Version>:
push   %rbx
lea    0x2f11(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@cJSON_Version.version = internal global [15 x i8] zeroinitializer
@.str = [9 x i8] c"%i.%i.%i\00"
define i8* @cJSON_Version() {
%1 = call i32 @sprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 5, i32 0)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0)
}

LLVM IR (-O2):
@cJSON_Version.version = internal global [15 x i8] zeroinitializer
@.str = [9 x i8] c"%i.%i.%i\00"
define i8* @cJSON_Version() {
%1 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 5, i32 0)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0)
}
void sd_zbc_remove(struct scsi_disk *sdkp) {}


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

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

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

LLVM IR (-O2):
%struct.scsi_disk = type opaque
define void @sd_zbc_remove(%struct.scsi_disk* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ obtener_de_memoria(int, int /*<<< orphan*/, unsigned char *,
                                      unsigned char *);
int BUN(int inst_actual, int dir, int I) {
  unsigned char memoriah, memorial;
  if (I) {
    obtener_de_memoria(dir, 0, &memoriah, &memorial);
    return 256 * ((int)memoriah % 4) + (int)memorial;
  }
  return dir;
}


x86 assembly (clang, -O0):
<BUN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     115c <BUN+0x4c>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
lea    -0x11(%rbp),%rdx
lea    -0x12(%rbp),%rcx
call   1030 <obtener_de_memoria@plt>
movzbl -0x11(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
shl    $0x8,%eax
movzbl -0x12(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <BUN+0x52>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BUN>:
mov    %esi,%eax
test   %edx,%edx
je     1140 <BUN+0x30>
push   %rax
lea    0x7(%rsp),%rdx
lea    0x6(%rsp),%rcx
mov    %eax,%edi
xor    %esi,%esi
call   1030 <obtener_de_memoria@plt>
movzbl 0x7(%rsp),%ecx
and    $0x3,%ecx
shl    $0x8,%ecx
movzbl 0x6(%rsp),%eax
or     %ecx,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @BUN(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = load i32, i32* %7
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %3
%13 = load i32, i32* %6
%14 = call i32 @obtener_de_memoria(i32 %13, i32 0, i8* %8, i8* %9)
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = srem i32 %16, 4
%18 = mul nsw i32 256, %17
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = add nsw i32 %18, %20
store i32 %21, i32* %4
br label %24
22: ; preds = %3
%23 = load i32, i32* %6
store i32 %23, i32* %4
br label %24
24: ; preds = %22, %12
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @BUN(i32 %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = icmp eq i32 %2, 0
br i1 %6, label %16, label %7
7: ; preds = %3
%8 = call i32 @obtener_de_memoria(i32 %1, i32 0, i8* %4, i8* %5)
%9 = load i8, i8* %4
%10 = and i8 %9, 3
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 8
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
br label %16
16: ; preds = %3, %7
%17 = phi i32 [ %15, %7 ], [ %1, %3 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void greet(char aName[]) { printf("Hello %s\n", aName); }


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"Hello %s\0A\00"
define void @greet(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ syscall(int, char *, int /*<<< orphan*/);
int exec() {
  char file[80];
  printf("Enter a filename: ");
  gets(file);
  syscall(8, file, 0);
}


x86 assembly (clang, -O0):
<exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rsi
mov    $0x8,%edi
xor    %edx,%edx
call   1040 <syscall@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec>:
push   %rbx
sub    $0x50,%rsp
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    $0x8,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <syscall@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter a filename: \00"
define i32 @exec() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%7 = call i32 @syscall(i32 8, i8* %6, i32 0)
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter a filename: \00"
define i32 @exec() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @syscall(i32 8, i8* %2, i32 0)
ret i32 undef
}
void *mem_create_buf(unsigned long len) {
  void *tmp = malloc(len + sizeof(unsigned long));
  ((unsigned long *)tmp)[0] = len;
  memset((char *)tmp + sizeof(unsigned long), 0, len);
  return ((char *)tmp + sizeof(unsigned long));
}


x86 assembly (clang, -O0):
<mem_create_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_create_buf>:
push   %rbx
mov    %rdi,%rbx
add    $0x8,%rdi
call   1040 <malloc@plt>
mov    %rbx,(%rax)
lea    0x8(%rax),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define i8* @mem_create_buf(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = add i64 %4, 8
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %3
%7 = load i64, i64* %2
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i64*
%10 = getelementptr inbounds i64, i64* %9, i64 0
store i64 %7, i64* %10
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 8
%13 = load i64, i64* %2
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 8
ret i8* %15
}

LLVM IR (-O2):
define noalias i8* @mem_create_buf(i64 %0) {
%2 = add i64 %0, 8
%3 = tail call i8* @malloc(i64 %2)
%4 = bitcast i8* %3 to i64*
store i64 %0, i64* %4
%5 = getelementptr inbounds i8, i8* %3, i64 8
tail call void @llvm.memset.p0i8.i64(i8* align 1 %5, i8 0, i64 %0, i1 false)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ get_home_dir(char *);
int /*<<< orphan*/ strcat(char *, char *);
void get_downloads_dir(char *dir) {
  get_home_dir(dir);
  strcat(dir, "donwloads/");
}


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

x86 assembly (clang, -O2):
<get_downloads_dir>:
push   %rbx
mov    %rdi,%rbx
call   1030 <get_home_dir@plt>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"donwloads/\00"
define void @get_downloads_dir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @get_home_dir(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"donwloads/\00"
define void @get_downloads_dir(i8* %0) {
%2 = tail call i32 @get_home_dir(i8* %0)
%3 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
void g_rand_new_with_seed_array() {}


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

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

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

LLVM IR (-O2):
define void @g_rand_new_with_seed_array() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  unsigned long size;
  long offset;
  size = 1024;
  offset = 50;
  if ((offset -= size) >= 0) {
    printf("no -- this is wrong\n");
    return 2;
  }
  offset = 50;
  if (offset - size < 0) {
    printf("This is also wrong\n");
    return 3;
  }
  printf("yes this is right\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x400,-0x10(%rbp)
movq   $0x32,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jl     1160 <main+0x50>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    11a5 <main+0x95>
movq   $0x32,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cmp    $0x0,%rax
jae    1192 <main+0x82>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    11a5 <main+0x95>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%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 = [21 x i8] c"no -- this is wrong\0A\00"
@.str.1 = [20 x i8] c"This is also wrong\0A\00"
@.str.2 = [19 x i8] c"yes this is right\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 1024, i64* %2
store i64 50, i64* %3
%4 = load i64, i64* %2
%5 = load i64, i64* %3
%6 = sub i64 %5, %4
store i64 %6, i64* %3
%7 = icmp sge i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %1
br label %19
10: ; preds = %0
store i64 50, i64* %3
%11 = load i64, i64* %3
%12 = load i64, i64* %2
%13 = sub i64 %11, %12
%14 = icmp ult i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i32 3, i32* %1
br label %19
17: ; preds = %10
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %19
19: ; preds = %17, %15, %8
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@str = [18 x i8] c"yes this is right\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv[]) {
  fprintf(stderr, "Usage: %s [<input time>]\n", argv[0]);
  fprintf(stderr, "Example : %s 2:43pm\n", argv[0]);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xebb(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Usage: %s [<input time>]\0A\00"
@.str.1 = [21 x i8] c"Example : %s 2:43pm\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = load i8**, i8*** %2
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Usage: %s [<input time>]\0A\00"
@.str.1 = [21 x i8] c"Example : %s 2:43pm\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %0
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *get_data_from_file(char *, int *);
char *get_data_from_stdin(int *);
char *read_file(char *filename, int *len) {
  if (filename[0] == '-' && filename[1] == '\0') {
    return (get_data_from_stdin(len));
  } else {
    return (get_data_from_file(filename, len));
  }
}


x86 assembly (clang, -O0):
<read_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1163 <read_file+0x43>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1163 <read_file+0x43>
mov    -0x18(%rbp),%rdi
call   1040 <get_data_from_stdin@plt>
mov    %rax,-0x8(%rbp)
jmp    1174 <read_file+0x54>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_data_from_file@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_file>:
cmpb   $0x2d,(%rdi)
jne    112b <read_file+0xb>
cmpb   $0x0,0x1(%rdi)
je     1130 <read_file+0x10>
jmp    1030 <get_data_from_file@plt>
mov    %rsi,%rdi
jmp    1040 <get_data_from_stdin@plt>

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

LLVM IR (-O2):
define i8* @read_file(i8* %0, i32* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 45
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i8* @get_data_from_stdin(i32* %1)
br label %13
11: ; preds = %5, %2
%12 = tail call i8* @get_data_from_file(i8* %0, i32* %1)
br label %13
13: ; preds = %11, %9
%14 = phi i8* [ %10, %9 ], [ %12, %11 ]
ret i8* %14
}
char *test_mySub_normal(const char **_ja_name) {
  do {
    *_ja_name = __func__;
    if (!(mySub(4, 6) == -2))
      return "4 - 6 == -2";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_mySub_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
mov    %rcx,(%rax)
mov    $0x4,%edi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <mySub@plt>
cmp    $0xfffffffe,%eax
je     1154 <test_mySub_normal+0x44>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1161 <test_mySub_normal+0x51>
jmp    1159 <test_mySub_normal+0x49>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mySub_normal>:
push   %rbx
lea    0xee8(%rip),%rax
mov    %rax,(%rdi)
xor    %ebx,%ebx
mov    $0x4,%edi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <mySub@plt>
cmp    $0xfffffffe,%eax
lea    0xeda(%rip),%rax
cmovne %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@__func__.test_mySub_normal = [18 x i8] c"test_mySub_normal\00"
@.str = [12 x i8] c"4 - 6 == -2\00"
define i8* @test_mySub_normal(i8** nocapture writeonly %0) {
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.test_mySub_normal, i64 0, i64 0), i8** %0
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @mySub to i32 (i32, i32, ...)*)(i32 4, i32 6)
%3 = icmp eq i32 %2, -2
%4 = select i1 %3, i8* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ FillWorker(unsigned long, unsigned long, char, char);
char GetPixel(unsigned long, unsigned long);
void Fill(unsigned long x, unsigned long y, char color) {
  char oldColor = GetPixel(x, y);
  if (oldColor != color) {
    FillWorker(x, y, color, oldColor);
  }
}


x86 assembly (clang, -O0):
<Fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <GetPixel@plt>
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     116c <Fill+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x11(%rbp),%al
movsbl %al,%edx
movsbl -0x12(%rbp),%ecx
call   1030 <FillWorker@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fill>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <GetPixel@plt>
cmp    %bpl,%al
jne    113b <Fill+0x1b>
pop    %rbx
pop    %r14
pop    %rbp
ret
movsbl %bpl,%edx
movsbl %al,%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <FillWorker@plt>

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

LLVM IR (-O2):
define void @Fill(i64 %0, i64 %1, i8 signext %2) {
%4 = tail call signext i8 @GetPixel(i64 %0, i64 %1)
%5 = icmp eq i8 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @FillWorker(i64 %0, i64 %1, i8 signext %2, i8 signext %4)
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ end_ramp();
int /*<<< orphan*/ rp_Release();
void close_RP() {
  end_ramp();
  rp_Release();
}


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

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

LLVM IR (-O0):
define void @close_RP() {
%1 = call i32 (...) @end_ramp()
%2 = call i32 (...) @rp_Release()
ret void
}

LLVM IR (-O2):
define void @close_RP() {
%1 = tail call i32 (...) @end_ramp()
%2 = tail call i32 (...) @rp_Release()
ret void
}
void loopforever(char *a) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<loopforever>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
jmp    1108 <loopforever+0x8>

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

LLVM IR (-O0):
define void @loopforever(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define void @loopforever(i8* nocapture %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(void *, char *, char const *);
void handle_error(void *opaque, const char *msg) {
  fprintf(opaque, "%s\n", msg);
}


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

x86 assembly (clang, -O2):
<handle_error>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @handle_error(i8* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
char *getenv(char *);
char *get_codeset(void) {
  char *s = getenv("LC_CTYPE");
  if (!s)
    s = getenv("LC_ALL");
  if (!s)
    s = "ANSI_X3.4-1968";
  return s;
}


x86 assembly (clang, -O0):
<get_codeset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <get_codeset+0x33>
lea    0xecf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1159 <get_codeset+0x49>
lea    0xebb(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_codeset>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
jne    112e <get_codeset+0x1e>
lea    0xee0(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xed8(%rip),%rcx
cmovne %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"LC_CTYPE\00"
@.str.1 = [7 x i8] c"LC_ALL\00"
@.str.2 = [15 x i8] c"ANSI_X3.4-1968\00"
define i8* @get_codeset() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i8* %6, i8** %1
br label %7
7: ; preds = %5, %0
%8 = load i8*, i8** %1
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %7
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %11
11: ; preds = %10, %7
%12 = load i8*, i8** %1
ret i8* %12
}

LLVM IR (-O2):
@.str = [9 x i8] c"LC_CTYPE\00"
@.str.1 = [7 x i8] c"LC_ALL\00"
@.str.2 = [15 x i8] c"ANSI_X3.4-1968\00"
define i8* @get_codeset() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 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 i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i8* [ %1, %0 ], [ %4, %3 ]
%7 = icmp eq i8* %6, null
%8 = select i1 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %6
ret i8* %8
}
int main() {
  unsigned long a = 7;
  unsigned long b = 3;
  return a / b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x7,-0x10(%rbp)
movq   $0x3,-0x18(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 7, i64* %2
store i64 3, i64* %3
%4 = load i64, i64* %2
%5 = load i64, i64* %3
%6 = udiv i64 %4, %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Variables and functions */
int CHAR_BIT;
int /*<<< orphan*/ printf(char *, int, unsigned int);
void absolute_value(int val) {
  int const mask = val >> (sizeof(int) * CHAR_BIT - 1);
  unsigned int result = (val + mask) ^ mask;
  printf("absolute (abs) value of %d is %u\n", val, result);
}


x86 assembly (clang, -O0):
<absolute_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ebb(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
sar    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<absolute_value>:
mov    %edi,%esi
mov    0x2ec7(%rip),%rax
mov    (%rax),%cl
shl    $0x2,%cl
add    $0xff,%cl
mov    %edi,%eax
sar    %cl,%eax
lea    (%rax,%rsi,1),%edx
xor    %eax,%edx
lea    0xecf(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@CHAR_BIT = global i32 0
@.str = [34 x i8] c"absolute (abs) value of %d is %u\0A\00"
define void @absolute_value(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @CHAR_BIT
%7 = sext i32 %6 to i64
%8 = mul i64 4, %7
%9 = sub i64 %8, 1
%10 = trunc i64 %9 to i32
%11 = ashr i32 %5, %10
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
%15 = load i32, i32* %3
%16 = xor i32 %14, %15
store i32 %16, i32* %4
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
ret void
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
@.str = [34 x i8] c"absolute (abs) value of %d is %u\0A\00"
define void @absolute_value(i32 %0) {
%2 = load i32, i32* @CHAR_BIT
%3 = shl i32 %2, 2
%4 = add i32 %3, -1
%5 = ashr i32 %0, %4
%6 = add nsw i32 %5, %0
%7 = xor i32 %6, %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %7)
ret void
}
void host() {}


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

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

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

LLVM IR (-O2):
define void @host() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glutSolidCube(double);
void drawSCube(void) {
  glColor3f(0.5, 1.0, 0.5);
  glutSolidCube(7.0);
}


x86 assembly (clang, -O0):
<drawSCube>:
push   %rbp
mov    %rsp,%rbp
movsd  0xedc(%rip),%xmm2
movsd  0xedc(%rip),%xmm1
movaps %xmm2,%xmm0
call   1040 <glColor3f@plt>
movsd  0xebc(%rip),%xmm0
call   1030 <glutSolidCube@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawSCube>:
push   %rax
movsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm0
movaps %xmm0,%xmm2
call   1040 <glColor3f@plt>
movsd  0xecf(%rip),%xmm0
pop    %rax
jmp    1030 <glutSolidCube@plt>

LLVM IR (-O0):
define void @drawSCube() {
%1 = call i32 @glColor3f(double 5.000000e-01, double 1.000000e+00, double 5.000000e-01)
%2 = call i32 @glutSolidCube(double 7.000000e+00)
ret void
}

LLVM IR (-O2):
define void @drawSCube() {
%1 = tail call i32 @glColor3f(double 5.000000e-01, double 1.000000e+00, double 5.000000e-01)
%2 = tail call i32 @glutSolidCube(double 7.000000e+00)
ret void
}
IR0AR1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if ((*p0) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<IR0AR1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    0x10f444(%rcx),%eax
jg     113a <IR0AR1+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1141 <IR0AR1+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0AR1>:
mov    (%r8),%ecx
xor    %eax,%eax
cmp    0x10f444(%r9),%ecx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @IR0AR1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture %5) {
%7 = load i32, i32* %4
%8 = getelementptr inbounds i32, i32* %5, i64 277777
%9 = load i32, i32* %8
%10 = icmp sle i32 %7, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
int compute_axpy_dimension(int maxmem, int datasize) {
  return (maxmem / (2.0 * datasize));
}


x86 assembly (clang, -O0):
<compute_axpy_dimension>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm2
movsd  0xee4(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_axpy_dimension>:
cvtsi2sd %edi,%xmm0
cvtsi2sd %esi,%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @compute_axpy_dimension(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 = sitofp i32 %5 to double
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = fmul double 2.000000e+00, %8
%10 = fdiv double %6, %9
%11 = fptosi double %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @compute_axpy_dimension(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = sitofp i32 %1 to double
%5 = fmul double %4, 2.000000e+00
%6 = fdiv double %3, %5
%7 = fptosi double %6 to i32
ret i32 %7
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int type;
};
struct TYPE_4__ {
  TYPE_1__ xgraphicsexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xgraphicsexpose_type(void *_p, int _v) {
  ((XEvent *)_p)->xgraphicsexpose.type = (int)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xgraphicsexpose_type(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xgraphicsexpose_type(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Type definitions */
struct group {
  int gr_gid;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
struct group *getgrnam(char *);
int /*<<< orphan*/ perror(char *);
int getgroupid(char *string) {
  struct group *grp;
  short int lp;
  if (NULL == (grp = getgrnam(string))) {
    perror("getgrnam() error.");
    exit(1);
  }
  return grp->gr_gid;
}


x86 assembly (clang, -O0):
<getgroupid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getgrnam@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    116d <getgroupid+0x3d>
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getgroupid>:
push   %rax
call   1030 <getgrnam@plt>
test   %rax,%rax
je     113f <getgroupid+0xf>
mov    (%rax),%eax
pop    %rcx
ret
lea    0xeba(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.group = type { i32 }
@.str = [18 x i8] c"getgrnam() error.\00"
define i32 @getgroupid(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.group*
%4 = alloca i16
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call %struct.group* @getgrnam(i8* %5)
store %struct.group* %6, %struct.group** %3
%7 = icmp eq %struct.group* null, %6
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load %struct.group*, %struct.group** %3
%13 = getelementptr inbounds %struct.group, %struct.group* %12, i32 0, i32 0
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
%struct.group = type { i32 }
@.str = [18 x i8] c"getgrnam() error.\00"
define i32 @getgroupid(i8* %0) {
%2 = tail call %struct.group* @getgrnam(i8* %0)
%3 = icmp eq %struct.group* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = getelementptr inbounds %struct.group, %struct.group* %2, i64 0, i32 0
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ int80(int, void *, int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
void free(void *p) { int80(2, p, 0, 0, 0, 0); }


x86 assembly (clang, -O0):
<free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x2,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <int80@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free>:
mov    %rdi,%rsi
mov    $0x2,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <int80@plt>

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

LLVM IR (-O2):
define void @free(i8* %0) {
%2 = tail call i32 @int80(i32 2, i8* %0, i32 0, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outbyte(char);
void outplus() { outbyte('+'); }


x86 assembly (clang, -O0):
<outplus>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2b,%edi
call   1030 <outbyte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<outplus>:
mov    $0x2b,%edi
jmp    1030 <outbyte@plt>

LLVM IR (-O0):
define void @outplus() {
%1 = call i32 @outbyte(i8 signext 43)
ret void
}

LLVM IR (-O2):
define void @outplus() {
%1 = tail call i32 @outbyte(i8 signext 43)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
int json_persist_str(char *buf, const char *str) {
  int len;
  len = strlen(str) + 1;
  memcpy(buf, str, len);
  return len;
}


x86 assembly (clang, -O0):
<json_persist_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_persist_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
add    $0x1,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @json_persist_str(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = call i32 @memcpy(i8* %9, i8* %10, i32 %11)
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @json_persist_str(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = add nsw i32 %3, 1
%5 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %4)
ret i32 %4
}