#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*/ SEEK_END;
int controlDigit(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fseek(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ readPersnr(char *);
int /*<<< orphan*/ stdin;
int takeDay(char *);
int takeMonth(char *);
int takeYear(char *);
int main() {
  char person[11];
  char *pointer = person;
  int personal_number;
  int day;
  int month;
  int year;
  do {
    printf("Introduce a personal number!\n");
    readPersnr(pointer);
    personal_number = controlDigit(pointer);
    printf("Algorithm control %d\n", personal_number);
    printf("Real last digit %c\n", person[9]);
    if (personal_number == (person[9] - '0')) {
      year = takeYear(pointer);
      printf("The year of your birthday is: %d\n", year);
      month = takeMonth(pointer);
      printf("The month of your birthday is: %d\n", month);
      day = takeDay(pointer);
      printf("The day of your birthday is: %d\n", day);
    }
    fseek(stdin, 0, SEEK_END);
    fflush(stdin);
  } while (person[0] != 'q');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <readPersnr@plt>
mov    -0x18(%rbp),%rdi
call   1060 <controlDigit@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x6(%rbp),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
movsbl -0x6(%rbp),%ecx
sub    $0x30,%ecx
cmp    %ecx,%eax
jne    1246 <main+0xc6>
mov    -0x18(%rbp),%rdi
call   1090 <takeYear@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1080 <takeMonth@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <takeDay@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    0x2d92(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movsbl -0xf(%rbp),%eax
cmp    $0x71,%eax
jne    1197 <main+0x17>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xd(%rsp),%rbx
lea    0xe56(%rip),%r15
lea    0xe65(%rip),%r12
mov    0x2e28(%rip),%r13
mov    0x2e29(%rip),%r14
jmp    11f2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    (%r14),%edx
xor    %esi,%esi
call   1080 <fseek@plt>
mov    0x0(%r13),%edi
call   1060 <fflush@plt>
cmpb   $0x71,0xd(%rsp)
je     1284 <main+0xf4>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   10b0 <readPersnr@plt>
mov    %rbx,%rdi
call   1070 <controlDigit@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x16(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x16(%rsp),%eax
add    $0xffffffd0,%eax
cmp    %eax,%ebp
jne    11d0 <main+0x40>
mov    %rbx,%rdi
call   10a0 <takeYear@plt>
lea    0xde4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1090 <takeMonth@plt>
lea    0xdee(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <takeDay@plt>
lea    0xdf9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d0 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Introduce a personal number!\0A\00"
@.str.1 = [22 x i8] c"Algorithm control %d\0A\00"
@.str.2 = [20 x i8] c"Real last digit %c\0A\00"
@.str.3 = [34 x i8] c"The year of your birthday is: %d\0A\00"
@.str.4 = [35 x i8] c"The month of your birthday is: %d\0A\00"
@.str.5 = [33 x i8] c"The day of your birthday is: %d\0A\00"
@stdin = global i32 0
@SEEK_END = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
store i8* %8, i8** %3
br label %9
9: ; preds = %46, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %3
%12 = call i32 @readPersnr(i8* %11)
%13 = load i8*, i8** %3
%14 = call i32 @controlDigit(i8* %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 9
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %4
%22 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 9
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 48
%26 = icmp eq i32 %21, %25
br i1 %26, label %27, label %40
27: ; preds = %9
%28 = load i8*, i8** %3
%29 = call i32 @takeYear(i8* %28)
store i32 %29, i32* %7
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = load i8*, i8** %3
%33 = call i32 @takeMonth(i8* %32)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = load i8*, i8** %3
%37 = call i32 @takeDay(i8* %36)
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %27, %9
%41 = load i32, i32* @stdin
%42 = load i32, i32* @SEEK_END
%43 = call i32 @fseek(i32 %41, i32 0, i32 %42)
%44 = load i32, i32* @stdin
%45 = call i32 @fflush(i32 %44)
br label %46
46: ; preds = %40
%47 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp ne i32 %49, 113
br i1 %50, label %9, label %51
51: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Algorithm control %d\0A\00"
@.str.2 = [20 x i8] c"Real last digit %c\0A\00"
@.str.3 = [34 x i8] c"The year of your birthday is: %d\0A\00"
@.str.4 = [35 x i8] c"The month of your birthday is: %d\0A\00"
@.str.5 = [33 x i8] c"The day of your birthday is: %d\0A\00"
@stdin = global i32 0
@SEEK_END = global i32 0
@str = [29 x i8] c"Introduce a personal number!\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 9
br label %4
4: ; preds = %23, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%6 = call i32 @readPersnr(i8* %2)
%7 = call i32 @controlDigit(i8* %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = add nsw i32 %13, -48
%15 = icmp eq i32 %7, %14
br i1 %15, label %16, label %23
16: ; preds = %4
%17 = call i32 @takeYear(i8* %2)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = call i32 @takeMonth(i8* %2)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = call i32 @takeDay(i8* %2)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %16, %4
%24 = load i32, i32* @stdin
%25 = load i32, i32* @SEEK_END
%26 = call i32 @fseek(i32 %24, i32 0, i32 %25)
%27 = load i32, i32* @stdin
%28 = call i32 @fflush(i32 %27)
%29 = load i8, i8* %2
%30 = icmp eq i8 %29, 113
br i1 %30, label %31, label %4
31: ; preds = %23
ret i32 0
}