xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
struct flock {
  int dummy;
};

/* Variables and functions */
scalar_t__ EINVAL;
scalar_t__ errno;
int /*<<< orphan*/ printf(char *);
int fcntl_test(int fd, int cmd, ...) {
  int ret, save_errno;
  va_list ap;
  int arg;
  struct flock *flp = NULL;
  switch (cmd) {
  default:
    printf("\tFailed Phase 1: Unknown fcntl command, "
           "returning failure with EINVAL\n");
    errno = EINVAL;
    return -1;
  }
  errno = 0;
  return -1;
}


x86 assembly (clang, -O0):
<fcntl_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rcx
mov    0x2e9d(%rip),%rax
mov    %rcx,(%rax)
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcntl_test>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eb4(%rip),%rax
mov    (%rax),%rax
mov    0x2eb2(%rip),%rcx
mov    %rax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.flock = type { i32 }
@.str = [71 x i8] c"\09Failed Phase 1: Unknown fcntl command, returning failure with EINVAL\0A\00"
@EINVAL = global i64 0
@errno = global i64 0
define i32 @fcntl_test(i32 %0, i32 %1, ...) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.flock*
store i32 %0, i32* %3
store i32 %1, i32* %4
store %struct.flock* null, %struct.flock** %9
%10 = load i32, i32* %4
switch i32 %10, label %11 [
]
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%13 = load i64, i64* @EINVAL
store i64 %13, i64* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.flock = type { i32 }
@EINVAL = global i64 0
@errno = global i64 0
@str = [70 x i8] c"\09Failed Phase 1: Unknown fcntl command, returning failure with EINVAL\00"
define i32 @fcntl_test(i32 %0, i32 %1, ...) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%4 = load i64, i64* @EINVAL
store i64 %4, i64* @errno
ret i32 -1
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int time;
  if (argc > 1) {
    time = atoi(argv[1]);
  }
  sleep(time);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1150 <main+0x30>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <atoi@plt>
mov    %eax,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
tail call void @llvm.assume(i1 %3)
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = tail call i32 @sleep(i32 %6)
ret i32 0
}
int sysmmu_set_prefetch_buffer_by_plane(struct device *dev,
                                        unsigned int inplanes,
                                        unsigned int onplanes,
                                        unsigned int ipoption,
                                        unsigned int opoption) {
  return 0;
}


x86 assembly (clang, -O0):
<sysmmu_set_prefetch_buffer_by_plane>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.device = type opaque
define i32 @sysmmu_set_prefetch_buffer_by_plane(%struct.device* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.device*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.device* %0, %struct.device** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
%struct.device = type opaque
define i32 @sysmmu_set_prefetch_buffer_by_plane(%struct.device* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret i32 0
}
/* Variables and functions */
int jpeg_quality_scaling(int quality) {
  if (quality <= 0)
    quality = 1;
  if (quality > 100)
    quality = 100;
  if (quality < 50)
    quality = 5000 / quality;
  else
    quality = 200 - quality * 2;
  return quality;
}


x86 assembly (clang, -O0):
<jpeg_quality_scaling>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1118 <jpeg_quality_scaling+0x18>
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jle    1129 <jpeg_quality_scaling+0x29>
movl   $0x64,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    1144 <jpeg_quality_scaling+0x44>
mov    $0x1388,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1154 <jpeg_quality_scaling+0x54>
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
mov    $0xc8,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jpeg_quality_scaling>:
test   %edi,%edi
mov    $0x1,%eax
cmovg  %edi,%eax
cmp    $0x64,%eax
mov    $0x64,%ecx
cmovb  %eax,%ecx
cmp    $0x31,%ecx
ja     1127 <jpeg_quality_scaling+0x27>
mov    $0x1388,%ax
xor    %edx,%edx
div    %cx
movzwl %ax,%eax
ret
add    %ecx,%ecx
mov    $0xc8,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @jpeg_quality_scaling(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 1, i32* %2
br label %6
6: ; preds = %5, %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 100
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 100, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 50
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sdiv i32 5000, %14
store i32 %15, i32* %2
br label %20
16: ; preds = %10
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 2
%19 = sub nsw i32 200, %18
store i32 %19, i32* %2
br label %20
20: ; preds = %16, %13
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @jpeg_quality_scaling(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = select i1 %2, i32 %0, i32 1
%4 = icmp ult i32 %3, 100
%5 = select i1 %4, i32 %3, i32 100
%6 = icmp ult i32 %5, 50
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = trunc i32 %5 to i16
%9 = udiv i16 5000, %8
%10 = zext i16 %9 to i32
br label %14
11: ; preds = %1
%12 = mul nsw i32 %5, -2
%13 = add nsw i32 %12, 200
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ %10, %7 ], [ %13, %11 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() { printf("%d\n", 0b110); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x6,%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 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
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 6)
ret i32 0
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
__attribute__((always_)) int32_t __QADD(int32_t x, int32_t y) {
  int32_t result;
  if (y >= 0) {
    if (x + y >= x) {
      result = x + y;
    } else {
      result = 0x7FFFFFFF;
    }
  } else {
    if (x + y < x) {
      result = x + y;
    } else {
      result = 0x80000000;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<__QADD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     113d <__QADD+0x3d>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     1131 <__QADD+0x31>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <__QADD+0x38>
movl   $0x7fffffff,-0xc(%rbp)
jmp    1166 <__QADD+0x66>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <__QADD+0x5a>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <__QADD+0x61>
movl   $0x80000000,-0xc(%rbp)
jmp    1166 <__QADD+0x66>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__QADD>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @__QADD(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %3
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
store i32 %17, i32* %5
br label %19
18: ; preds = %8
store i32 2147483647, i32* %5
br label %19
19: ; preds = %18, %14
br label %32
20: ; preds = %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = add nsw i32 %27, %28
store i32 %29, i32* %5
br label %31
30: ; preds = %20
store i32 -2147483648, i32* %5
br label %31
31: ; preds = %30, %26
br label %32
32: ; preds = %31, %19
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
define i32 @__QADD(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_EXTENSION;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_EXTENSION_it;
void X509_EXTENSION_free(X509_EXTENSION *a) {
  ASN1_item_free((ASN1_VALUE *)a, &X509_EXTENSION_it);
}


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

x86 assembly (clang, -O2):
<X509_EXTENSION_free>:
mov    0x2ec9(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@X509_EXTENSION_it = global i32 0
define void @X509_EXTENSION_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @X509_EXTENSION_it)
ret void
}

LLVM IR (-O2):
@X509_EXTENSION_it = global i32 0
define void @X509_EXTENSION_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @X509_EXTENSION_it)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ zwrite(int /*<<< orphan*/, int /*<<< orphan*/);
void write8(uint16_t address, uint8_t value) { zwrite(address, value); }


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

x86 assembly (clang, -O2):
<write8>:
jmp    1030 <zwrite@plt>

LLVM IR (-O0):
define void @write8(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 @zwrite(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @write8(i32 %0, i32 %1) {
%3 = tail call i32 @zwrite(i32 %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ err_quit(char *);
int /*<<< orphan*/ errno;
scalar_t__ pthread_cancel(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void Pthread_cancel(pthread_t tid) {
  if (pthread_cancel(tid) != 0)
    do {
      strerror(errno);
      puts("\n");
      err_quit("pthread cancel error");
    } while (1);
}


x86 assembly (clang, -O0):
<Pthread_cancel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <pthread_cancel@plt>
cmp    $0x0,%rax
je     119c <Pthread_cancel+0x5c>
jmp    1162 <Pthread_cancel+0x22>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7f(%rip),%rdi
call   1040 <err_quit@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1162 <Pthread_cancel+0x22>
jmp    1197 <Pthread_cancel+0x57>
jmp    119c <Pthread_cancel+0x5c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_cancel>:
push   %r15
push   %r14
push   %rbx
call   1060 <pthread_cancel@plt>
test   %rax,%rax
je     118a <Pthread_cancel+0x4a>
mov    0x2e8a(%rip),%r15
lea    0xea3(%rip),%r14
lea    0xe9e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15),%edi
call   1050 <strerror@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <err_quit@plt>
jmp    1170 <Pthread_cancel+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [21 x i8] c"pthread cancel error\00"
define void @Pthread_cancel(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @pthread_cancel(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
br label %7
7: ; preds = %12, %6
%8 = load i32, i32* @errno
%9 = call i32 @strerror(i32 %8)
%10 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @err_quit(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %7
br i1 true, label %7, label %13
13: ; preds = %12
br label %14
14: ; preds = %13, %1
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [21 x i8] c"pthread cancel error\00"
define void @Pthread_cancel(i32 %0) {
%2 = tail call i64 @pthread_cancel(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = load i32, i32* @errno
%6 = tail call i32 @strerror(i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @err_quit(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %4
9: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ pause();
int main(void) {
  int *p;
  p = (int *)malloc(10 * sizeof(int));
  pause();
  free(p);
  p = NULL;
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x28,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pause@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x28,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <pause@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = call i32 (...) @pause()
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
store i32* null, i32** %2
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 (...) @pause()
%4 = tail call i32 @free(i32* %2)
%5 = load i32, i32* @EXIT_SUCCESS
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
scalar_t__ is_power_of_2_i(int);
int power_of_2_max_i(int n) {
  if (is_power_of_2_i(n))
    return n;
  do {
    n = n & (n - 1);
  } while (!is_power_of_2_i(n));
  return n * 2;
}


x86 assembly (clang, -O0):
<power_of_2_max_i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <is_power_of_2_i@plt>
cmp    $0x0,%rax
je     1138 <power_of_2_max_i+0x28>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116d <power_of_2_max_i+0x5d>
jmp    113d <power_of_2_max_i+0x2d>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <is_power_of_2_i@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113d <power_of_2_max_i+0x2d>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_of_2_max_i>:
push   %rbx
mov    %edi,%ebx
call   1030 <is_power_of_2_i@plt>
test   %rax,%rax
jne    1135 <power_of_2_max_i+0x25>
nopl   (%rax)
mov    %ebx,%eax
lea    -0x1(%rax),%ebx
and    %eax,%ebx
mov    %ebx,%edi
call   1030 <is_power_of_2_i@plt>
test   %rax,%rax
je     1120 <power_of_2_max_i+0x10>
add    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @power_of_2_max_i(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @is_power_of_2_i(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* %3
store i32 %8, i32* %2
br label %23
9: ; preds = %1
br label %10
10: ; preds = %15, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = and i32 %11, %13
store i32 %14, i32* %3
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = call i64 @is_power_of_2_i(i32 %16)
%18 = icmp ne i64 %17, 0
%19 = xor i1 %18, true
br i1 %19, label %10, label %20
20: ; preds = %15
%21 = load i32, i32* %3
%22 = mul nsw i32 %21, 2
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %7
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @power_of_2_max_i(i32 %0) {
%2 = tail call i64 @is_power_of_2_i(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %0, %1 ]
%6 = add nsw i32 %5, -1
%7 = and i32 %6, %5
%8 = tail call i64 @is_power_of_2_i(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = shl nsw i32 %7, 1
br label %12
12: ; preds = %1, %10
%13 = phi i32 [ %11, %10 ], [ %0, %1 ]
ret i32 %13
}
/* Type definitions */
struct func_hook {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_hook(struct func_hook *, int);
void force_rehook(struct func_hook *hook) { do_hook(hook, true); }


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

x86 assembly (clang, -O2):
<force_rehook>:
mov    $0x1,%esi
jmp    1030 <do_hook@plt>

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

LLVM IR (-O2):
%struct.func_hook = type { i32 }
define void @force_rehook(%struct.func_hook* %0) {
%2 = tail call i32 @do_hook(%struct.func_hook* %0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ INS_0F();
int /*<<< orphan*/ _c_setbyte(int);
void POP_FS() {
  ;
  INS_0F();
  _c_setbyte(0xa1);
  ;
}


x86 assembly (clang, -O0):
<POP_FS>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <INS_0F@plt>
mov    $0xa1,%edi
call   1040 <_c_setbyte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<POP_FS>:
push   %rax
xor    %eax,%eax
call   1030 <INS_0F@plt>
mov    $0xa1,%edi
pop    %rax
jmp    1040 <_c_setbyte@plt>

LLVM IR (-O0):
define void @POP_FS() {
%1 = call i32 (...) @INS_0F()
%2 = call i32 @_c_setbyte(i32 161)
ret void
}

LLVM IR (-O2):
define void @POP_FS() {
%1 = tail call i32 (...) @INS_0F()
%2 = tail call i32 @_c_setbyte(i32 161)
ret void
}
/* Variables and functions */
double M_PI;
double deg2rad(double deg) { return deg * M_PI / 180.0; }


x86 assembly (clang, -O0):
<deg2rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xedf(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg2rad>:
mov    0x2ee1(%rip),%rax
mulsd  (%rax),%xmm0
divsd  0xeed(%rip),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @deg2rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_PI
%5 = fmul double %3, %4
%6 = fdiv double %5, 1.800000e+02
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @deg2rad(double %0) {
%2 = load double, double* @M_PI
%3 = fmul double %2, %0
%4 = fdiv double %3, 1.800000e+02
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int foo(int *, int *);
int main() {
  int a, b;
  if (foo(&a, &b) != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <foo@plt>
cmp    $0x1,%eax
je     114c <main+0x2c>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    1137 <main+0x17>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @foo(i32* %2, i32* %3)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @foo(i32* %1, i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uintmax_t;
typedef int /*<<< orphan*/ intmax_t;

/* Variables and functions */
uintmax_t ft_absolute(intmax_t n) { return (n < 0 ? -n : n); }


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

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

LLVM IR (-O0):
define i32 @ft_absolute(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
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @ft_absolute(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int isFloat(char ch) {
  return ((ch >= '0' && ch <= '9') || ch == '.' || ch == '+' || ch == '-' ||
                  ch == 'e'
              ? 1
              : 0);
}


x86 assembly (clang, -O0):
<isFloat>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <isFloat+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    116c <isFloat+0x6c>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2e,%ecx
mov    %al,-0x2(%rbp)
je     116c <isFloat+0x6c>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     116c <isFloat+0x6c>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     116c <isFloat+0x6c>
movsbl -0x1(%rbp),%eax
cmp    $0x65,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isFloat>:
lea    -0x30(%rdi),%ecx
mov    $0x1,%eax
cmp    $0xa,%cl
jb     1127 <isFloat+0x27>
cmp    $0x2e,%dil
ja     1128 <isFloat+0x28>
movzbl %dil,%ecx
movabs $0x680000000000,%rdx
bt     %rcx,%rdx
jae    1128 <isFloat+0x28>
ret
xor    %eax,%eax
cmp    $0x65,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isFloat(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %26, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 46
br i1 %13, label %26, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 43
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 45
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 101
br label %26
26: ; preds = %22, %18, %14, %10, %6
%27 = phi i1 [ true, %18 ], [ true, %14 ], [ true, %10 ], [ true, %6 ], [ %25, %22 ]
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 1, i32 0
ret i32 %29
}

LLVM IR (-O2):
define i32 @isFloat(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %8, label %4
4: ; preds = %1
switch i8 %0, label %5 [
i8 46, label %8
i8 45, label %8
i8 43, label %8
]
5: ; preds = %4
%6 = icmp eq i8 %0, 101
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %4, %4, %1, %5
%9 = phi i32 [ %7, %5 ], [ 1, %4 ], [ 1, %1 ], [ 1, %4 ], [ 1, %4 ]
ret i32 %9
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int64_t get_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return ((int64_t)tv.tv_sec * 1000000) + tv.tv_usec;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
imul   $0xf4240,%eax,%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x10(%rsp),%eax
add    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @get_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ controlEnable();
int /*<<< orphan*/ forward_mm(int, int);
int /*<<< orphan*/ init();
int /*<<< orphan*/ turnRight_degree(int, int);
int main(int argc, char *argv[]) {
  init();
  controlEnable();
  forward_mm(10, 150);
  turnRight_degree(10, 90);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
mov    $0x0,%al
call   1030 <controlEnable@plt>
mov    $0xa,%edi
mov    $0x96,%esi
call   1050 <forward_mm@plt>
mov    $0xa,%edi
mov    $0x5a,%esi
call   1060 <turnRight_degree@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init@plt>
xor    %eax,%eax
call   1030 <controlEnable@plt>
mov    $0xa,%edi
mov    $0x96,%esi
call   1050 <forward_mm@plt>
mov    $0xa,%edi
mov    $0x5a,%esi
call   1060 <turnRight_degree@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @init()
%6 = call i32 (...) @controlEnable()
%7 = call i32 @forward_mm(i32 10, i32 150)
%8 = call i32 @turnRight_degree(i32 10, i32 90)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init()
%4 = tail call i32 (...) @controlEnable()
%5 = tail call i32 @forward_mm(i32 10, i32 150)
%6 = tail call i32 @turnRight_degree(i32 10, i32 90)
ret i32 0
}
int __attribute__((nomips16)) f5(unsigned long long y) {
  return (short)((short)(y >> 33) + 1);
}


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x21,%rax
cwtl
add    $0x1,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
shr    $0x11,%rdi
lea    0x10000(%rdi),%eax
sar    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @f5(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 33
%5 = trunc i64 %4 to i16
%6 = sext i16 %5 to i32
%7 = add nsw i32 %6, 1
%8 = trunc i32 %7 to i16
%9 = sext i16 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f5(i64 %0) {
%2 = lshr i64 %0, 17
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 65536
%5 = ashr i32 %4, 16
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ printf(char *);
int main() {
  int x;
  printf("Hello world!\n");
  f();
  x++;
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @f()
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @f()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strtok(char *, char *);
char *chop_uname(char *uname) {
  strtok(uname, "@");
  return uname;
}


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

x86 assembly (clang, -O2):
<chop_uname>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strtok@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"@\00"
define i8* @chop_uname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strtok(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
@.str = [2 x i8] c"@\00"
define i8* @chop_uname(i8* returned %0) {
%2 = tail call i32 @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %0
}
int digimax_sound_machine_cycle_based(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @digimax_sound_machine_cycle_based() {
ret i32 0
}

LLVM IR (-O2):
define i32 @digimax_sound_machine_cycle_based() {
ret i32 0
}
char c(int n) {
  char x[2][n];
  x[1][0] = 0;
  return *(n + (char *)x);
}


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xf(%rcx,%rcx,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
shl    $0x0,%rcx
movb   $0x0,(%rax,%rcx,1)
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
movsbl %al,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,%eax
mov    %rsp,%rcx
lea    (%rax,%rax,1),%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
sub    %rdx,%rcx
mov    %rcx,%rsp
movb   $0x0,(%rax,%rcx,1)
movslq %edi,%rax
mov    (%rax,%rcx,1),%al
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @c(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 = mul nuw i64 2, %6
%9 = alloca i8, i64 %8
store i64 %6, i64* %4
%10 = mul nsw i64 1, %6
%11 = getelementptr inbounds i8, i8* %9, i64 %10
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 0, i8* %12
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %9, i64 %14
%16 = load i8, i8* %15
%17 = load i8*, i8** %3
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @c(i32 %0) {
%2 = zext i32 %0 to i64
%3 = shl nuw nsw i64 %2, 1
%4 = alloca i8, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 %2
store i8 0, i8* %5
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}
void kmemleak_update_trace(const void *ptr) {}


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

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

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

LLVM IR (-O2):
define void @kmemleak_update_trace(i8* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ ceil(float);
__attribute__((const)) int iceilf(float x) { return (int)ceil(x); }


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

x86 assembly (clang, -O2):
<iceilf>:
jmp    1030 <ceil@plt>

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

LLVM IR (-O2):
define i32 @iceilf(float %0) {
%2 = tail call i64 @ceil(float %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
struct in_addr {
  int /*<<< orphan*/ s_addr;
};
typedef int /*<<< orphan*/ in_addr_t;

/* Variables and functions */
int /*<<< orphan*/ INADDR_NONE;
scalar_t__ inet_aton(char const *, struct in_addr *);
in_addr_t inet_addr(const char *cp) {
  struct in_addr val;
  if (inet_aton(cp, &val))
    return val.s_addr;
  return INADDR_NONE;
}


x86 assembly (clang, -O0):
<inet_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <inet_aton@plt>
cmp    $0x0,%rax
je     113e <inet_addr+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <inet_addr+0x3a>
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_addr>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <inet_aton@plt>
test   %rax,%rax
jne    112e <inet_addr+0x1e>
mov    0x2eba(%rip),%rbx
mov    (%rbx),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@INADDR_NONE = global i32 0
define i32 @inet_addr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.in_addr
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @inet_aton(i8* %5, %struct.in_addr* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %4, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* @INADDR_NONE
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@INADDR_NONE = global i32 0
define i32 @inet_addr(i8* %0) {
%2 = alloca %struct.in_addr
%3 = bitcast %struct.in_addr* %2 to i8*
%4 = call i64 @inet_aton(i8* %0, %struct.in_addr* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = load i32, i32* @INADDR_NONE
%9 = select i1 %5, i32 %8, i32 %7
ret i32 %9
}
/* Variables and functions */
void *malloc(unsigned int);
void *inv_malloc(unsigned int numBytes) {
  void *allocPtr = malloc(numBytes);
  return allocPtr;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @inv_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float p;
  printf("Polegada: ");
  scanf("%f", &p);
  printf("Centrímetro: %.2f", p * 2.54);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xead(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeae(%rip),%xmm0
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Polegada: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c"Centr\C3\ADmetro: %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fmul double %6, 2.540000e+00
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Polegada: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c"Centr\C3\ADmetro: %.2f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fmul double %6, 2.540000e+00
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
void do_sync(argc, argv) char **argv;
{ sync(); }


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

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

LLVM IR (-O0):
define void @do_sync(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @sync()
ret void
}

LLVM IR (-O2):
define void @do_sync(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @sync()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
scalar_t__ memmove(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, size_t);
wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n) {
  return (wchar_t *)memmove(d, s, n * sizeof(wchar_t));
}


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

x86 assembly (clang, -O2):
<wmemmove>:
shl    $0x2,%rdx
jmp    1030 <memmove@plt>

LLVM IR (-O0):
define i32* @wmemmove(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = mul i64 %9, 4
%11 = call i64 @memmove(i32* %7, i32* %8, i64 %10)
%12 = inttoptr i64 %11 to i32*
ret i32* %12
}

LLVM IR (-O2):
define i32* @wmemmove(i32* %0, i32* %1, i64 %2) {
%4 = shl i64 %2, 2
%5 = tail call i64 @memmove(i32* %0, i32* %1, i64 %4)
%6 = inttoptr i64 %5 to i32*
ret i32* %6
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ sleep(int);
int main() {
  for (;;) {
    char *c = (char *)malloc(16 * 1024 * 1024);
    if (c) {
      memset(c, 'a', 16 * 1024 * 1024);
    }
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1000000,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116b <main+0x3b>
mov    -0x10(%rbp),%rdi
mov    $0x61,%esi
mov    $0x1000000,%edx
call   1030 <memset@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    113f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
jmp    114a <main+0x1a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1000000,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <main+0x10>
mov    %rax,%rdi
mov    $0x61,%esi
mov    $0x1000000,%edx
call   1030 <memset@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
br label %3
3: ; preds = %11, %0
%4 = call i64 @malloc(i32 16777216)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = call i32 @memset(i8* %9, i8 signext 97, i32 16777216)
br label %11
11: ; preds = %8, %3
%12 = call i32 @sleep(i32 1)
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %7, %0
%2 = tail call i64 @malloc(i32 16777216)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = inttoptr i64 %2 to i8*
%6 = tail call i32 @memset(i8* %5, i8 signext 97, i32 16777216)
br label %7
7: ; preds = %4, %1
%8 = tail call i32 @sleep(i32 1)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ sort_r_simple(void *, size_t, size_t,
                                 int (*)(void const *, void const *, void *),
                                 void *);
void sort_r(void *base, size_t nel, size_t width,
            int (*compar)(const void *_a, const void *_b, void *_arg),
            void *arg) {
  sort_r_simple(base, nel, width, compar, arg);
}


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

x86 assembly (clang, -O2):
<sort_r>:
jmp    1030 <sort_r_simple@plt>

LLVM IR (-O0):
define void @sort_r(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32 (i8*, i8*, i8*)*
%10 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i32 (i8*, i8*, i8*)* %3, i32 (i8*, i8*, i8*)** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = load i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)** %9
%15 = load i8*, i8** %10
%16 = call i32 @sort_r_simple(i8* %11, i64 %12, i64 %13, i32 (i8*, i8*, i8*)* %14, i8* %15)
ret void
}

LLVM IR (-O2):
define void @sort_r(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4) {
%6 = tail call i32 @sort_r_simple(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ invocMenu();
int main() {
  invocMenu();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @invocMenu()
ret i32 0
}
void set_default_msgsize(int *size) { *size = 64; }


x86 assembly (clang, -O0):
<set_default_msgsize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x40,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_default_msgsize>:
movl   $0x40,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_default_msgsize(i32* nocapture writeonly %0) {
store i32 64, i32* %0
ret void
}