#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 *, ...);
scalar_t__ strncasecmp(char *, char *);
int main() {
  int idade_entrada = 0;
  int idade = 0;
  int mulheres = 0;
  int homens = 0;
  int jovens = 0;
  char sexo[1];
  for (int i = 1; i <= 3; i++) {
    printf("Entre com a idade: ");
    scanf("%d", &idade_entrada);
    idade = idade_entrada;
    printf("Entre com o sexo: ");
    scanf("%s", &sexo);
    if (idade >= 0 && idade <= 80) {
      if (idade <= 21) {
        jovens = jovens + 1;
      }
      if (idade >= 40 && (strncasecmp("M", sexo) == 0)) {
        homens = homens + 1;
      }
      if (strncasecmp("F", sexo) == 0) {
        mulheres = mulheres + 1;
      }
    }
  }
  printf("Quantidade de Mulheres: %d \n", mulheres);
  printf("Quantidade de Homens: %d \n", homens);
  printf("Quantidade de Jovens: %d \n", jovens);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jg     1248 <main+0x118>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     1235 <main+0x105>
cmpl   $0x50,-0xc(%rbp)
jg     1235 <main+0x105>
cmpl   $0x15,-0xc(%rbp)
jg     11e0 <main+0xb0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x28,-0xc(%rbp)
jl     120d <main+0xdd>
lea    -0x19(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    120d <main+0xdd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    -0x19(%rbp),%rsi
lea    0xe17(%rip),%rdi
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1230 <main+0x100>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1235 <main+0x105>
jmp    123a <main+0x10a>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1169 <main+0x39>
mov    -0x10(%rbp),%esi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeba(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    $0x0,%r14d
mov    $0x0,%r15d
cmp    $0x50,%ebx
ja     11e2 <main+0xb2>
xor    %r15d,%r15d
cmp    $0x16,%ebx
setb   %bpl
xor    %r14d,%r14d
cmp    $0x28,%ebx
jb     11c5 <main+0x95>
lea    0xe7c(%rip),%rdi
lea    0x3(%rsp),%rsi
call   1040 <strncasecmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
sete   %r14b
mov    %bpl,%r15b
lea    0xe60(%rip),%rdi
lea    0x3(%rsp),%rsi
call   1040 <strncasecmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe1d(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe0e(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x50,%ebx
ja     126a <main+0x13a>
cmp    $0x16,%ebx
adc    $0x0,%r15d
cmp    $0x28,%ebx
jb     1252 <main+0x122>
lea    0xded(%rip),%rdi
lea    0x3(%rsp),%rsi
call   1040 <strncasecmp@plt>
cmp    $0x1,%rax
adc    $0x0,%r14d
lea    0xdd6(%rip),%rdi
lea    0x3(%rsp),%rsi
call   1040 <strncasecmp@plt>
cmp    $0x1,%rax
adc    $0x0,%ebp
lea    0xd8f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd95(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0xd81(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd86(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x50,%ebx
ja     12f2 <main+0x1c2>
cmp    $0x16,%ebx
adc    $0x0,%r15d
cmp    $0x28,%ebx
jb     12da <main+0x1aa>
lea    0xd65(%rip),%rdi
lea    0x3(%rsp),%rsi
call   1040 <strncasecmp@plt>
cmp    $0x1,%rax
adc    $0x0,%r14d
lea    0xd4e(%rip),%rdi
lea    0x3(%rsp),%rsi
call   1040 <strncasecmp@plt>
cmp    $0x1,%rax
adc    $0x0,%ebp
lea    0xd38(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd45(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd4f(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Entre com a idade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Entre com o sexo: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"M\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [29 x i8] c"Quantidade de Mulheres: %d \0A\00"
@.str.7 = [27 x i8] c"Quantidade de Homens: %d \0A\00"
@.str.8 = [27 x i8] c"Quantidade de Jovens: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [1 x i8]
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 1, i32* %8
br label %9
9: ; preds = %48, %0
%10 = load i32, i32* %8
%11 = icmp sle i32 %10, 3
br i1 %11, label %12, label %51
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
store i32 %15, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), [1 x i8]* %7)
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %47
20: ; preds = %12
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 80
br i1 %22, label %23, label %47
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp sle i32 %24, 21
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %29
29: ; preds = %26, %23
%30 = load i32, i32* %3
%31 = icmp sge i32 %30, 40
br i1 %31, label %32, label %39
32: ; preds = %29
%33 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
%34 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %33)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %39
39: ; preds = %36, %32, %29
%40 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
%41 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %46
46: ; preds = %43, %39
br label %47
47: ; preds = %46, %20, %12
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %9
51: ; preds = %9
%52 = load i32, i32* %4
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %5
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %6
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Entre com a idade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Entre com o sexo: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"M\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [29 x i8] c"Quantidade de Mulheres: %d \0A\00"
@.str.7 = [27 x i8] c"Quantidade de Homens: %d \0A\00"
@.str.8 = [27 x i8] c"Quantidade de Jovens: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), [1 x i8]* %2)
%10 = icmp ult i32 %7, 81
br i1 %10, label %11, label %24
11: ; preds = %0
%12 = icmp ult i32 %7, 22
%13 = zext i1 %12 to i32
%14 = icmp ugt i32 %7, 39
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %11
%20 = phi i32 [ 0, %11 ], [ %18, %15 ]
%21 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %19, %0
%25 = phi i32 [ 0, %0 ], [ %23, %19 ]
%26 = phi i32 [ 0, %0 ], [ %20, %19 ]
%27 = phi i32 [ 0, %0 ], [ %13, %19 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%30 = load i32, i32* %1
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), [1 x i8]* %2)
%33 = icmp ult i32 %30, 81
br i1 %33, label %34, label %50
34: ; preds = %24
%35 = icmp ult i32 %30, 22
%36 = zext i1 %35 to i32
%37 = add nuw nsw i32 %27, %36
%38 = icmp ugt i32 %30, 39
br i1 %38, label %39, label %44
39: ; preds = %34
%40 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
%43 = add nuw nsw i32 %26, %42
br label %44
44: ; preds = %39, %34
%45 = phi i32 [ %26, %34 ], [ %43, %39 ]
%46 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%47 = icmp eq i64 %46, 0
%48 = zext i1 %47 to i32
%49 = add nuw nsw i32 %25, %48
br label %50
50: ; preds = %44, %24
%51 = phi i32 [ %25, %24 ], [ %49, %44 ]
%52 = phi i32 [ %26, %24 ], [ %45, %44 ]
%53 = phi i32 [ %27, %24 ], [ %37, %44 ]
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%55 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%56 = load i32, i32* %1
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%58 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), [1 x i8]* %2)
%59 = icmp ult i32 %56, 81
br i1 %59, label %60, label %76
60: ; preds = %50
%61 = icmp ult i32 %56, 22
%62 = zext i1 %61 to i32
%63 = add nuw nsw i32 %53, %62
%64 = icmp ugt i32 %56, 39
br i1 %64, label %65, label %70
65: ; preds = %60
%66 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%67 = icmp eq i64 %66, 0
%68 = zext i1 %67 to i32
%69 = add nuw nsw i32 %52, %68
br label %70
70: ; preds = %65, %60
%71 = phi i32 [ %52, %60 ], [ %69, %65 ]
%72 = call i64 @strncasecmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%73 = icmp eq i64 %72, 0
%74 = zext i1 %73 to i32
%75 = add nuw nsw i32 %51, %74
br label %76
76: ; preds = %70, %50
%77 = phi i32 [ %51, %50 ], [ %75, %70 ]
%78 = phi i32 [ %52, %50 ], [ %71, %70 ]
%79 = phi i32 [ %53, %50 ], [ %63, %70 ]
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %77)
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %78)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %79)
ret i32 0
}