#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 *, int *);
int main(void) {
  int dn, mn, an, da, ma, aa, anos, meses, dias;
  printf("Informe a data de nascimento dd/mm/aaaa: ");
  scanf("%d/%d/%d", &dn, &mn, &an);
  printf("Informe a data atual dd/mm/aaaa: ");
  scanf("%d/%d/%d", &da, &ma, &aa);
  anos = aa - an;
  if (ma >= mn) {
    meses = ma - mn;
  } else {
    int dif_ma = 12 - mn;
    anos -= 1;
    for (int i = 1; i <= ma + dif_ma; i++) {
      meses += 1;
    }
  }
  if (da >= dn) {
    dias = da - dn;
  } else {
    dias = dn - da;
  }
  printf("%d Dia(s), %d Mes(es), %d Ano(s)\n", dias, meses, anos);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     119e <main+0x7e>
mov    -0x18(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11e6 <main+0xc6>
mov    $0xc,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    -0x2c(%rbp),%ecx
cmp    %ecx,%eax
jg     11e1 <main+0xc1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b9 <main+0x99>
jmp    11e6 <main+0xc6>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1200 <main+0xe0>
mov    -0x14(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1209 <main+0xe9>
mov    -0x8(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef0(%rip),%rbx
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x10(%rsp),%esi
mov    0x1c(%rsp),%eax
mov    %esi,%edi
sub    %eax,%edi
neg    %edi
sub    %eax,%esi
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%edx
cmovl  %edi,%esi
sub    0x14(%rsp),%ecx
sub    0x18(%rsp),%edx
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Informe a data de nascimento dd/mm/aaaa: \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [34 x i8] c"Informe a data atual dd/mm/aaaa: \00"
@.str.3 = [34 x i8] c"%d Dia(s), %d Mes(es), %d Ano(s)\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
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%17 = load i32, i32* %7
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %8
%20 = load i32, i32* %6
%21 = load i32, i32* %3
%22 = icmp sge i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %0
%24 = load i32, i32* %6
%25 = load i32, i32* %3
%26 = sub nsw i32 %24, %25
store i32 %26, i32* %9
br label %45
27: ; preds = %0
%28 = load i32, i32* %3
%29 = sub nsw i32 12, %28
store i32 %29, i32* %11
%30 = load i32, i32* %8
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %8
store i32 1, i32* %12
br label %32
32: ; preds = %41, %27
%33 = load i32, i32* %12
%34 = load i32, i32* %6
%35 = load i32, i32* %11
%36 = add nsw i32 %34, %35
%37 = icmp sle i32 %33, %36
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %41
41: ; preds = %38
%42 = load i32, i32* %12
%43 = add nsw i32 %42, 1
store i32 %43, i32* %12
br label %32
44: ; preds = %32
br label %45
45: ; preds = %44, %23
%46 = load i32, i32* %5
%47 = load i32, i32* %2
%48 = icmp sge i32 %46, %47
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load i32, i32* %5
%51 = load i32, i32* %2
%52 = sub nsw i32 %50, %51
store i32 %52, i32* %10
br label %57
53: ; preds = %45
%54 = load i32, i32* %2
%55 = load i32, i32* %5
%56 = sub nsw i32 %54, %55
store i32 %56, i32* %10
br label %57
57: ; preds = %53, %49
%58 = load i32, i32* %10
%59 = load i32, i32* %9
%60 = load i32, i32* %8
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %58, i32 %59, i32 %60)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Informe a data de nascimento dd/mm/aaaa: \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [34 x i8] c"Informe a data atual dd/mm/aaaa: \00"
@.str.3 = [34 x i8] c"%d Dia(s), %d Mes(es), %d Ano(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%17 = load i32, i32* %6
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = load i32, i32* %5
%21 = load i32, i32* %2
%22 = icmp sge i32 %20, %21
%23 = sub nsw i32 %20, %21
%24 = load i32, i32* %4
%25 = load i32, i32* %1
%26 = icmp slt i32 %24, %25
%27 = sub nsw i32 %24, %25
%28 = sub nsw i32 %25, %24
%29 = select i1 %26, i32 %28, i32 %27
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %23, i32 %19)
ret i32 0
}