#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_ISBN(char *);
int check_phouse(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char ISBN[20];
  scanf("%s", ISBN);
  printf("%d\n", check_ISBN(ISBN));
  if (check_ISBN(ISBN)) {
    switch (check_phouse(ISBN)) {
    case 1:
      printf("Bluebridge\n");
      break;
    case 2:
      printf("Alyson Books\n");
      break;
    case 3:
      printf("FUNimation Productions, Ltd.\n");
      break;
    case 4:
      printf("Pyramid Books\n");
      break;
    default:
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <check_ISBN@plt>
mov    %eax,%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <check_ISBN@plt>
cmp    $0x0,%eax
je     120f <main+0xcf>
lea    -0x20(%rbp),%rdi
call   1030 <check_phouse@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     1205 <main+0xc5>
mov    -0x28(%rbp),%rax
lea    0xe50(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120a <main+0xca>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120a <main+0xca>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120a <main+0xca>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120a <main+0xca>
jmp    120a <main+0xca>
jmp    120f <main+0xcf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xea4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1060 <check_ISBN@plt>
lea    0xe8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <check_ISBN@plt>
test   %eax,%eax
je     11b0 <main+0x60>
mov    %rsp,%rdi
call   1030 <check_phouse@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11b0 <main+0x60>
cltq
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [12 x i8] c"Bluebridge\0A\00"
@.str.3 = [14 x i8] c"Alyson Books\0A\00"
@.str.4 = [30 x i8] c"FUNimation Productions, Ltd.\0A\00"
@.str.5 = [15 x i8] c"Pyramid Books\0A\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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @check_ISBN(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = call i32 @check_ISBN(i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%13 = call i32 @check_phouse(i8* %12)
switch i32 %13, label %22 [
i32 1, label %14
i32 2, label %16
i32 3, label %18
i32 4, label %20
]
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %23
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %23
18: ; preds = %11
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %23
20: ; preds = %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %23
22: ; preds = %11
br label %23
23: ; preds = %22, %20, %18, %16, %14
br label %24
24: ; preds = %23, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [14 x i8] c"Pyramid Books\00"
@str.6 = [29 x i8] c"FUNimation Productions, Ltd.\00"
@str.7 = [13 x i8] c"Alyson Books\00"
@str.8 = [11 x i8] c"Bluebridge\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @str.8 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @str.6 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @str to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @check_ISBN(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @check_ISBN(i8* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %0
%9 = call i32 @check_phouse(i8* %2)
%10 = add i32 %9, -1
%11 = icmp ult i32 %10, 4
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = sext i32 %10 to i64
%14 = shl i64 %13, 2
%15 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %14)
%16 = call i32 @puts(i8* dereferenceable(1) %15)
br label %17
17: ; preds = %8, %12, %0
ret i32 0
}