#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 */
scalar_t__ EOF;
int *calloc(int, int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main(int argc, char **argv) {
  int *x, k, i = 0, y[25];
  x = calloc(25, sizeof(int));
  scanf("%d", &x[0]);
  y[0] = x[0];
  while (x[i] > 0) {
    i++;
    scanf("%d", &x[i]);
    y[i] = x[i];
  }
  for (k = 0; k < i; k++) {
    printf("%5d", x[k]);
    if ((k + 1) % 5 == 0)
      printf("\n");
  }
  printf("\n");
  for (k = 0; k < i; k++) {
    printf("%5d", y[k]);
    if ((k + 1) % 5 == 0)
      printf("\n");
  }
  printf("\n");
  int j = 0;
  while (scanf("%d", &x[j]) != EOF) {
    j++;
  }
  for (k = 0; k < j; k++) {
    printf("%5d", x[k]);
    if ((k + 1) % 5 == 0)
      printf("\n");
  }
  free(x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x19,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x90(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    11e0 <main+0xa0>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe40(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x20(%rbp),%rax
mov    %ecx,-0x90(%rbp,%rax,4)
jmp    118f <main+0x4f>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1244 <main+0x104>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1231 <main+0xf1>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1236 <main+0xf6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e7 <main+0xa7>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12b6 <main+0x176>
movslq -0x1c(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%esi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12a3 <main+0x163>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a8 <main+0x168>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1259 <main+0x119>
lea    0xd4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x18(%rbp),%rsi
movslq -0x94(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xd19(%rip),%rdi
call   1060 <scanf@plt>
mov    0x2cf5(%rip),%rcx
cmp    (%rcx),%rax
je     1310 <main+0x1d0>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    12ce <main+0x18e>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1377 <main+0x237>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1364 <main+0x224>
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1369 <main+0x229>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1317 <main+0x1d7>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    $0x19,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
lea    0xe89(%rip),%rdi
mov    %rax,%rsi
call   1070 <scanf@plt>
mov    %rbx,0x8(%rsp)
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
test   %eax,%eax
jle    123e <main+0xee>
lea    0x14(%rsp),%rbp
mov    0x8(%rsp),%rbx
add    $0x4,%rbx
xor    %r13d,%r13d
lea    0xe56(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    (%rbx),%eax
mov    %eax,0x0(%rbp)
add    $0x1,%r13d
add    $0x4,%rbp
add    $0x4,%rbx
test   %eax,%eax
jg     11b0 <main+0x60>
test   %r13d,%r13d
je     123e <main+0xee>
mov    %r13d,%r12d
mov    $0x1,%ebx
xor    %r14d,%r14d
jmp    11f8 <main+0xa8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    %r14,%r12
je     124a <main+0xfa>
mov    %r14,%rbp
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%r15d
add    $0xffffffff,%r15d
mov    0x8(%rsp),%rax
mov    (%rax,%r14,4),%esi
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %ebp,%r15d
jne    11f0 <main+0xa0>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    11f0 <main+0xa0>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    12b6 <main+0x166>
mov    $0xa,%edi
call   1040 <putchar@plt>
test   %r13d,%r13d
je     12b6 <main+0x166>
mov    $0x1,%ebx
lea    0xd9e(%rip),%r14
xor    %r15d,%r15d
jmp    1278 <main+0x128>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %r15,%r12
je     12b6 <main+0x166>
mov    %r15,%rbp
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%r13d
add    $0xffffffff,%r13d
mov    0x10(%rsp,%r15,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %ebp,%r13d
jne    1270 <main+0x120>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1270 <main+0x120>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    $0xffffffff,%ebp
lea    0xd34(%rip),%r14
mov    0x2d15(%rip),%r12
mov    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%ebp
add    $0x4,%rbx
cmp    (%r12),%rax
jne    12e0 <main+0x190>
test   %ebp,%ebp
je     135a <main+0x20a>
mov    %ebp,%r13d
mov    $0x1,%ebx
lea    0xcf8(%rip),%r14
xor    %r15d,%r15d
jmp    1318 <main+0x1c8>
add    $0x1,%ebx
cmp    %r15,%r13
je     135a <main+0x20a>
mov    %r15,%rbp
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%r12d
add    $0xffffffff,%r12d
mov    0x8(%rsp),%rax
mov    (%rax,%r15,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %ebp,%r12d
jne    1310 <main+0x1c0>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1310 <main+0x1c0>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%5d\00"
@.str.2 = [2 x i8] c"\0A\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [25 x i32]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%11 = call i32* @calloc(i32 25, i32 4)
store i32* %11, i32** %6
%12 = load i32*, i32** %6
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = load i32*, i32** %6
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = getelementptr inbounds [25 x i32], [25 x i32]* %9, i64 0, i64 0
store i32 %17, i32* %18
br label %19
19: ; preds = %26, %2
%20 = load i32*, i32** %6
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %42
26: ; preds = %19
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
%29 = load i32*, i32** %6
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %32)
%34 = load i32*, i32** %6
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [25 x i32], [25 x i32]* %9, i64 0, i64 %40
store i32 %38, i32* %41
br label %19
42: ; preds = %19
store i32 0, i32* %7
br label %43
43: ; preds = %61, %42
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %64
47: ; preds = %43
%48 = load i32*, i32** %6
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %48, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
%56 = srem i32 %55, 5
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %47
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %58, %47
br label %61
61: ; preds = %60
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %43
64: ; preds = %43
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %66
66: ; preds = %83, %64
%67 = load i32, i32* %7
%68 = load i32, i32* %8
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %86
70: ; preds = %66
%71 = load i32, i32* %7
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [25 x i32], [25 x i32]* %9, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
%78 = srem i32 %77, 5
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %70
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %82
82: ; preds = %80, %70
br label %83
83: ; preds = %82
%84 = load i32, i32* %7
%85 = add nsw i32 %84, 1
store i32 %85, i32* %7
br label %66
86: ; preds = %66
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %10
br label %88
88: ; preds = %96, %86
%89 = load i32*, i32** %6
%90 = load i32, i32* %10
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %89, i64 %91
%93 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %92)
%94 = load i64, i64* @EOF
%95 = icmp ne i64 %93, %94
br i1 %95, label %96, label %99
96: ; preds = %88
%97 = load i32, i32* %10
%98 = add nsw i32 %97, 1
store i32 %98, i32* %10
br label %88
99: ; preds = %88
store i32 0, i32* %7
br label %100
100: ; preds = %118, %99
%101 = load i32, i32* %7
%102 = load i32, i32* %10
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %121
104: ; preds = %100
%105 = load i32*, i32** %6
%106 = load i32, i32* %7
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i32, i32* %105, i64 %107
%109 = load i32, i32* %108
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %109)
%111 = load i32, i32* %7
%112 = add nsw i32 %111, 1
%113 = srem i32 %112, 5
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %104
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %117
117: ; preds = %115, %104
br label %118
118: ; preds = %117
%119 = load i32, i32* %7
%120 = add nsw i32 %119, 1
store i32 %120, i32* %7
br label %100
121: ; preds = %100
%122 = load i32*, i32** %6
%123 = call i32 @free(i32* %122)
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%5d\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [25 x i32]
%4 = bitcast [25 x i32]* %3 to i8*
%5 = tail call i32* @calloc(i32 25, i32 4)
%6 = tail call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = load i32, i32* %5
%8 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 0
store i32 %7, i32* %8
%9 = icmp sgt i32 %7, 0
br i1 %9, label %15, label %36
10: ; preds = %15
%11 = trunc i64 %17 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %36, label %13
13: ; preds = %10
%14 = and i64 %17, 4294967295
br label %23
15: ; preds = %2, %15
%16 = phi i64 [ %17, %15 ], [ 0, %2 ]
%17 = add nuw nsw i64 %16, 1
%18 = getelementptr inbounds i32, i32* %5, i64 %17
%19 = tail call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %18)
%20 = load i32, i32* %18
%21 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 %17
store i32 %20, i32* %21
%22 = icmp sgt i32 %20, 0
br i1 %22, label %15, label %10
23: ; preds = %13, %34
%24 = phi i64 [ 0, %13 ], [ %28, %34 ]
%25 = getelementptr inbounds i32, i32* %5, i64 %24
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = add nuw nsw i64 %24, 1
%29 = trunc i64 %28 to i32
%30 = urem i32 %29, 5
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %23
%33 = tail call i32 @putchar(i32 10)
br label %34
34: ; preds = %23, %32
%35 = icmp eq i64 %28, %14
br i1 %35, label %38, label %23
36: ; preds = %10, %2
%37 = tail call i32 @putchar(i32 10)
br label %55
38: ; preds = %34
%39 = tail call i32 @putchar(i32 10)
br i1 %12, label %55, label %40
40: ; preds = %38
%41 = and i64 %17, 4294967295
br label %42
42: ; preds = %40, %53
%43 = phi i64 [ 0, %40 ], [ %47, %53 ]
%44 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = add nuw nsw i64 %43, 1
%48 = trunc i64 %47 to i32
%49 = urem i32 %48, 5
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %42
%52 = tail call i32 @putchar(i32 10)
br label %53
53: ; preds = %42, %51
%54 = icmp eq i64 %47, %41
br i1 %54, label %55, label %42
55: ; preds = %53, %36, %38
%56 = tail call i32 @putchar(i32 10)
br label %57
57: ; preds = %57, %55
%58 = phi i64 [ %63, %57 ], [ 0, %55 ]
%59 = getelementptr inbounds i32, i32* %5, i64 %58
%60 = tail call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %59)
%61 = load i64, i64* @EOF
%62 = icmp eq i64 %60, %61
%63 = add nuw i64 %58, 1
br i1 %62, label %64, label %57
64: ; preds = %57
%65 = trunc i64 %58 to i32
%66 = icmp eq i32 %65, 0
br i1 %66, label %82, label %67
67: ; preds = %64
%68 = and i64 %58, 4294967295
br label %69
69: ; preds = %67, %80
%70 = phi i64 [ 0, %67 ], [ %74, %80 ]
%71 = getelementptr inbounds i32, i32* %5, i64 %70
%72 = load i32, i32* %71
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %72)
%74 = add nuw nsw i64 %70, 1
%75 = trunc i64 %74 to i32
%76 = urem i32 %75, 5
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %69
%79 = tail call i32 @putchar(i32 10)
br label %80
80: ; preds = %69, %78
%81 = icmp eq i64 %74, %68
br i1 %81, label %82, label %69
82: ; preds = %80, %64
%83 = tail call i32 @free(i32* %5)
ret i32 0
}