int main(void) {
  int n, i, resul = 0;
  short int num;
  printf("Cantidad de numeros: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    do {
      printf("Numero: ");
      scanf("%hd", &num);
    } while (num == 0);
    resul = func_posneg(num);
    printf("%s\n\n", resul);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d8 <main+0xa8>
jmp    117e <main+0x4e>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x12(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movswl -0x12(%rbp),%eax
cmp    $0x0,%eax
je     117e <main+0x4e>
movswl -0x12(%rbp),%edi
mov    $0x0,%al
call   1040 <func_posneg@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116d <main+0x3d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d1 <main+0xa1>
mov    $0x1,%r13d
lea    0xea7(%rip),%r14
lea    0xea9(%rip),%r15
lea    0xa(%rsp),%rbx
lea    0xea1(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movswl 0xa(%rsp),%edi
test   %edi,%edi
je     1190 <main+0x60>
xor    %eax,%eax
call   1040 <func_posneg@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1(%r13),%eax
cmp    0xc(%rsp),%r13d
mov    %eax,%r13d
jl     1190 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Cantidad de numeros: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Numero: \00"
@.str.3 = [4 x i8] c"%hd\00"
@.str.4 = [5 x i8] c"%s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i16
store i32 0, i32* %1
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %29
12: ; preds = %8
br label %13
13: ; preds = %16, %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i16* %5)
br label %16
16: ; preds = %13
%17 = load i16, i16* %5
%18 = sext i16 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %13, label %20
20: ; preds = %16
%21 = load i16, i16* %5
%22 = sext i16 %21 to i32
%23 = call i32 (i32, ...) bitcast (i32 (...)* @func_posneg to i32 (i32, ...)*)(i32 %22)
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %20
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %8
29: ; preds = %8
ret i32 0
}

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