#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__ countDigits(int);
scalar_t__ isbn_check(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *, int *);
int main() {
  int nums[5];
  scanf("%d-%d-%d-%d-%d", &nums[0], &nums[1], &nums[2], &nums[3], &nums[4]);
  if (!(nums[0] == 978 || nums[0] == 979)) {
    printf("0");
    return 0;
  }
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += countDigits(nums[i]);
  }
  if (sum == 13 && isbn_check(nums)) {
    printf("1");
    switch (nums[2]) {
    case 933346:
      printf("\nBluebridge");
      break;
    case 55583:
      printf("\nAlyson Books");
      break;
    case 4210:
      printf("\nFUNimation Productions, Ltd.");
      break;
    case 01:
      printf("\nPyramid Books");
      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   1060 <scanf@plt>
cmpl   $0x3d2,-0x20(%rbp)
je     11b1 <main+0x71>
cmpl   $0x3d3,-0x20(%rbp)
je     11b1 <main+0x71>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12be <main+0x17e>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11f1 <main+0xb1>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1040 <countDigits@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    11bf <main+0x7f>
cmpl   $0xd,-0x24(%rbp)
jne    12ab <main+0x16b>
lea    -0x20(%rbp),%rdi
call   1050 <isbn_check@plt>
cmp    $0x0,%rax
je     12ab <main+0x16b>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x1,%eax
je     129a <main+0x15a>
jmp    122e <main+0xee>
mov    -0x2c(%rbp),%eax
sub    $0x1072,%eax
je     1289 <main+0x149>
jmp    1241 <main+0x101>
mov    -0x2c(%rbp),%eax
sub    $0xd91f,%eax
je     1278 <main+0x138>
jmp    1254 <main+0x114>
mov    -0x2c(%rbp),%eax
sub    $0xe3de2,%eax
jne    12a6 <main+0x166>
jmp    1267 <main+0x127>
lea    0xda5(%rip),%rdi
call   1030 <printf@plt>
jmp    12a6 <main+0x166>
lea    0xda0(%rip),%rdi
call   1030 <printf@plt>
jmp    12a6 <main+0x166>
lea    0xd9d(%rip),%rdi
call   1030 <printf@plt>
jmp    12a6 <main+0x166>
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
jmp    12b7 <main+0x177>
lea    0xd5d(%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    0xe8e(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
mov    (%rsp),%edi
mov    %edi,%eax
and    $0xfffffffe,%eax
cmp    $0x3d2,%eax
jne    120e <main+0xbe>
call   1050 <countDigits@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edi
call   1050 <countDigits@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    0x8(%rsp),%edi
call   1050 <countDigits@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    0xc(%rsp),%edi
call   1050 <countDigits@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    0x10(%rsp),%edi
call   1050 <countDigits@plt>
add    %ebx,%eax
cmp    $0xd,%eax
jne    120e <main+0xbe>
mov    %rsp,%rdi
call   1060 <isbn_check@plt>
test   %rax,%rax
je     120e <main+0xbe>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
cmp    $0xd91e,%eax
jg     1222 <main+0xd2>
cmp    $0x1,%eax
je     123e <main+0xee>
cmp    $0x1072,%eax
jne    1218 <main+0xc8>
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
jmp    1218 <main+0xc8>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
cmp    $0xd91f,%eax
je     124c <main+0xfc>
cmp    $0xe3de2,%eax
jne    1218 <main+0xc8>
lea    0xdd8(%rip),%rdi
call   1040 <printf@plt>
jmp    1218 <main+0xc8>
lea    0xe02(%rip),%rdi
call   1040 <printf@plt>
jmp    1218 <main+0xc8>
lea    0xdc8(%rip),%rdi
call   1040 <printf@plt>
jmp    1218 <main+0xc8>

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

LLVM IR (-O2):
@.str = [15 x i8] c"%d-%d-%d-%d-%d\00"
@.str.3 = [12 x i8] c"\0ABluebridge\00"
@.str.4 = [14 x i8] c"\0AAlyson Books\00"
@.str.5 = [30 x i8] c"\0AFUNimation Productions, Ltd.\00"
@.str.6 = [15 x i8] c"\0APyramid Books\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 = and i32 %9, -2
%11 = icmp eq i32 %10, 978
br i1 %11, label %12, label %32
12: ; preds = %0
%13 = call i64 @countDigits(i32 %9)
%14 = trunc i64 %13 to i32
%15 = load i32, i32* %4
%16 = call i64 @countDigits(i32 %15)
%17 = trunc i64 %16 to i32
%18 = add i32 %14, %17
%19 = load i32, i32* %5
%20 = call i64 @countDigits(i32 %19)
%21 = trunc i64 %20 to i32
%22 = add i32 %18, %21
%23 = load i32, i32* %6
%24 = call i64 @countDigits(i32 %23)
%25 = trunc i64 %24 to i32
%26 = add i32 %22, %25
%27 = load i32, i32* %7
%28 = call i64 @countDigits(i32 %27)
%29 = trunc i64 %28 to i32
%30 = add i32 %26, %29
%31 = icmp eq i32 %30, 13
br i1 %31, label %34, label %48
32: ; preds = %0
%33 = call i32 @putchar(i32 48)
br label %50
34: ; preds = %12
%35 = call i64 @isbn_check(i32* %3)
%36 = icmp eq i64 %35, 0
br i1 %36, label %48, label %37
37: ; preds = %34
%38 = call i32 @putchar(i32 49)
%39 = load i32, i32* %5
switch i32 %39, label %50 [
i32 933346, label %40
i32 55583, label %42
i32 4210, label %44
i32 1, label %46
]
40: ; preds = %37
%41 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %50
42: ; preds = %37
%43 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %50
44: ; preds = %37
%45 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %50
46: ; preds = %37
%47 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %50
48: ; preds = %34, %12
%49 = call i32 @putchar(i32 48)
br label %50
50: ; preds = %48, %37, %46, %44, %42, %40, %32
ret i32 0
}