#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n[100000];
  int c1 = 0;
  int c2 = 0;
  do {
    scanf("%d", &n[c1]);
    c1++;
  } while (n[c1 - 1] != 42);
  for (c2 = 0; c2 < c1 - 1; c2++) {
    printf("%d\n", n[c2]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x61a94(%rbp)
movl   $0x0,-0x61a98(%rbp)
movslq -0x61a94(%rbp),%rax
lea    -0x61a90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9e(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x61a94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a94(%rbp)
mov    -0x61a94(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0x2a,-0x61a90(%rbp,%rax,4)
2a
jne    1146 <main+0x26>
movl   $0x0,-0x61a98(%rbp)
mov    -0x61a98(%rbp),%eax
mov    -0x61a94(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11de <main+0xbe>
movslq -0x61a98(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x61a98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a98(%rbp)
jmp    1199 <main+0x79>
xor    %eax,%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x61a80,%rsp
mov    $0xffffffff,%ebp
mov    %rsp,%rbx
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%ebp
cmpl   $0x2a,(%rbx)
lea    0x4(%rbx),%rbx
jne    1140 <main+0x20>
test   %ebp,%ebp
je     1184 <main+0x64>
mov    %ebp,%ebp
xor    %ebx,%ebx
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x61a80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100000 x i32]
%2 = bitcast [100000 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %7, %3 ], [ 0, %0 ]
%5 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = add nuw i64 %4, 1
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 42
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = trunc i64 %4 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = and i64 %4, 4294967295
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %20, %15 ]
%17 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = add nuw nsw i64 %16, 1
%21 = icmp eq i64 %20, %14
br i1 %21, label %22, label %15
22: ; preds = %15, %10
ret i32 0
}