xunge/DecIR huggingface dataset:
/* Variables and functions */
int open(char *, int);
int posix_openpt(int oflag) {
  int fdm;
  fdm = open("/dev/ptmx", oflag);
  return (fdm);
}


x86 assembly (clang, -O0):
<posix_openpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_openpt>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <open@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/ptmx\00"
define i32 @posix_openpt(i32 %0) {
%2 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 %2
}
void func1(void) {}


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

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

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

LLVM IR (-O2):
define void @func1() {
ret void
}
/* Variables and functions */
bool parse_source_date_epoch_from_env(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @parse_source_date_epoch_from_env() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ http_server_main();
int main(void) {
  http_server_main();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @http_server_main()
ret i32 0
}
/* Type definitions */
struct vnic_rq {
  int dummy;
};

/* Variables and functions */
int fnic_rq_desc_avail(struct vnic_rq *);
int stub1(struct vnic_rq *);
int fnic_rq_fill(struct vnic_rq *rq, int (*buf_fill)(struct vnic_rq *rq)) {
  int err;
  while (fnic_rq_desc_avail(rq) > 1) {
    err = (*buf_fill)(rq);
    if (err)
      return err;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fnic_rq_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fnic_rq_desc_avail@plt>
cmp    $0x1,%eax
jle    1159 <fnic_rq_fill+0x49>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1154 <fnic_rq_fill+0x44>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <fnic_rq_fill+0x50>
jmp    1120 <fnic_rq_fill+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnic_rq_fill>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fnic_rq_desc_avail@plt>
cmp    $0x2,%eax
jl     1139 <fnic_rq_fill+0x29>
mov    %rbx,%rdi
call   *%r14
test   %eax,%eax
je     1120 <fnic_rq_fill+0x10>
jmp    113b <fnic_rq_fill+0x2b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.vnic_rq = type { i32 }
define i32 @fnic_rq_fill(%struct.vnic_rq* %0, i32 (%struct.vnic_rq*)* %1) {
%3 = alloca i32
%4 = alloca %struct.vnic_rq*
%5 = alloca i32 (%struct.vnic_rq*)*
%6 = alloca i32
store %struct.vnic_rq* %0, %struct.vnic_rq** %4
store i32 (%struct.vnic_rq*)* %1, i32 (%struct.vnic_rq*)** %5
br label %7
7: ; preds = %19, %2
%8 = load %struct.vnic_rq*, %struct.vnic_rq** %4
%9 = call i32 @fnic_rq_desc_avail(%struct.vnic_rq* %8)
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i32 (%struct.vnic_rq*)*, i32 (%struct.vnic_rq*)** %5
%13 = load %struct.vnic_rq*, %struct.vnic_rq** %4
%14 = call i32 %12(%struct.vnic_rq* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i32, i32* %6
store i32 %18, i32* %3
br label %21
19: ; preds = %11
br label %7
20: ; preds = %7
store i32 0, i32* %3
br label %21
21: ; preds = %20, %17
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
%struct.vnic_rq = type { i32 }
define i32 @fnic_rq_fill(%struct.vnic_rq* %0, i32 (%struct.vnic_rq*)* nocapture %1) {
br label %3
3: ; preds = %6, %2
%4 = tail call i32 @fnic_rq_desc_avail(%struct.vnic_rq* %0)
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 %1(%struct.vnic_rq* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %3, label %9
9: ; preds = %3, %6
%10 = phi i32 [ %7, %6 ], [ 0, %3 ]
ret i32 %10
}
/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int, int);
int /*<<< orphan*/ stderr;
int check_buflen(int buflen, int min_length, const char *func) {
  if (buflen < min_length) {
    fprintf(stderr, "%s: corrupted, expected minimum length %d, got %d\n", func,
            min_length, buflen);
    return -EINVAL;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_buflen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1161 <check_buflen+0x51>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xeb7(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
mov    0x2e81(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <check_buflen+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_buflen>:
xor    %eax,%eax
cmp    %esi,%edi
jge    1140 <check_buflen+0x30>
push   %rax
mov    %esi,%ecx
mov    %edi,%r8d
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"%s: corrupted, expected minimum length %d, got %d\0A\00"
@EINVAL = global i32 0
define i32 @check_buflen(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %7
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14, i32 %15)
%17 = load i32, i32* @EINVAL
%18 = sub nsw i32 0, %17
store i32 %18, i32* %4
br label %20
19: ; preds = %3
store i32 0, i32* %4
br label %20
20: ; preds = %19, %11
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"%s: corrupted, expected minimum length %d, got %d\0A\00"
@EINVAL = global i32 0
define i32 @check_buflen(i32 %0, i32 %1, i8* %2) {
%4 = icmp slt i32 %0, %1
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %1, i32 %0)
%8 = load i32, i32* @EINVAL
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %3, %5
%11 = phi i32 [ %9, %5 ], [ 0, %3 ]
ret i32 %11
}
int main() {
  int ret;

#pragma omp parallel num_threads(3)

  {

#pragma omp single

      {ret = 0;
}
}

#pragma omp parallel num_threads(4)
{
#pragma omp single
    {ret = 0;
}
}
{
#pragma omp parallel num_threads(5)
    {
#pragma omp single
        {ret = 0;
}
}
}

#pragma omp parallel num_threads(2)
{
#pragma omp single
    {ret = 0;
}
}

#pragma omp parallel num_threads(2)
{
#pragma omp single
  { ret = 0; }
}
return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void array_pointer_arith_Bad() {
  int arr[10];
  int *p = &arr[5];
  p[5] = 1;
}


x86 assembly (clang, -O0):
<array_pointer_arith_Bad>:
push   %rbp
mov    %rsp,%rbp
lea    -0x30(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movl   $0x1,0x14(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @array_pointer_arith_Bad() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 5
store i32 1, i32* %5
ret void
}

LLVM IR (-O2):
define void @array_pointer_arith_Bad() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mem_remap_top(int);
void mem_remap_top_256k() { mem_remap_top(256); }


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

x86 assembly (clang, -O2):
<mem_remap_top_256k>:
mov    $0x100,%edi
jmp    1030 <mem_remap_top@plt>

LLVM IR (-O0):
define void @mem_remap_top_256k() {
%1 = call i32 @mem_remap_top(i32 256)
ret void
}

LLVM IR (-O2):
define void @mem_remap_top_256k() {
%1 = tail call i32 @mem_remap_top(i32 256)
ret void
}
/* Type definitions */
struct Plex {
  int dummy;
};

/* Variables and functions */
long fetchSubEdges(struct Plex *);
long fetchSubPolygons(struct Plex *);
int fetchST(struct Plex *plex) {
  long ne, np;
  ne = fetchSubEdges(plex);
  if (ne == 0)
    return (0);
  np = fetchSubPolygons(plex);
  if (np == 0)
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<fetchST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fetchSubEdges@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <fetchST+0x30>
movl   $0x0,-0x4(%rbp)
jmp    117b <fetchST+0x5b>
mov    -0x10(%rbp),%rdi
call   1030 <fetchSubPolygons@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1174 <fetchST+0x54>
movl   $0x0,-0x4(%rbp)
jmp    117b <fetchST+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetchST>:
push   %rbx
mov    %rdi,%rbx
call   1040 <fetchSubEdges@plt>
test   %rax,%rax
je     1143 <fetchST+0x23>
mov    %rbx,%rdi
call   1030 <fetchSubPolygons@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Plex = type { i32 }
define i32 @fetchST(%struct.Plex* %0) {
%2 = alloca i32
%3 = alloca %struct.Plex*
%4 = alloca i64
%5 = alloca i64
store %struct.Plex* %0, %struct.Plex** %3
%6 = load %struct.Plex*, %struct.Plex** %3
%7 = call i64 @fetchSubEdges(%struct.Plex* %6)
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %18
11: ; preds = %1
%12 = load %struct.Plex*, %struct.Plex** %3
%13 = call i64 @fetchSubPolygons(%struct.Plex* %12)
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 0, i32* %2
br label %18
17: ; preds = %11
store i32 1, i32* %2
br label %18
18: ; preds = %17, %16, %10
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.Plex = type { i32 }
define i32 @fetchST(%struct.Plex* %0) {
%2 = tail call i64 @fetchSubEdges(%struct.Plex* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @fetchSubPolygons(%struct.Plex* %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
void fun(char *a) {
  for (; *a; a++)
    if (*a >= 'a' && *a <= 'z')
      *a = *a - 32;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115d <fun+0x5d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1147 <fun+0x47>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1147 <fun+0x47>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x20,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    114c <fun+0x4c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <fun+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
mov    (%rdi),%al
test   %al,%al
je     112a <fun+0x2a>
add    $0x1,%rdi
jmp    111b <fun+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <fun+0x2a>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <fun+0x10>
add    $0xe0,%al
mov    %al,-0x1(%rdi)
jmp    1110 <fun+0x10>
ret

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

LLVM IR (-O2):
define void @fun(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %4, %9
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret void
}
/* Variables and functions */
int rand();
void gera(int *v, int n) {
  int i = 0;
  int numero;
  for (i = 0; i <= n; i++) {
    v[i] = rand() % n;
  }
}


x86 assembly (clang, -O0):
<gera>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     115d <gera+0x4d>
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <gera+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gera>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
js     1148 <gera+0x38>
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %r15d
mov    %edx,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <gera+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @gera(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = add nuw i32 %1, 1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, %1
%11 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 %10, i32* %11
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mqd_t;

/* Variables and functions */
int /*<<< orphan*/ mq_close(int /*<<< orphan*/);
int /*<<< orphan*/ mq_unlink(char const *);
void mqclean(mqd_t queue, const char *qname) {
  mq_close(queue);
  mq_unlink(qname);
}


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

x86 assembly (clang, -O2):
<mqclean>:
push   %rbx
mov    %rsi,%rbx
call   1030 <mq_close@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <mq_unlink@plt>

LLVM IR (-O0):
define void @mqclean(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = call i32 @mq_close(i32 %5)
%7 = load i8*, i8** %4
%8 = call i32 @mq_unlink(i8* %7)
ret void
}

LLVM IR (-O2):
define void @mqclean(i32 %0, i8* %1) {
%3 = tail call i32 @mq_close(i32 %0)
%4 = tail call i32 @mq_unlink(i8* %1)
ret void
}
void dummy_func(struct S *x) {}


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

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

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

LLVM IR (-O2):
%struct.S = type opaque
define void @dummy_func(%struct.S* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int f(int);
main() {
  if (f(-1) != -1)
    abort();
  if (f(1) != 1)
    abort();
  if (f(0) != 0)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1040 <f@plt>
cmp    $0xffffffff,%eax
je     1159 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x1,%edi
call   1040 <f@plt>
cmp    $0x1,%eax
je     1173 <main+0x43>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <f@plt>
cmp    $0x0,%eax
je     118a <main+0x5a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1040 <f@plt>
cmp    $0xffffffff,%eax
jne    1161 <main+0x31>
mov    $0x1,%edi
call   1040 <f@plt>
cmp    $0x1,%eax
jne    1161 <main+0x31>
xor    %edi,%edi
call   1040 <f@plt>
test   %eax,%eax
jne    1161 <main+0x31>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 -1)
%3 = icmp ne i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @f(i32 1)
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @f(i32 0)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 -1)
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @f(i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @f(i32 0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call i32 @exit(i32 0)
unreachable
}
int is_bottom(unsigned char ch) {
  if (ch == 0xdf || ch == '\'' || ch == '\"') {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_bottom>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0xdf,%eax
je     1133 <is_bottom+0x33>
movzbl -0x5(%rbp),%eax
cmp    $0x27,%eax
je     1133 <is_bottom+0x33>
movzbl -0x5(%rbp),%eax
cmp    $0x22,%eax
jne    113f <is_bottom+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    1146 <is_bottom+0x46>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_bottom>:
xor    %eax,%eax
cmp    $0xdf,%dil
je     1119 <is_bottom+0x19>
cmp    $0x22,%dil
je     1119 <is_bottom+0x19>
cmp    $0x27,%dil
je     1119 <is_bottom+0x19>
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_bottom(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 223
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp eq i32 %9, 39
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 34
br i1 %14, label %15, label %16
15: ; preds = %11, %7, %1
store i32 0, i32* %2
br label %17
16: ; preds = %11
store i32 1, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @is_bottom(i8 zeroext %0) {
switch i8 %0, label %2 [
i8 -33, label %3
i8 39, label %3
i8 34, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 1, %2 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ gid_t;

/* Variables and functions */
scalar_t__ getegid();
int /*<<< orphan*/ printf(char *, int);
int main() {
  gid_t id;
  id = getegid();
  printf("%d\n", (int)id);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getegid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%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 i64
store i32 0, i32* %1
%3 = call i64 (...) @getegid()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = trunc i64 %4 to i32
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

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

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
FILE *STDopenFP(char *pszFileNM, char *pszMode) {
  FILE *fpFile;
  fpFile = fopen(pszFileNM, pszMode);
  return fpFile;
}


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

x86 assembly (clang, -O2):
<STDopenFP>:
jmp    1030 <fopen@plt>

LLVM IR (-O0):
define i32* @STDopenFP(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** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
ret i32* %9
}

LLVM IR (-O2):
define noalias i32* @STDopenFP(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
ret i32* %3
}
void ASN1_item_ex_free(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_item_ex_free() {
ret void
}
void do_umount(int argc __attribute__((unused)),
               const char **argv __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @do_umount(i32 %0, i8** nocapture %1) {
ret void
}
/* Type definitions */
struct netdev_queue {
  int dummy;
};
struct net_device {
  int dummy;
};

/* Variables and functions */
int netif_queue_stopped(struct net_device *);
int netif_tx_queue_stopped(const struct netdev_queue *txq) {
  return netif_queue_stopped((struct net_device *)txq);
}


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

x86 assembly (clang, -O2):
<netif_tx_queue_stopped>:
jmp    1030 <netif_queue_stopped@plt>

LLVM IR (-O0):
%struct.netdev_queue = type { i32 }
%struct.net_device = type { i32 }
define i32 @netif_tx_queue_stopped(%struct.netdev_queue* %0) {
%2 = alloca %struct.netdev_queue*
store %struct.netdev_queue* %0, %struct.netdev_queue** %2
%3 = load %struct.netdev_queue*, %struct.netdev_queue** %2
%4 = bitcast %struct.netdev_queue* %3 to %struct.net_device*
%5 = call i32 @netif_queue_stopped(%struct.net_device* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.netdev_queue = type { i32 }
%struct.net_device = type { i32 }
define i32 @netif_tx_queue_stopped(%struct.netdev_queue* %0) {
%2 = bitcast %struct.netdev_queue* %0 to %struct.net_device*
%3 = tail call i32 @netif_queue_stopped(%struct.net_device* %2)
ret i32 %3
}
/* Variables and functions */
double cos(double);
double sec(double x) { return 1.0 / cos(x); }


x86 assembly (clang, -O0):
<sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sec>:
push   %rax
call   1030 <cos@plt>
movsd  0xee2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sec(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @cos(double %3)
%5 = fdiv double 1.000000e+00, %4
ret double %5
}

LLVM IR (-O2):
define double @sec(double %0) {
%2 = tail call double @cos(double %0)
%3 = fdiv double 1.000000e+00, %2
ret double %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t hex_to_num(int c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  } else {
    return c - 'a' + 10;
  }
}


x86 assembly (clang, -O0):
<hex_to_num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     1129 <hex_to_num+0x29>
cmpl   $0x39,-0x8(%rbp)
jg     1129 <hex_to_num+0x29>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <hex_to_num+0x35>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_num>:
lea    -0x30(%rdi),%ecx
lea    -0x57(%rdi),%eax
cmp    $0xa,%ecx
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hex_to_num(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %2
br label %16
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 97
%15 = add nsw i32 %14, 10
store i32 %15, i32* %2
br label %16
16: ; preds = %12, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @hex_to_num(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = add nsw i32 %0, -87
%5 = select i1 %3, i32 %2, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
scalar_t__ __glibc_unlikely(int);
size_t __wcsrtombs(char *, int /*<<< orphan*/ const **, size_t,
                   int /*<<< orphan*/ *);
size_t __wcsrtombs_chk(char *dst, const wchar_t **src, size_t len,
                       mbstate_t *ps, size_t dstlen) {
  if (__glibc_unlikely(dstlen < len))
    __chk_fail();
  return __wcsrtombs(dst, src, len, ps);
}


x86 assembly (clang, -O0):
<__wcsrtombs_chk>:
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    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__glibc_unlikely@plt>
cmp    $0x0,%rax
je     1172 <__wcsrtombs_chk+0x42>
mov    $0x0,%al
call   1040 <__chk_fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <__wcsrtombs@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wcsrtombs_chk>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
xor    %edi,%edi
cmp    %rdx,%r8
setb   %dil
call   1050 <__glibc_unlikely@plt>
test   %rax,%rax
je     115e <__wcsrtombs_chk+0x2e>
xor    %eax,%eax
call   1040 <__chk_fail@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <__wcsrtombs@plt>

LLVM IR (-O0):
define i64 @__wcsrtombs_chk(i8* %0, i32** %1, i64 %2, i32* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i32**
%8 = alloca i64
%9 = alloca i32*
%10 = alloca i64
store i8* %0, i8** %6
store i32** %1, i32*** %7
store i64 %2, i64* %8
store i32* %3, i32** %9
store i64 %4, i64* %10
%11 = load i64, i64* %10
%12 = load i64, i64* %8
%13 = icmp ult i64 %11, %12
%14 = zext i1 %13 to i32
%15 = call i64 @__glibc_unlikely(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %5
%18 = call i32 (...) @__chk_fail()
br label %19
19: ; preds = %17, %5
%20 = load i8*, i8** %6
%21 = load i32**, i32*** %7
%22 = load i64, i64* %8
%23 = load i32*, i32** %9
%24 = call i64 @__wcsrtombs(i8* %20, i32** %21, i64 %22, i32* %23)
ret i64 %24
}

LLVM IR (-O2):
define i64 @__wcsrtombs_chk(i8* %0, i32** %1, i64 %2, i32* %3, i64 %4) {
%6 = icmp ult i64 %4, %2
%7 = zext i1 %6 to i32
%8 = tail call i64 @__glibc_unlikely(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = tail call i32 (...) @__chk_fail()
br label %12
12: ; preds = %10, %5
%13 = tail call i64 @__wcsrtombs(i8* %0, i32** %1, i64 %2, i32* %3)
ret i64 %13
}
double TicksToFracSecs(unsigned long tickamount) { return 0; }


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

x86 assembly (clang, -O2):
<TicksToFracSecs>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @TicksToFracSecs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @TicksToFracSecs(i64 %0) {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *strccat(char *str, char c) {
  char *t_str;
  t_str = (char *)malloc(strlen(str) + 2);
  strcpy(t_str, str);
  strncat(t_str, &c, 1);
  free(str);
  return t_str;
}


x86 assembly (clang, -O0):
<strccat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1060 <strncat@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strccat>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %sil,0x7(%rsp)
call   1050 <strlen@plt>
lea    0x2(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
lea    0x7(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1060 <strncat@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strccat(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = add nsw i64 %7, 2
%9 = call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = load i8*, i8** %3
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @strncat(i8* %14, i8* %4, i32 1)
%16 = load i8*, i8** %3
%17 = call i32 @free(i8* %16)
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
define i8* @strccat(i8* %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add nsw i64 %4, 2
%6 = tail call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = call i32 @strncat(i8* %7, i8* %3, i32 1)
%10 = call i32 @free(i8* %0)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *, char *, int /*<<< orphan*/);
void int_09(void) { panic("Coprocessor Segment Overrun", "#NA", 0); }


x86 assembly (clang, -O0):
<int_09>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xefa(%rip),%rsi
xor    %edx,%edx
call   1030 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_09>:
lea    0xee9(%rip),%rdi
lea    0xefe(%rip),%rsi
xor    %edx,%edx
jmp    1030 <panic@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Coprocessor Segment Overrun\00"
@.str.1 = [4 x i8] c"#NA\00"
define void @int_09() {
%1 = call i32 @panic(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Coprocessor Segment Overrun\00"
@.str.1 = [4 x i8] c"#NA\00"
define void @int_09() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};
typedef int int64_t;

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


x86 assembly (clang, -O0):
<ms_since_epoch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms_since_epoch>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,(%rsp),%ecx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @ms_since_epoch() {
%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 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
ret i32 %10
}
void PD_GetDefaultAccel(int *pscale, int *pthresh) {
  *pscale = 3;
  *pthresh = 5;
}


x86 assembly (clang, -O0):
<PD_GetDefaultAccel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PD_GetDefaultAccel>:
movl   $0x3,(%rdi)
movl   $0x5,(%rsi)
ret

LLVM IR (-O0):
define void @PD_GetDefaultAccel(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
store i32 3, i32* %5
%6 = load i32*, i32** %4
store i32 5, i32* %6
ret void
}

LLVM IR (-O2):
define void @PD_GetDefaultAccel(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
store i32 3, i32* %0
store i32 5, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, size_t);
int /*<<< orphan*/ uws_free(void *);
void *uws_malloc(size_t);
void *uws_realloc(void *ptr, size_t old, size_t size) {
  void *d = uws_malloc(size);
  memcpy(d, ptr, old);
  uws_free(ptr);
  return d;
}


x86 assembly (clang, -O0):
<uws_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <uws_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rdi
call   1050 <uws_free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uws_realloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1040 <uws_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
mov    %r15,%rdi
call   1050 <uws_free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @uws_realloc(i8* %0, i64 %1, i64 %2) {
%4 = tail call i8* @uws_malloc(i64 %2)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%6 = tail call i32 @uws_free(i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void vga_data_rotate(int op) {
  outb(0x03, 0x3ce);
  outb(op, 0x3cf);
}


x86 assembly (clang, -O0):
<vga_data_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x3,%edi
mov    $0x3ce,%esi
call   1030 <outb@plt>
mov    -0x4(%rbp),%edi
mov    $0x3cf,%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_data_rotate>:
push   %rbx
mov    %edi,%ebx
mov    $0x3,%edi
mov    $0x3ce,%esi
call   1030 <outb@plt>
mov    %ebx,%edi
mov    $0x3cf,%esi
pop    %rbx
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @vga_data_rotate(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @outb(i32 3, i32 974)
%4 = load i32, i32* %2
%5 = call i32 @outb(i32 %4, i32 975)
ret void
}

LLVM IR (-O2):
define void @vga_data_rotate(i32 %0) {
%2 = tail call i32 @outb(i32 3, i32 974)
%3 = tail call i32 @outb(i32 %0, i32 975)
ret void
}
long long f(long long a) { return (char)a; }


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

x86 assembly (clang, -O2):
<f>:
movsbq %dil,%rax
ret

LLVM IR (-O0):
define i64 @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i8
%5 = sext i8 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
define i64 @f(i64 %0) {
%2 = shl i64 %0, 56
%3 = ashr exact i64 %2, 56
ret i64 %3
}
/* Variables and functions */
void *mag_malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *mag_memdup(const void *p, size_t size) {
  void *ptr = NULL;
  if (p) {
    ptr = mag_malloc(size);
    if (ptr)
      memcpy(ptr, p, size);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<mag_memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1171 <mag_memdup+0x51>
mov    -0x10(%rbp),%rdi
call   1040 <mag_malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116c <mag_memdup+0x4c>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
jmp    1171 <mag_memdup+0x51>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mag_memdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1150 <mag_memdup+0x30>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <mag_malloc@plt>
test   %rax,%rax
je     1150 <mag_memdup+0x30>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
jmp    1152 <mag_memdup+0x32>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @mag_memdup(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i8* @mag_malloc(i64 %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %1)
br label %9
9: ; preds = %4, %7, %2
%10 = phi i8* [ %5, %7 ], [ null, %4 ], [ null, %2 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int longitud(char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char cadena[200];
  printf("Introduzca una cadena de caracteres:\n");
  gets(cadena);
  printf("\nLa línea leída es:\n\"%s\"\n\n... y tiene %d caracteres.\n", cadena,
         longitud(cadena));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xd0(%rbp),%rdi
call   1040 <gets@plt>
lea    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
lea    -0xd0(%rbp),%rdi
call   1050 <longitud@plt>
mov    -0xd8(%rbp),%rsi
mov    %eax,%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1060 <longitud@plt>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Introduzca una cadena de caracteres:\0A\00"
@.str.1 = [56 x i8] c"\0ALa l\C3\ADnea le\C3\ADda es:\0A\22%s\22\0A\0A... y tiene %d caracteres.\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%7 = call i32 @longitud(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [56 x i8] c"\0ALa l\C3\ADnea le\C3\ADda es:\0A\22%s\22\0A\0A... y tiene %d caracteres.\0A\00"
@str = [37 x i8] c"Introduzca una cadena de caracteres:\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @longitud(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %5)
ret i32 0
}