#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__ getsize(int);
int /*<<< orphan*/ is_isbn(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *, int *);
int main() {
  int isbn[5];
  scanf("%d-%d-%d-%d-%d", &isbn[0], &isbn[1], &isbn[2], &isbn[3], &isbn[4]);
  int sum = 0;
  for (int i = 0; i <= 4; i++) {
    sum += getsize(isbn[i]);
  }
  if (sum != 13 && !is_isbn(isbn)) {
    printf("0");
    return 0;
  }
  printf("1\n");
  if (isbn[0] == 978 || isbn[1] == 979) {
    switch (isbn[2]) {
    case 1:
      printf("Pyramid Books");
    case 4210:
      printf("FUNimation Productions, Ltd.");
      break;
    case 55583:
      printf("Alyson Books");
      break;
    case 933346:
      printf("Bluebridge");
      break;
    }
  } else {
    printf("0");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
lea    -0x20(%rbp),%r8
add    $0xc,%r8
lea    -0x20(%rbp),%r9
add    $0x10,%r9
lea    0xe86(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jg     11bf <main+0x7f>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1060 <getsize@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    118d <main+0x4d>
cmpl   $0xd,-0x24(%rbp)
je     11f3 <main+0xb3>
lea    -0x20(%rbp),%rdi
call   1040 <is_isbn@plt>
cmp    $0x0,%eax
jne    11f3 <main+0xb3>
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <main+0x178>
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3d2,-0x20(%rbp)
je     1219 <main+0xd9>
cmpl   $0x3d3,-0x1c(%rbp)
jne    12a5 <main+0x165>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x1,%eax
je     1266 <main+0x126>
jmp    122d <main+0xed>
mov    -0x2c(%rbp),%eax
sub    $0x1072,%eax
je     1272 <main+0x132>
jmp    1240 <main+0x100>
mov    -0x2c(%rbp),%eax
sub    $0xd91f,%eax
je     1283 <main+0x143>
jmp    1253 <main+0x113>
mov    -0x2c(%rbp),%eax
sub    $0xe3de2,%eax
je     1294 <main+0x154>
jmp    12a0 <main+0x160>
lea    0xda7(%rip),%rdi
call   1030 <printf@plt>
lea    0xda9(%rip),%rdi
call   1030 <printf@plt>
jmp    12a0 <main+0x160>
lea    0xdb5(%rip),%rdi
call   1030 <printf@plt>
jmp    12a0 <main+0x160>
lea    0xdb1(%rip),%rdi
call   1030 <printf@plt>
jmp    12b1 <main+0x171>
lea    0xd63(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x10(%rsp),%r9
lea    0xe7e(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
mov    (%rsp),%edi
call   1080 <getsize@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edi
call   1080 <getsize@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    0x8(%rsp),%edi
call   1080 <getsize@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    0xc(%rsp),%edi
call   1080 <getsize@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    0x10(%rsp),%edi
call   1080 <getsize@plt>
add    %ebx,%eax
cmp    $0xd,%eax
je     11de <main+0x7e>
mov    %rsp,%rdi
call   1060 <is_isbn@plt>
test   %eax,%eax
je     11fd <main+0x9d>
lea    0xe6d(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x3d2,(%rsp)
je     1209 <main+0xa9>
cmpl   $0x3d3,0x4(%rsp)
je     1209 <main+0xa9>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    125a <main+0xfa>
mov    0x8(%rsp),%eax
cmp    $0xd91e,%eax
jg     1222 <main+0xc2>
cmp    $0x1,%eax
je     1239 <main+0xd9>
cmp    $0x1072,%eax
je     1245 <main+0xe5>
jmp    125a <main+0xfa>
cmp    $0xd91f,%eax
je     124e <main+0xee>
cmp    $0xe3de2,%eax
jne    125a <main+0xfa>
lea    0xe10(%rip),%rdi
jmp    1255 <main+0xf5>
lea    0xdcf(%rip),%rdi
call   1050 <printf@plt>
lea    0xdd1(%rip),%rdi
jmp    1255 <main+0xf5>
lea    0xde5(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%d-%d-%d-%d-%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"1\0A\00"
@.str.3 = [14 x i8] c"Pyramid Books\00"
@.str.4 = [29 x i8] c"FUNimation Productions, Ltd.\00"
@.str.5 = [13 x i8] c"Alyson Books\00"
@.str.6 = [11 x i8] c"Bluebridge\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
%10 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8, i32* %9)
store i32 0, i32* %3
store i32 0, i32* %4
br label %11
11: ; preds = %24, %0
%12 = load i32, i32* %4
%13 = icmp sle i32 %12, 4
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i64 @getsize(i32 %18)
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = add nsw i64 %21, %19
%23 = trunc i64 %22 to i32
store i32 %23, i32* %3
br label %24
24: ; preds = %14
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %11
27: ; preds = %11
%28 = load i32, i32* %3
%29 = icmp ne i32 %28, 13
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%32 = call i32 @is_isbn(i32* %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = 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 %60
36: ; preds = %30, %27
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 978
br i1 %40, label %45, label %41
41: ; preds = %36
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 979
br i1 %44, label %45, label %57
45: ; preds = %41, %36
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%47 = load i32, i32* %46
switch i32 %47, label %56 [
i32 1, label %48
i32 4210, label %50
i32 55583, label %52
i32 933346, label %54
]
48: ; preds = %45
%49 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %45, %48
%51 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %56
52: ; preds = %45
%53 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %56
54: ; preds = %45
%55 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %45, %54, %52, %50
br label %59
57: ; preds = %41
%58 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %59
59: ; preds = %57, %56
store i32 0, i32* %1
br label %60
60: ; preds = %59, %34
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d-%d-%d-%d-%d\00"
@.str.3 = [14 x i8] c"Pyramid Books\00"
@.str.4 = [29 x i8] c"FUNimation Productions, Ltd.\00"
@.str.5 = [13 x i8] c"Alyson Books\00"
@.str.6 = [11 x i8] c"Bluebridge\00"
@str = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%8 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7)
%9 = load i32, i32* %3
%10 = call i64 @getsize(i32 %9)
%11 = trunc i64 %10 to i32
%12 = load i32, i32* %4
%13 = call i64 @getsize(i32 %12)
%14 = trunc i64 %13 to i32
%15 = add i32 %11, %14
%16 = load i32, i32* %5
%17 = call i64 @getsize(i32 %16)
%18 = trunc i64 %17 to i32
%19 = add i32 %15, %18
%20 = load i32, i32* %6
%21 = call i64 @getsize(i32 %20)
%22 = trunc i64 %21 to i32
%23 = add i32 %19, %22
%24 = load i32, i32* %7
%25 = call i64 @getsize(i32 %24)
%26 = trunc i64 %25 to i32
%27 = add i32 %23, %26
%28 = icmp eq i32 %27, 13
br i1 %28, label %34, label %29
29: ; preds = %0
%30 = call i32 @is_isbn(i32* %3)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @putchar(i32 48)
br label %53
34: ; preds = %29, %0
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%36 = load i32, i32* %3
%37 = icmp eq i32 %36, 978
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 979
%40 = select i1 %37, i1 true, i1 %39
br i1 %40, label %41, label %51
41: ; preds = %34
%42 = load i32, i32* %5
switch i32 %42, label %53 [
i32 1, label %43
i32 4210, label %45
i32 55583, label %47
i32 933346, label %49
]
43: ; preds = %41
%44 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %41, %43
%46 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %53
47: ; preds = %41
%48 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %53
49: ; preds = %41
%50 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %53
51: ; preds = %34
%52 = call i32 @putchar(i32 48)
br label %53
53: ; preds = %51, %41, %49, %47, %45, %32
ret i32 0
}