#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 */
scalar_t__ check_valid_birth_date(char *);
scalar_t__ check_valid_control_number(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char id[12];
  int valid_id = 0;
  fgets(id, 12, stdin);
  if (strlen(id) == 10) {
    if (check_valid_birth_date(id) && check_valid_control_number(id)) {
      valid_id = 1;
    }
  }
  printf("%d", valid_id);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%esi
call   1050 <fgets@plt>
lea    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
jne    11c1 <main+0x71>
lea    -0x10(%rbp),%rdi
call   1060 <check_valid_birth_date@plt>
cmp    $0x0,%rax
je     11bc <main+0x6c>
lea    -0x10(%rbp),%rdi
call   1070 <check_valid_control_number@plt>
cmp    $0x0,%rax
je     11bc <main+0x6c>
movl   $0x1,-0x14(%rbp)
jmp    11c1 <main+0x71>
mov    -0x14(%rbp),%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e8c(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %ebx,%ebx
cmp    $0xa,%eax
jne    11a0 <main+0x50>
lea    0x4(%rsp),%rdi
call   1060 <check_valid_birth_date@plt>
test   %rax,%rax
je     11a0 <main+0x50>
lea    0x4(%rsp),%rdi
call   1070 <check_valid_control_number@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
lea    0xe59(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 12, i32 %5)
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %20
10: ; preds = %0
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%12 = call i64 @check_valid_birth_date(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%16 = call i64 @check_valid_control_number(i8* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 1, i32* %3
br label %19
19: ; preds = %18, %14, %10
br label %20
20: ; preds = %19, %0
%21 = load i32, i32* %3
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 12, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = call i64 @check_valid_birth_date(i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = call i64 @check_valid_control_number(i8* %2)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %7, %0
%15 = phi i32 [ 0, %7 ], [ 0, %0 ], [ %13, %10 ]
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}