#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 /*<<< orphan*/ printf(char *);
int strlen(char *);
void type(char *isbn) {
  int counter = 0, index = 0, number = 0;
  for (; index < strlen(isbn); index++) {
    if (isbn[index] == '-')
      counter++;
    if (counter == 2)
      if (isbn[index] >= '0' && isbn[index] <= '9') {
        number = (number * 10) + (isbn[index] - '0');
      }
  }
  if (number == 933346)
    printf("\nBluebridge");
  if (number == 55583)
    printf("\nAlyson Books");
  if (number == 4210)
    printf("\nFUNimation Productions, Ltd.");
  if (number == 1)
    printf("\nPyramid Books");
}


x86 assembly (clang, -O0):
<type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11df <type+0xbf>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    117b <type+0x5b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    11cc <type+0xac>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     11c7 <type+0xa7>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     11c7 <type+0xa7>
imul   $0xa,-0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    11cc <type+0xac>
jmp    11d1 <type+0xb1>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1141 <type+0x21>
cmpl   $0xe3de2,-0x14(%rbp)
jne    11f8 <type+0xd8>
lea    0xe0d(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0xd91f,-0x14(%rbp)
jne    1211 <type+0xf1>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1072,-0x14(%rbp)
jne    122a <type+0x10a>
lea    0xdf5(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    1240 <type+0x120>
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    11b3 <type+0x93>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r15d,%r15d
xchg   %ax,%ax
mov    %ebp,%eax
movsbl (%r14,%rbx,1),%ecx
xor    %edx,%edx
cmp    $0x2d,%ecx
sete   %dl
add    %edx,%r15d
lea    -0x30(%rcx),%edx
cmp    $0xa,%dl
lea    (%rax,%rax,4),%edx
lea    -0x30(%rcx,%rdx,2),%ebp
cmovae %eax,%ebp
cmp    $0x2,%r15d
cmovne %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <type+0x20>
cmp    $0xd91e,%ebp
jg     119a <type+0x7a>
cmp    $0x1,%ebp
je     11be <type+0x9e>
cmp    $0x1072,%ebp
jne    11b3 <type+0x93>
lea    0xe82(%rip),%rdi
jmp    11ce <type+0xae>
cmp    $0xe3de2,%ebp
je     11c7 <type+0xa7>
cmp    $0xd91f,%ebp
jne    11b3 <type+0x93>
lea    0xe5b(%rip),%rdi
jmp    11ce <type+0xae>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe73(%rip),%rdi
jmp    11ce <type+0xae>
lea    0xe32(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"\0ABluebridge\00"
@.str.1 = [14 x i8] c"\0AAlyson Books\00"
@.str.2 = [30 x i8] c"\0AFUNimation Productions, Ltd.\00"
@.str.3 = [15 x i8] c"\0APyramid Books\00"
define void @type(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %54, %1
%7 = load i32, i32* %4
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %57
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 45
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %22
22: ; preds = %19, %11
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %53
25: ; preds = %22
%26 = load i8*, i8** %2
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp sge i32 %31, 48
br i1 %32, label %33, label %52
33: ; preds = %25
%34 = load i8*, i8** %2
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp sle i32 %39, 57
br i1 %40, label %41, label %52
41: ; preds = %33
%42 = load i32, i32* %5
%43 = mul nsw i32 %42, 10
%44 = load i8*, i8** %2
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = sub nsw i32 %49, 48
%51 = add nsw i32 %43, %50
store i32 %51, i32* %5
br label %52
52: ; preds = %41, %33, %25
br label %53
53: ; preds = %52, %22
br label %54
54: ; preds = %53
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %6
57: ; preds = %6
%58 = load i32, i32* %5
%59 = icmp eq i32 %58, 933346
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %62
62: ; preds = %60, %57
%63 = load i32, i32* %5
%64 = icmp eq i32 %63, 55583
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %67
67: ; preds = %65, %62
%68 = load i32, i32* %5
%69 = icmp eq i32 %68, 4210
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
%73 = load i32, i32* %5
%74 = icmp eq i32 %73, 1
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %77
77: ; preds = %75, %72
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"\0ABluebridge\00"
@.str.1 = [14 x i8] c"\0AAlyson Books\00"
@.str.2 = [30 x i8] c"\0AFUNimation Productions, Ltd.\00"
@.str.3 = [15 x i8] c"\0APyramid Books\00"
define void @type(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %33
4: ; preds = %1, %4
%5 = phi i64 [ %22, %4 ], [ 0, %1 ]
%6 = phi i32 [ %21, %4 ], [ 0, %1 ]
%7 = phi i32 [ %12, %4 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %5
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 45
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %7, %11
%13 = icmp eq i32 %12, 2
%14 = add i8 %9, -48
%15 = icmp ult i8 %14, 10
%16 = select i1 %13, i1 %15, i1 false
%17 = sext i8 %9 to i32
%18 = mul nsw i32 %6, 10
%19 = add i32 %18, -48
%20 = add i32 %19, %17
%21 = select i1 %16, i32 %20, i32 %6
%22 = add nuw nsw i64 %5, 1
%23 = tail call i32 @strlen(i8* %0)
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %4, label %26
26: ; preds = %4
switch i32 %21, label %33 [
i32 933346, label %30
i32 55583, label %27
i32 4210, label %28
i32 1, label %29
]
27: ; preds = %26
br label %30
28: ; preds = %26
br label %30
29: ; preds = %26
br label %30
30: ; preds = %26, %29, %27, %28
%31 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), %28 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %27 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %29 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %26 ]
%32 = tail call i32 @printf(i8* dereferenceable(1) %31)
br label %33
33: ; preds = %30, %1, %26
ret void
}