#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 fat(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int qtd;
  scanf("%d", &qtd);
  int v[qtd];
  int i = 0;
  int valor;
  while (i < qtd) {
    scanf("%d", &valor);
    if (valor < 0)
      v[i] = 0;
    else
      v[i] = fat(valor);
    i++;
  }
  for (i = 0; i < qtd; i++) {
    if (v[i] == 0)
      printf("erro");
    printf("%d\n", v[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11da <main+0xaa>
lea    0xe70(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
jge    11b7 <main+0x87>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    11cc <main+0x9c>
mov    -0x20(%rbp),%edi
call   1050 <fat@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117d <main+0x4d>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1234 <main+0x104>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    120d <main+0xdd>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e1 <main+0xb1>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    120e <main+0xde>
xor    %ebx,%ebx
lea    0xe80(%rip),%r14
lea    -0x30(%rbp),%r15
jmp    11a2 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jge    11c0 <main+0x90>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%edi
mov    $0x0,%eax
test   %edi,%edi
js     1190 <main+0x60>
call   1050 <fat@plt>
jmp    1190 <main+0x60>
test   %eax,%eax
jle    120e <main+0xde>
lea    0xe38(%rip),%r14
lea    0xe36(%rip),%r15
xor    %r12d,%r12d
jmp    11f9 <main+0xc9>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
cmp    %rax,%r12
jge    120e <main+0xde>
mov    0x0(%r13,%r12,4),%ebx
test   %ebx,%ebx
jne    11e0 <main+0xb0>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e0 <main+0xb0>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%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 = [5 x i8] c"erro\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i32, i64 %9
store i64 %9, i64* %4
store i32 0, i32* %5
br label %12
12: ; preds = %30, %0
%13 = load i32, i32* %5
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %11, i64 %22
store i32 0, i32* %23
br label %30
24: ; preds = %16
%25 = load i32, i32* %6
%26 = call i32 @fat(i32 %25)
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %11, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %24, %20
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %12
33: ; preds = %12
store i32 0, i32* %5
br label %34
34: ; preds = %52, %33
%35 = load i32, i32* %5
%36 = load i32, i32* %2
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %55
38: ; preds = %34
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %11, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %46
46: ; preds = %44, %38
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %11, i64 %48
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %34
55: ; preds = %34
store i32 0, i32* %1
%56 = load i8*, i8** %3
%57 = load i32, i32* %1
ret i32 %57
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"erro\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = bitcast i32* %2 to i8*
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %14, label %41
12: ; preds = %21
%13 = icmp sgt i32 %25, 0
br i1 %13, label %28, label %41
14: ; preds = %0, %21
%15 = phi i64 [ %24, %21 ], [ 0, %0 ]
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %14
%20 = call i32 @fat(i32 %17)
br label %21
21: ; preds = %14, %19
%22 = phi i32 [ %20, %19 ], [ 0, %14 ]
%23 = getelementptr inbounds i32, i32* %8, i64 %15
store i32 %22, i32* %23
%24 = add nuw nsw i64 %15, 1
%25 = load i32, i32* %1
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %14, label %12
28: ; preds = %12, %35
%29 = phi i64 [ %37, %35 ], [ 0, %12 ]
%30 = getelementptr inbounds i32, i32* %8, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %28
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%37 = add nuw nsw i64 %29, 1
%38 = load i32, i32* %1
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %28, label %41
41: ; preds = %35, %0, %12
ret i32 0
}