#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, ...);
int *random_serial_number(int);
int main(int argc, char *argv[]) {
  int *serial_number = random_serial_number(8192);
  for (int i = 0; i < 8192; ++i) {
    if (i && i % 8 == 0) {
      printf("\n");
    }
    printf("%-6d", serial_number[i]);
  }
  free(serial_number);
  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)
mov    $0x2000,%edi
call   1040 <random_serial_number@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2000,-0x1c(%rbp)
jge    11bb <main+0x8b>
cmpl   $0x0,-0x1c(%rbp)
je     1194 <main+0x64>
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1194 <main+0x64>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <main+0x2b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x2000,%edi
call   1050 <random_serial_number@plt>
mov    %rax,%r15
lea    0xea7(%rip),%r14
xor    %ebx,%ebx
jmp    117b <main+0x3b>
nopl   (%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    $0x2000,%rbx
je     1196 <main+0x56>
test   %rbx,%rbx
je     1160 <main+0x20>
mov    %ebx,%eax
and    $0x7,%eax
test   %rax,%rax
jne    1160 <main+0x20>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1160 <main+0x20>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"%-6d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32* @random_serial_number(i32 8192)
store i32* %8, i32** %6
store i32 0, i32* %7
br label %9
9: ; preds = %28, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 8192
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %7
%17 = srem i32 %16, 8
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %12
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %21
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %9
31: ; preds = %9
%32 = load i32*, i32** %6
%33 = call i32 @free(i32* %32)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%-6d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @random_serial_number(i32 8192)
br label %6
4: ; preds = %14
%5 = tail call i32 @free(i32* %3)
ret i32 0
6: ; preds = %2, %14
%7 = phi i64 [ 0, %2 ], [ %18, %14 ]
%8 = icmp ne i64 %7, 0
%9 = and i64 %7, 7
%10 = icmp eq i64 %9, 0
%11 = and i1 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 @putchar(i32 10)
br label %14
14: ; preds = %12, %6
%15 = getelementptr inbounds i32, i32* %3, i64 %7
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i64 %7, 1
%19 = icmp eq i64 %18, 8192
br i1 %19, label %4, label %6
}