#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 strlen(char *);
int check_phouse(char *ISBN) {
  int i, j = 0;
  int ISBN_int[5] = {0, 0, 0, 0, 0};
  for (i = 0; i < strlen(ISBN); i++) {
    while (ISBN[i] >= '0' && ISBN[i] <= '9') {
      ISBN_int[j] = (ISBN_int[j] * 10) + (ISBN[i] - '0');
      i++;
    }
    j++;
  }
  switch (ISBN_int[2]) {
  case 933346:
    return 1;
    break;
  case 55583:
    return 2;
    break;
  case 4210:
    return 3;
    break;
  case 01:
    return 4;
    break;
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_phouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    11f1 <check_phouse+0xd1>
jmp    116b <check_phouse+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x35(%rbp)
jl     119a <check_phouse+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    11aa <check_phouse+0x8a>
jmp    11da <check_phouse+0xba>
movslq -0x18(%rbp),%rax
imul   $0xa,-0x30(%rbp,%rax,4),%ecx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
sub    $0x30,%eax
add    %eax,%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <check_phouse+0x4b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <check_phouse+0x2a>
mov    -0x28(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x1,%eax
je     1262 <check_phouse+0x142>
jmp    1205 <check_phouse+0xe5>
mov    -0x3c(%rbp),%eax
sub    $0x1072,%eax
je     1256 <check_phouse+0x136>
jmp    1218 <check_phouse+0xf8>
mov    -0x3c(%rbp),%eax
sub    $0xd91f,%eax
je     124a <check_phouse+0x12a>
jmp    122b <check_phouse+0x10b>
mov    -0x3c(%rbp),%eax
sub    $0xe3de2,%eax
jne    126e <check_phouse+0x14e>
jmp    123e <check_phouse+0x11e>
movl   $0x1,-0x4(%rbp)
jmp    127a <check_phouse+0x15a>
movl   $0x2,-0x4(%rbp)
jmp    127a <check_phouse+0x15a>
movl   $0x3,-0x4(%rbp)
jmp    127a <check_phouse+0x15a>
movl   $0x4,-0x4(%rbp)
jmp    127a <check_phouse+0x15a>
jmp    1273 <check_phouse+0x153>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_phouse>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <strlen@plt>
test   %eax,%eax
jle    11d7 <check_phouse+0xc7>
lea    0x1(%r15),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1163 <check_phouse+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
add    $0x1,%ebp
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jge    11a4 <check_phouse+0x94>
movslq %ebp,%rax
mov    (%r15,%rax,1),%cl
lea    -0x30(%rcx),%edx
cmp    $0x9,%dl
ja     1150 <check_phouse+0x40>
mov    (%rsp,%rbx,4),%edx
add    %r14,%rax
nopl   0x0(%rax,%rax,1)
movzbl %cl,%ecx
lea    (%rdx,%rdx,4),%edx
lea    (%rcx,%rdx,2),%edx
add    $0xffffffd0,%edx
movzbl (%rax),%ecx
lea    -0x30(%rcx),%esi
add    $0x1,%ebp
add    $0x1,%rax
cmp    $0xa,%sil
jb     1180 <check_phouse+0x70>
mov    %edx,(%rsp,%rbx,4)
jmp    1150 <check_phouse+0x40>
mov    0x8(%rsp),%eax
cmp    $0xd91e,%eax
jg     11c2 <check_phouse+0xb2>
cmp    $0x1,%eax
je     11e4 <check_phouse+0xd4>
cmp    $0x1072,%eax
jne    11d7 <check_phouse+0xc7>
mov    $0x3,%eax
jmp    11d9 <check_phouse+0xc9>
cmp    $0xe3de2,%eax
je     11eb <check_phouse+0xdb>
cmp    $0xd91f,%eax
jne    11d7 <check_phouse+0xc7>
mov    $0x2,%eax
jmp    11d9 <check_phouse+0xc9>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x4,%eax
jmp    11d9 <check_phouse+0xc9>
mov    $0x1,%eax
jmp    11d9 <check_phouse+0xc9>

LLVM IR (-O0):
define i32 @check_phouse(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x i32]
store i8* %0, i8** %3
store i32 0, i32* %5
%7 = bitcast [5 x i32]* %6 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %54, %1
%9 = load i32, i32* %4
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %57
13: ; preds = %8
br label %14
14: ; preds = %32, %13
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 48
br i1 %21, label %22, label %30
22: ; preds = %14
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 57
br label %30
30: ; preds = %22, %14
%31 = phi i1 [ false, %14 ], [ %29, %22 ]
br i1 %31, label %32, label %51
32: ; preds = %30
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = mul nsw i32 %36, 10
%38 = load i8*, i8** %3
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = sub nsw i32 %43, 48
%45 = add nsw i32 %37, %44
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %47
store i32 %45, i32* %48
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %14
51: ; preds = %30
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %54
54: ; preds = %51
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %8
57: ; preds = %8
%58 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 2
%59 = load i32, i32* %58
switch i32 %59, label %64 [
i32 933346, label %60
i32 55583, label %61
i32 4210, label %62
i32 1, label %63
]
60: ; preds = %57
store i32 1, i32* %2
br label %66
61: ; preds = %57
store i32 2, i32* %2
br label %66
62: ; preds = %57
store i32 3, i32* %2
br label %66
63: ; preds = %57
store i32 4, i32* %2
br label %66
64: ; preds = %57
br label %65
65: ; preds = %64
store i32 0, i32* %2
br label %66
66: ; preds = %65, %63, %62, %61, %60
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
define i32 @check_phouse(i8* %0) {
%2 = alloca [5 x i32]
%3 = bitcast [5 x i32]* %2 to i8*
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %44
6: ; preds = %1, %32
%7 = phi i64 [ %34, %32 ], [ 0, %1 ]
%8 = phi i32 [ %35, %32 ], [ 0, %1 ]
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = add i8 %11, -48
%13 = icmp ult i8 %12, 10
br i1 %13, label %14, label %32
14: ; preds = %6
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %7
%16 = load i32, i32* %15
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ %9, %14 ], [ %25, %17 ]
%19 = phi i32 [ %16, %14 ], [ %24, %17 ]
%20 = phi i8 [ %11, %14 ], [ %27, %17 ]
%21 = zext i8 %20 to i32
%22 = mul nsw i32 %19, 10
%23 = add nsw i32 %21, -48
%24 = add nsw i32 %23, %22
%25 = add i64 %18, 1
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = add i8 %27, -48
%29 = icmp ult i8 %28, 10
br i1 %29, label %17, label %30
30: ; preds = %17
%31 = trunc i64 %25 to i32
store i32 %24, i32* %15
br label %32
32: ; preds = %30, %6
%33 = phi i32 [ %31, %30 ], [ %8, %6 ]
%34 = add nuw i64 %7, 1
%35 = add nsw i32 %33, 1
%36 = tail call i32 @strlen(i8* %0)
%37 = icmp slt i32 %35, %36
br i1 %37, label %6, label %38
38: ; preds = %32
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%40 = load i32, i32* %39
switch i32 %40, label %44 [
i32 933346, label %45
i32 55583, label %41
i32 4210, label %42
i32 1, label %43
]
41: ; preds = %38
br label %45
42: ; preds = %38
br label %45
43: ; preds = %38
br label %45
44: ; preds = %1, %38
br label %45
45: ; preds = %38, %44, %43, %42, %41
%46 = phi i32 [ 0, %44 ], [ 4, %43 ], [ 3, %42 ], [ 2, %41 ], [ 1, %38 ]
ret i32 %46
}