#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 /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int pos[3], neg[3], posCount = 0, negCount = 0;
  for (int i = 0; i < 3; i++) {
    int valor;
    printf("Informe um valor: ");
    scanf("%d", &valor);
    if (valor < 0)
      neg[negCount++] = valor;
    else
      pos[posCount++] = valor;
  }
  printf("Os números positivos digitados foram: ");
  for (int i = 0; i < posCount; i++)
    printf("%d ", pos[i]);
  printf("\nOs números negativos digitados foram: ");
  for (int i = 0; i < negCount; i++)
    printf("%d ", neg[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jge    11b6 <main+0x96>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x2c(%rbp)
jge    118f <main+0x6f>
mov    -0x2c(%rbp),%ecx
mov    -0x24(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cltq
mov    %ecx,-0x1c(%rbp,%rax,4)
jmp    11a3 <main+0x83>
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
cltq
mov    %ecx,-0x10(%rbp,%rax,4)
jmp    11a8 <main+0x88>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1144 <main+0x24>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11fb <main+0xdb>
movslq -0x30(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11cb <main+0xab>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1240 <main+0x120>
movslq -0x34(%rbp),%rax
mov    -0x1c(%rbp,%rax,4),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1210 <main+0xf0>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xece(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     1160 <main+0x40>
mov    %eax,0x1c(%rsp)
mov    $0x1,%ebx
jmp    116c <main+0x4c>
mov    %eax,0x10(%rsp)
mov    $0x1,%r14d
xor    %ebx,%ebx
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     11a1 <main+0x81>
mov    %ebx,%edx
lea    0x1(%rbx),%esi
lea    0x1c(%rsp),%rcx
mov    %esi,%ebx
jmp    11b0 <main+0x90>
mov    %r14d,%edx
lea    0x1(%r14),%esi
lea    0x10(%rsp),%rcx
mov    %esi,%r14d
mov    %edx,%edx
mov    %eax,(%rcx,%rdx,4)
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     11f5 <main+0xd5>
mov    %ebx,%ecx
add    $0x1,%ebx
mov    %eax,0x1c(%rsp,%rcx,4)
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
mov    %r14d,%ecx
add    $0x1,%r14d
mov    %eax,0x10(%rsp,%rcx,4)
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     124c <main+0x12c>
mov    %ebx,%r12d
lea    0xe22(%rip),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x1c(%rsp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1220 <main+0x100>
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r14d,%r14d
jg     125a <main+0x13a>
jmp    1287 <main+0x167>
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%r15d
lea    0xdda(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1270 <main+0x150>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Informe um valor: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [40 x i8] c"Os n\C3\BAmeros positivos digitados foram: \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [41 x i8] c"\0AOs n\C3\BAmeros negativos digitados foram: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %10
10: ; preds = %31, %0
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %34
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i32, i32* %7
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %22
store i32 %19, i32* %23
br label %30
24: ; preds = %13
%25 = load i32, i32* %7
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %28
store i32 %25, i32* %29
br label %30
30: ; preds = %24, %18
br label %31
31: ; preds = %30
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %10
34: ; preds = %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %36
36: ; preds = %46, %34
%37 = load i32, i32* %8
%38 = load i32, i32* %4
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %49
40: ; preds = %36
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %36
49: ; preds = %36
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %9
br label %51
51: ; preds = %61, %49
%52 = load i32, i32* %9
%53 = load i32, i32* %5
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %64
55: ; preds = %51
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %55
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
br label %51
64: ; preds = %51
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
@.str = [19 x i8] c"Informe um valor: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [40 x i8] c"Os n\C3\BAmeros positivos digitados foram: \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [41 x i8] c"\0AOs n\C3\BAmeros negativos digitados foram: \00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = bitcast [3 x i32]* %1 to i8*
%5 = bitcast [3 x i32]* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 0
br i1 %10, label %15, label %17
11: ; preds = %41, %46
%12 = phi i32 [ %34, %41 ], [ %47, %46 ]
%13 = phi i32 [ %42, %41 ], [ %33, %46 ]
%14 = zext i32 %13 to i64
br label %60
15: ; preds = %0
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 %9, i32* %16
br label %19
17: ; preds = %0
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 %9, i32* %18
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ 0, %15 ], [ 1, %17 ]
%21 = phi i32 [ 1, %15 ], [ 0, %17 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %19
%27 = add nuw nsw i32 %20, 1
br label %30
28: ; preds = %19
%29 = add nuw nsw i32 %21, 1
br label %30
30: ; preds = %28, %26
%31 = phi i32 [ %21, %28 ], [ %20, %26 ]
%32 = phi [3 x i32]* [ %2, %28 ], [ %1, %26 ]
%33 = phi i32 [ %20, %28 ], [ %27, %26 ]
%34 = phi i32 [ %29, %28 ], [ %21, %26 ]
%35 = zext i32 %31 to i64
%36 = getelementptr inbounds [3 x i32], [3 x i32]* %32, i64 0, i64 %35
store i32 %24, i32* %36
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%39 = load i32, i32* %3
%40 = icmp slt i32 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %30
%42 = add nuw nsw i32 %33, 1
%43 = zext i32 %33 to i64
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %43
store i32 %39, i32* %44
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %11
46: ; preds = %30
%47 = add nuw nsw i32 %34, 1
%48 = zext i32 %34 to i64
%49 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %48
store i32 %39, i32* %49
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i32 %33, 0
br i1 %51, label %52, label %11
52: ; preds = %46
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
br label %57
54: ; preds = %60
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp sgt i32 %12, 0
br i1 %56, label %57, label %67
57: ; preds = %52, %54
%58 = phi i32 [ %47, %52 ], [ %12, %54 ]
%59 = zext i32 %58 to i64
br label %68
60: ; preds = %11, %60
%61 = phi i64 [ 0, %11 ], [ %65, %60 ]
%62 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = add nuw nsw i64 %61, 1
%66 = icmp eq i64 %65, %14
br i1 %66, label %54, label %60
67: ; preds = %68, %54
ret i32 0
68: ; preds = %57, %68
%69 = phi i64 [ 0, %57 ], [ %73, %68 ]
%70 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %71)
%73 = add nuw nsw i64 %69, 1
%74 = icmp eq i64 %73, %59
br i1 %74, label %67, label %68
}