#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 check_check_sum(char *);
int check_lenght_digits(char *);
int /*<<< orphan*/ check_publisher(char *);
int check_starting_digits(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int main() {
  char isbn[20];
  fgets(isbn, 20 + 1, stdin);
  if (check_lenght_digits(isbn) == 1) {
    if (check_starting_digits(isbn) == 1) {
      if (check_check_sum(isbn) == 1) {
        printf("1");
        check_publisher(isbn);
        return 0;
      } else {
        printf("0");
        return 0;
      }
    } else {
      printf("0");
      return 0;
    }
  } else {
    printf("0");
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    0x2e6e(%rip),%rax
mov    (%rax),%edx
mov    $0x15,%esi
call   1040 <fgets@plt>
lea    -0x20(%rbp),%rdi
call   1050 <check_lenght_digits@plt>
cmp    $0x1,%eax
jne    120d <main+0xad>
lea    -0x20(%rbp),%rdi
call   1070 <check_starting_digits@plt>
cmp    $0x1,%eax
jne    11f5 <main+0x95>
lea    -0x20(%rbp),%rdi
call   1080 <check_check_sum@plt>
cmp    $0x1,%eax
jne    11dd <main+0x7d>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1060 <check_publisher@plt>
movl   $0x0,-0x4(%rbp)
jmp    1220 <main+0xc0>
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1220 <main+0xc0>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1220 <main+0xc0>
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x15,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1050 <check_lenght_digits@plt>
cmp    $0x1,%eax
jne    11b9 <main+0x59>
mov    %rsp,%rdi
call   1070 <check_starting_digits@plt>
cmp    $0x1,%eax
jne    11b9 <main+0x59>
mov    %rsp,%rdi
call   1080 <check_check_sum@plt>
cmp    $0x1,%eax
jne    11b9 <main+0x59>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
call   1060 <check_publisher@plt>
jmp    11c3 <main+0x63>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 21, i32 %3)
%5 = call i32 @check_lenght_digits(i8* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %20
7: ; preds = %0
%8 = call i32 @check_starting_digits(i8* %2)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = call i32 @check_check_sum(i8* %2)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 @putchar(i32 49)
%15 = call i32 @check_publisher(i8* %2)
br label %22
16: ; preds = %10
%17 = call i32 @putchar(i32 48)
br label %22
18: ; preds = %7
%19 = call i32 @putchar(i32 48)
br label %22
20: ; preds = %0
%21 = call i32 @putchar(i32 48)
br label %22
22: ; preds = %20, %18, %16, %13
ret i32 0
}