#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_first3(char *);
int /*<<< orphan*/ check_publisher(char *);
scalar_t__ isbn13(int *);
scalar_t__ parse(char *, int *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char isbn[20];
  char publisher[10];
  int parsed[13] = {0};
  scanf("%s", isbn);
  if (strlen(isbn) != 17) {
    printf("0");
    return 0;
  }
  if (check_first3(isbn) == 0) {
    printf("0");
    return 0;
  }
  if (parse(isbn, parsed, publisher) == 0) {
    printf("0");
    return 0;
  }
  if (isbn13(parsed) == 0) {
    printf("0");
    return 0;
  }
  printf("1\n");
  check_publisher(publisher);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x34,%edx
call   1050 <memset@plt>
lea    -0x20(%rbp),%rsi
lea    0xe56(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x11,%eax
je     11d9 <main+0x59>
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127e <main+0xfe>
lea    -0x20(%rbp),%rdi
call   1090 <check_first3@plt>
cmp    $0x0,%rax
jne    1204 <main+0x84>
lea    0xe10(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127e <main+0xfe>
lea    -0x20(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x2a(%rbp),%rdx
call   10a0 <parse@plt>
cmp    $0x0,%rax
jne    1237 <main+0xb7>
lea    0xddd(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127e <main+0xfe>
lea    -0x60(%rbp),%rdi
call   1060 <isbn13@plt>
cmp    $0x0,%rax
jne    1262 <main+0xe2>
lea    0xdb2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127e <main+0xfe>
lea    0xd9c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x2a(%rbp),%rdi
call   1070 <check_publisher@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe5a(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x11,%eax
jne    120f <main+0x8f>
lea    0x10(%rsp),%rdi
call   1090 <check_first3@plt>
test   %rax,%rax
je     120f <main+0x8f>
lea    0x10(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x6(%rsp),%rdx
call   10a0 <parse@plt>
test   %rax,%rax
je     120f <main+0x8f>
lea    0x30(%rsp),%rdi
call   1060 <isbn13@plt>
test   %rax,%rax
je     120f <main+0x8f>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
lea    0x6(%rsp),%rdi
call   1070 <check_publisher@plt>
jmp    1219 <main+0x99>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [10 x i8]
%4 = alloca [13 x i32]
store i32 0, i32* %1
%5 = bitcast [13 x i32]* %4 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 @strlen(i8* %8)
%10 = icmp ne i32 %9, 17
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = 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 %37
13: ; preds = %0
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%15 = call i64 @check_first3(i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = 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 %37
19: ; preds = %13
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 0
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%23 = call i64 @parse(i8* %20, i32* %21, i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%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 %37
27: ; preds = %19
%28 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 0
%29 = call i64 @isbn13(i32* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = 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 %37
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%36 = call i32 @check_publisher(i8* %35)
store i32 0, i32* %1
br label %37
37: ; preds = %33, %31, %25, %17, %11
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@str = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [10 x i8]
%3 = alloca [13 x i32]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = bitcast [13 x i32]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i32 @strlen(i8* %4)
%9 = icmp eq i32 %8, 17
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @putchar(i32 48)
br label %31
12: ; preds = %0
%13 = call i64 @check_first3(i8* %4)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @putchar(i32 48)
br label %31
17: ; preds = %12
%18 = getelementptr inbounds [13 x i32], [13 x i32]* %3, i64 0, i64 0
%19 = call i64 @parse(i8* %4, i32* %18, i8* %5)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @putchar(i32 48)
br label %31
23: ; preds = %17
%24 = call i64 @isbn13(i32* %18)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @putchar(i32 48)
br label %31
28: ; preds = %23
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%30 = call i32 @check_publisher(i8* %5)
br label %31
31: ; preds = %28, %26, %21, %15, %10
ret i32 0
}