#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int num[100];
  int count = 0;
  int totalnums;
  do {
    printf("\nEntre com um numero (-999 p/terminar): ");
    scanf("%d", &num[count]);
    count++;
  } while (num[count - 1] != -999);
  totalnums = count - 1;
  printf("\n\n\n\t Os números que você digitou foram:\n\n");
  for (count = 0; count < totalnums; count++)
    printf(" %d", num[count]);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xee0(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0xfffffc19,-0x1a0(%rbp,%rax,4)
19 fc ff ff
jne    114c <main+0x1c>
mov    -0x1a4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    120f <main+0xdf>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11cd <main+0x9d>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    $0xffffffff,%ebp
mov    %rsp,%rbx
lea    0xea4(%rip),%r14
lea    0xec7(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%ebp
cmpl   $0xfffffc19,(%rbx)
lea    0x4(%rbx),%rbx
jne    1170 <main+0x30>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
je     11c6 <main+0x86>
mov    %ebp,%ebp
lea    0xe7c(%rip),%r14
xor    %ebx,%ebx
nop
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <main+0x70>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\0AEntre com um numero (-999 p/terminar): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"\0A\0A\0A\09 Os n\C3\BAmeros que voc\C3\AA digitou foram:\0A\0A\00"
@.str.3 = [4 x i8] c" %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %13, %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %8
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %5
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, -999
br i1 %19, label %5, label %20
20: ; preds = %13
%21 = load i32, i32* %3
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %24
24: ; preds = %34, %20
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %37
28: ; preds = %24
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %24
37: ; preds = %24
%38 = call i32 (...) @getch()
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [41 x i8] c"\0AEntre com um numero (-999 p/terminar): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c" %d\00"
@str = [43 x i8] c"\0A\0A\0A\09 Os n\C3\BAmeros que voc\C3\AA digitou foram:\0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %8, %3 ], [ 0, %0 ]
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = add nuw i64 %4, 1
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, -999
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = trunc i64 %4 to i32
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%14 = icmp eq i32 %12, 0
br i1 %14, label %24, label %15
15: ; preds = %11
%16 = and i64 %4, 4294967295
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %22, %17 ]
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i64 %18, 1
%23 = icmp eq i64 %22, %16
br i1 %23, label %24, label %17
24: ; preds = %17, %11
%25 = call i32 (...) @getch()
ret i32 0
}