#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_last_digit(int *);
int is_correct_input(char *);
int is_correct_length(char *);
int is_correct_start_number(char *);
int /*<<< orphan*/ parse_to_int(char *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ publishing_house(int *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char isbn_number[20] = {0};
  int parsed_isbn_number[20] = {0};
  scanf("%s", isbn_number);
  if (is_correct_input(isbn_number) == 1 &&
      is_correct_length(isbn_number) == 1 &&
      is_correct_start_number(isbn_number) == 1) {
    parse_to_int(isbn_number, parsed_isbn_number);
    if (check_last_digit(parsed_isbn_number) == 1) {
      printf("1\n");
      publishing_house(parsed_isbn_number);
      return 0;
    }
  }
  printf("0\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1070 <memset@plt>
lea    -0x20(%rbp),%rsi
lea    0xe36(%rip),%rdi
call   10a0 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1060 <is_correct_input@plt>
cmp    $0x1,%eax
jne    124a <main+0xba>
lea    -0x20(%rbp),%rdi
call   10b0 <is_correct_length@plt>
cmp    $0x1,%eax
jne    124a <main+0xba>
lea    -0x20(%rbp),%rdi
call   1030 <is_correct_start_number@plt>
cmp    $0x1,%eax
jne    124a <main+0xba>
lea    -0x20(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <parse_to_int@plt>
lea    -0x70(%rbp),%rdi
call   1090 <check_last_digit@plt>
cmp    $0x1,%eax
jne    1245 <main+0xb5>
lea    0xdd8(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1080 <publishing_house@plt>
movl   $0x0,-0x4(%rbp)
jmp    125d <main+0xcd>
jmp    124a <main+0xba>
lea    0xdb5(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
lea    0xe4c(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    %rbx,%rdi
call   1060 <is_correct_input@plt>
cmp    $0x1,%eax
jne    121b <main+0x9b>
mov    %rsp,%rdi
call   10a0 <is_correct_length@plt>
cmp    $0x1,%eax
jne    121b <main+0x9b>
mov    %rsp,%rdi
call   1030 <is_correct_start_number@plt>
cmp    $0x1,%eax
jne    121b <main+0x9b>
mov    %rsp,%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <parse_to_int@plt>
mov    %rbx,%rdi
call   1080 <check_last_digit@plt>
cmp    $0x1,%eax
jne    121b <main+0x9b>
lea    0xdfb(%rip),%rdi
call   1050 <puts@plt>
lea    0x20(%rsp),%rdi
call   1070 <publishing_house@plt>
jmp    1227 <main+0xa7>
lea    0xde1(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"1\0A\00"
@.str.2 = [3 x i8] c"0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i32]
store i32 0, i32* %1
%4 = bitcast [20 x i8]* %2 to i8*
%5 = bitcast [20 x i32]* %3 to i8*
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = call i32 @is_correct_input(i8* %8)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %31
11: ; preds = %0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%13 = call i32 @is_correct_length(i8* %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%17 = call i32 @is_correct_start_number(i8* %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %31
19: ; preds = %15
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%22 = call i32 @parse_to_int(i8* %20, i32* %21)
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%24 = call i32 @check_last_digit(i32* %23)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %30
26: ; preds = %19
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%29 = call i32 @publishing_house(i32* %28)
store i32 0, i32* %1
br label %33
30: ; preds = %19
br label %31
31: ; preds = %30, %15, %11, %0
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %33
33: ; preds = %31, %26
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@str = [2 x i8] c"0\00"
@str.3 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i32]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = bitcast [20 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @is_correct_input(i8* %3)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %22
8: ; preds = %0
%9 = call i32 @is_correct_length(i8* %3)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = call i32 @is_correct_start_number(i8* %3)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%16 = call i32 @parse_to_int(i8* %3, i32* %15)
%17 = call i32 @check_last_digit(i32* %15)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%21 = call i32 @publishing_house(i32* %15)
br label %24
22: ; preds = %14, %11, %8, %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
ret i32 0
}