#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 *);
void ex2() {
  int idade[3] = {1, 0, 0};
  while (idade[0] > 0) {
    printf("Digite a idade da pessoa, para sair digite 0: ");
    scanf("%d", &idade[0]);
    if (idade[0] < 21 && idade[0] > 0)
      idade[1]++;
    if (idade[0] > 50)
      idade[2]++;
  }
  printf("Menos de 21: %d.\nMais de 50: %d.", idade[1], idade[2]);
}


x86 assembly (clang, -O0):
<ex2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1199 <ex2+0x79>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xedc(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x15,-0xc(%rbp)
jge    1181 <ex2+0x61>
cmpl   $0x0,-0xc(%rbp)
jle    1181 <ex2+0x61>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x32,-0xc(%rbp)
jle    1194 <ex2+0x74>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113c <ex2+0x1c>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0xed5(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xec2(%rip),%rax
mov    %rax,(%rsp)
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
lea    0xeb9(%rip),%r14
lea    0xee1(%rip),%r15
mov    %rsp,%rbx
jmp    1167 <ex2+0x47>
nop
addl   $0x1,(%rcx)
test   %eax,%eax
jle    1194 <ex2+0x74>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
lea    -0x1(%rax),%edx
mov    %r13,%rcx
cmp    $0x14,%edx
jb     1160 <ex2+0x40>
mov    %r12,%rcx
cmp    $0x33,%eax
jge    1160 <ex2+0x40>
jmp    1163 <ex2+0x43>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.ex2.idade = [3 x i32] [i32 1, i32 0, i32 0]
@.str = [47 x i8] c"Digite a idade da pessoa, para sair digite 0: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Menos de 21: %d.\0AMais de 50: %d.\00"
define void @ex2() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
br label %3
3: ; preds = %30, %0
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %31
7: ; preds = %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 21
br i1 %13, label %14, label %22
14: ; preds = %7
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%16 = load i32, i32* %15
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%20 = load i32, i32* %19
%21 = add nsw i32 %20, 1
store i32 %21, i32* %19
br label %22
22: ; preds = %18, %14, %7
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%24 = load i32, i32* %23
%25 = icmp sgt i32 %24, 50
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%28 = load i32, i32* %27
%29 = add nsw i32 %28, 1
store i32 %29, i32* %27
br label %30
30: ; preds = %26, %22
br label %3
31: ; preds = %3
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%33 = load i32, i32* %32
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %35)
ret void
}

LLVM IR (-O2):
@__const.ex2.idade = [3 x i32] [i32 1, i32 0, i32 0]
@.str = [47 x i8] c"Digite a idade da pessoa, para sair digite 0: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Menos de 21: %d.\0AMais de 50: %d.\00"
define void @ex2() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
br label %6
6: ; preds = %0, %18
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 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 = add i32 %9, -1
%11 = icmp ult i32 %10, 20
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = icmp sgt i32 %9, 50
br i1 %13, label %14, label %18
14: ; preds = %12, %6
%15 = phi i32* [ %5, %6 ], [ %4, %12 ]
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %15
br label %18
18: ; preds = %14, %12
%19 = icmp sgt i32 %9, 0
br i1 %19, label %6, label %20
20: ; preds = %18
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
ret void
}