#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 y = 0;
  printf("Digite seu ano de nascimento (quatro digitos)\n");
  scanf("%d", &y);
  if (y > 9999 || y < 1000) {
    printf("Ano inválido");
  } else {
    int b = y % 100;
    int a = y / 100;
    int c = a + b;
    c %= 5;
    switch (c) {
    case 0:
      printf("Tímido\n");
      break;
    case 1:
      printf("Sonhador\n");
      break;
    case 2:
      printf("Paquerador\n");
      break;
    case 3:
      printf("Atraente\n");
      break;
    case 4:
      printf("Irresistível\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x270f,-0x8(%rbp)
jg     116c <main+0x4c>
cmpl   $0x3e8,-0x8(%rbp)
jge    117d <main+0x5d>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
jmp    1263 <main+0x143>
movslq -0x8(%rbp),%rcx
mov    %ecx,%eax
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
movslq -0x8(%rbp),%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
mov    %ecx,%eax
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x4,%rax
ja     125e <main+0x13e>
mov    -0x20(%rbp),%rax
lea    0xdfb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    125e <main+0x13e>
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
jmp    125e <main+0x13e>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    125e <main+0x13e>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    125e <main+0x13e>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
jmp    1263 <main+0x143>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x2710(%rax),%ecx
cmp    $0xffffdcd7,%ecx
ja     1176 <main+0x46>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
jmp    11e4 <main+0xb4>
movzwl %ax,%ecx
shr    $0x2,%ecx
imul   $0x147b,%ecx,%ecx
shr    $0x11,%ecx
imul   $0x64,%ecx,%edx
sub    %edx,%eax
add    %ecx,%eax
movzbl %al,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
cmp    $0x4,%al
ja     11e4 <main+0xb4>
movzbl %al,%eax
lea    0xe55(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec3(%rip),%rdi
jmp    11df <main+0xaf>
lea    0xeb1(%rip),%rdi
jmp    11df <main+0xaf>
lea    0xe9d(%rip),%rdi
jmp    11df <main+0xaf>
lea    0xe8b(%rip),%rdi
jmp    11df <main+0xaf>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Digite seu ano de nascimento (quatro digitos)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Ano inv\C3\A1lido\00"
@.str.3 = [9 x i8] c"T\C3\ADmido\0A\00"
@.str.4 = [10 x i8] c"Sonhador\0A\00"
@.str.5 = [12 x i8] c"Paquerador\0A\00"
@.str.6 = [10 x i8] c"Atraente\0A\00"
@.str.7 = [15 x i8] c"Irresist\C3\ADvel\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 9999
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %15
13: ; preds = %10, %0
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %37
15: ; preds = %10
%16 = load i32, i32* %2
%17 = srem i32 %16, 100
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = sdiv i32 %18, 100
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = srem i32 %23, 5
store i32 %24, i32* %5
%25 = load i32, i32* %5
switch i32 %25, label %36 [
i32 0, label %26
i32 1, label %28
i32 2, label %30
i32 3, label %32
i32 4, label %34
]
26: ; preds = %15
%27 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %36
28: ; preds = %15
%29 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %36
30: ; preds = %15
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %36
32: ; preds = %15
%33 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %36
34: ; preds = %15
%35 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %36
36: ; preds = %15, %34, %32, %30, %28, %26
br label %37
37: ; preds = %36, %13
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Ano inv\C3\A1lido\00"
@str = [46 x i8] c"Digite seu ano de nascimento (quatro digitos)\00"
@str.8 = [14 x i8] c"Irresist\C3\ADvel\00"
@str.9 = [9 x i8] c"Atraente\00"
@str.10 = [11 x i8] c"Paquerador\00"
@str.11 = [9 x i8] c"Sonhador\00"
@str.12 = [8 x i8] c"T\C3\ADmido\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -10000
%7 = icmp ult i32 %6, -9000
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %28
10: ; preds = %0
%11 = trunc i32 %5 to i16
%12 = urem i16 %11, 100
%13 = udiv i16 %11, 100
%14 = add nuw nsw i16 %13, %12
%15 = trunc i16 %14 to i8
%16 = urem i8 %15, 5
%17 = zext i8 %16 to i32
switch i32 %17, label %28 [
i32 0, label %18
i32 1, label %20
i32 2, label %22
i32 3, label %24
i32 4, label %26
]
18: ; preds = %10
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.12, i64 0, i64 0))
br label %28
20: ; preds = %10
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
br label %28
22: ; preds = %10
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.10, i64 0, i64 0))
br label %28
24: ; preds = %10
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
br label %28
26: ; preds = %10
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
br label %28
28: ; preds = %18, %20, %22, %24, %26, %10, %8
ret i32 0
}