#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 *);
main() {
  int dd, mm, aaaa, ddo, resto, tarot;
  printf("Si tecleas tu fecha de nacimiento, te calculo tu número de Tarot\n");
  do {
    printf("Día:  ");
    scanf("%d", &dd);
  } while (dd < 1 || dd > 31);
  do {
    printf("Mes:  ");
    scanf("%d", &mm);
  } while (mm < 1 || mm > 12);
  do {
    printf("Año:  ");
    scanf("%d", &aaaa);
  } while (aaaa < 0 || aaaa > 9000);
  tarot = dd + mm + aaaa;
  while (tarot > 9) {
    ddo = tarot;
    tarot = 0;
    do {
      resto = ddo % 10;
      tarot += resto;
      ddo = ddo / 10;
    } while (ddo != 0);
  }
  printf("\nSu número de Tarot es: %d\n", tarot);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
jl     1174 <main+0x54>
cmpl   $0x1f,-0x8(%rbp)
setg   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    113d <main+0x1d>
jmp    1184 <main+0x64>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x1e(%rbp)
jl     11bb <main+0x9b>
cmpl   $0xc,-0xc(%rbp)
setg   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
test   $0x1,%al
jne    1184 <main+0x64>
jmp    11cb <main+0xab>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x1f(%rbp)
jl     1205 <main+0xe5>
cmpl   $0x2328,-0x10(%rbp)
setg   %al
mov    %al,-0x1f(%rbp)
mov    -0x1f(%rbp),%al
test   $0x1,%al
jne    11cb <main+0xab>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jle    1267 <main+0x147>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1233 <main+0x113>
jmp    121c <main+0xfc>
mov    -0x1c(%rbp),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%r14
lea    0xeb5(%rip),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffffe0,%eax
cmp    $0xffffffe1,%eax
jb     1160 <main+0x30>
lea    0xe83(%rip),%r14
lea    0xe79(%rip),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff3,%eax
cmp    $0xfffffff4,%eax
jb     11a0 <main+0x70>
lea    0xe4a(%rip),%r14
lea    0xe39(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x2328,%eax
ja     11e0 <main+0xb0>
add    0x8(%rsp),%eax
add    0x4(%rsp),%eax
cmp    $0xa,%eax
jl     124d <main+0x11d>
xor    %ecx,%ecx
nop
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %ecx,%esi
add    %edi,%esi
add    $0x9,%edx
mov    %esi,%ecx
cmp    $0x13,%edx
jae    1210 <main+0xe0>
mov    %esi,%eax
mov    $0x0,%ecx
cmp    $0xa,%esi
jge    1210 <main+0xe0>
jmp    124f <main+0x11f>
mov    %eax,%esi
lea    0xdc4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [67 x i8] c"Si tecleas tu fecha de nacimiento, te calculo tu n\C3\BAmero de Tarot\0A\00"
@.str.1 = [8 x i8] c"D\C3\ADa: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"Mes: \00"
@.str.4 = [8 x i8] c"A\C3\B1o: \00"
@.str.5 = [29 x i8] c"\0ASu n\C3\BAmero de Tarot es: %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 i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %18, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 1
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 31
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ true, %12 ], [ %17, %15 ]
br i1 %19, label %9, label %20
20: ; preds = %18
br label %21
21: ; preds = %30, %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %24
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 1
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp sgt i32 %28, 12
br label %30
30: ; preds = %27, %24
%31 = phi i1 [ true, %24 ], [ %29, %27 ]
br i1 %31, label %21, label %32
32: ; preds = %30
br label %33
33: ; preds = %42, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
br label %36
36: ; preds = %33
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i32, i32* %4
%41 = icmp sgt i32 %40, 9000
br label %42
42: ; preds = %39, %36
%43 = phi i1 [ true, %36 ], [ %41, %39 ]
br i1 %43, label %33, label %44
44: ; preds = %42
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = add nsw i32 %45, %46
%48 = load i32, i32* %4
%49 = add nsw i32 %47, %48
store i32 %49, i32* %7
br label %50
50: ; preds = %66, %44
%51 = load i32, i32* %7
%52 = icmp sgt i32 %51, 9
br i1 %52, label %53, label %67
53: ; preds = %50
%54 = load i32, i32* %7
store i32 %54, i32* %5
store i32 0, i32* %7
br label %55
55: ; preds = %63, %53
%56 = load i32, i32* %5
%57 = srem i32 %56, 10
store i32 %57, i32* %6
%58 = load i32, i32* %6
%59 = load i32, i32* %7
%60 = add nsw i32 %59, %58
store i32 %60, i32* %7
%61 = load i32, i32* %5
%62 = sdiv i32 %61, 10
store i32 %62, i32* %5
br label %63
63: ; preds = %55
%64 = load i32, i32* %5
%65 = icmp ne i32 %64, 0
br i1 %65, label %55, label %66
66: ; preds = %63
br label %50
67: ; preds = %50
%68 = load i32, i32* %7
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"D\C3\ADa: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"Mes: \00"
@.str.4 = [8 x i8] c"A\C3\B1o: \00"
@.str.5 = [29 x i8] c"\0ASu n\C3\BAmero de Tarot es: %d\0A\00"
@str = [66 x i8] c"Si tecleas tu fecha de nacimiento, te calculo tu n\C3\BAmero de Tarot\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %8, %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = add i32 %11, -32
%13 = icmp ult i32 %12, -31
br i1 %13, label %8, label %14
14: ; preds = %8, %14
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = add i32 %17, -13
%19 = icmp ult i32 %18, -12
br i1 %19, label %14, label %20
20: ; preds = %14, %20
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%23 = load i32, i32* %3
%24 = icmp ugt i32 %23, 9000
br i1 %24, label %20, label %25
25: ; preds = %20
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = add i32 %26, %23
%29 = add i32 %28, %27
%30 = icmp sgt i32 %29, 9
br i1 %30, label %33, label %44
31: ; preds = %33
%32 = icmp sgt i32 %37, 9
br i1 %32, label %41, label %44
33: ; preds = %25, %41
%34 = phi i32 [ %42, %41 ], [ %29, %25 ]
%35 = phi i32 [ %43, %41 ], [ 0, %25 ]
%36 = srem i32 %34, 10
%37 = add nsw i32 %35, %36
%38 = sdiv i32 %34, 10
%39 = add i32 %34, 9
%40 = icmp ult i32 %39, 19
br i1 %40, label %31, label %41
41: ; preds = %33, %31
%42 = phi i32 [ %38, %33 ], [ %37, %31 ]
%43 = phi i32 [ %37, %33 ], [ 0, %31 ]
br label %33
44: ; preds = %31, %25
%45 = phi i32 [ %29, %25 ], [ %37, %31 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %45)
ret i32 0
}