#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int bd, bm, by;
  printf("Enter your birth day (dd. mm. yy): ");
  scanf("%d %d %d", &bd, &bm, &by);
  int td, tm, ty;
  printf("\nEnter today's date (dd. mm. yy): ");
  scanf("%d %d %d", &td, &tm, &ty);
  int d, a = 0;
  if (td < bd) {
    d = 30 + td - bd + 1;
    a = -1;
  } else
    d = td - bd + 1;
  int m, b = 0;
  if (tm < bm) {
    m = 12 + tm - bm + a;
    b = -1;
  } else
    m = tm - bm + a;
  int y = ty - by + b;
  printf("\nYour age is (yy, mm, dd): %d. %d. %d\n", y, m, d);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b9 <main+0x89>
mov    -0x14(%rbp),%eax
add    $0x1e,%eax
sub    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
jmp    11c5 <main+0x95>
mov    -0x14(%rbp),%eax
sub    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f3 <main+0xc3>
mov    -0x18(%rbp),%eax
add    $0xc,%eax
sub    -0xc(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
jmp    11ff <main+0xcf>
mov    -0x18(%rbp),%eax
sub    -0xc(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x10(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rbx
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec5(%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),%eax
mov    0x1c(%rsp),%r8d
lea    0x1e(%rax),%ecx
xor    %edi,%edi
cmp    %r8d,%eax
setl   %dil
cmovge %eax,%ecx
mov    0xc(%rsp),%eax
mov    0x18(%rsp),%esi
lea    0xc(%rax),%edx
xor    %ebx,%ebx
cmp    %esi,%eax
setl   %bl
cmovge %eax,%edx
add    %esi,%edi
sub    %edi,%edx
sub    %r8d,%ecx
add    $0x1,%ecx
mov    0x8(%rsp),%esi
sub    0x14(%rsp),%esi
sub    %ebx,%esi
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter your birth day (dd. mm. yy): \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [35 x i8] c"\0AEnter today's date (dd. mm. yy): \00"
@.str.3 = [39 x i8] c"\0AYour age is (yy, mm, dd): %d. %d. %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
%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 ([36 x i8], [36 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 ([35 x i8], [35 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)
store i32 0, i32* %9
%17 = load i32, i32* %5
%18 = load i32, i32* %2
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %0
%21 = load i32, i32* %5
%22 = add nsw i32 30, %21
%23 = load i32, i32* %2
%24 = sub nsw i32 %22, %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
store i32 -1, i32* %9
br label %31
26: ; preds = %0
%27 = load i32, i32* %5
%28 = load i32, i32* %2
%29 = sub nsw i32 %27, %28
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %31
31: ; preds = %26, %20
store i32 0, i32* %11
%32 = load i32, i32* %6
%33 = load i32, i32* %3
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %42
35: ; preds = %31
%36 = load i32, i32* %6
%37 = add nsw i32 12, %36
%38 = load i32, i32* %3
%39 = sub nsw i32 %37, %38
%40 = load i32, i32* %9
%41 = add nsw i32 %39, %40
store i32 %41, i32* %10
store i32 -1, i32* %11
br label %48
42: ; preds = %31
%43 = load i32, i32* %6
%44 = load i32, i32* %3
%45 = sub nsw i32 %43, %44
%46 = load i32, i32* %9
%47 = add nsw i32 %45, %46
store i32 %47, i32* %10
br label %48
48: ; preds = %42, %35
%49 = load i32, i32* %7
%50 = load i32, i32* %4
%51 = sub nsw i32 %49, %50
%52 = load i32, i32* %11
%53 = add nsw i32 %51, %52
store i32 %53, i32* %12
%54 = load i32, i32* %12
%55 = load i32, i32* %10
%56 = load i32, i32* %8
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %54, i32 %55, i32 %56)
%58 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Enter your birth day (dd. mm. yy): \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [35 x i8] c"\0AEnter today's date (dd. mm. yy): \00"
@.str.3 = [39 x i8] c"\0AYour age is (yy, mm, dd): %d. %d. %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 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 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* %4
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
%20 = add nsw i32 %17, 30
%21 = sext i1 %19 to i32
%22 = select i1 %19, i32 %20, i32 %17
%23 = load i32, i32* %5
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
%26 = add nsw i32 %23, 12
%27 = select i1 %25, i32 %26, i32 %23
%28 = sext i1 %25 to i32
%29 = sub i32 %21, %24
%30 = add i32 %29, %27
%31 = sub i32 1, %18
%32 = add i32 %31, %22
%33 = load i32, i32* %6
%34 = load i32, i32* %3
%35 = sub i32 %33, %34
%36 = add nsw i32 %35, %28
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %36, i32 %30, i32 %32)
%38 = call i32 (...) @getch()
ret i32 0
}