#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 checksum(char *);
int /*<<< orphan*/ get_part(char *, int, char *);
int is_number(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pubhouse(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main() {
  char result[15], result3[15], result2[15], result1[15], result4[15];
  int len = 0;
  int checked;
  char str[18];
  scanf("%s", str);
  len = strlen(str);
  if (len != 17) {
    printf("0");
    return 0;
  }
  get_part(str, 1, result1);
  if (!(strcmp(result1, "978") == 0 || strcmp(result1, "979") == 0)) {
    printf("0");
    return 0;
  }
  get_part(str, 2, result2);
  if (is_number(result2) != 1) {
    printf("0");
    return 0;
  }
  get_part(str, 3, result3);
  if (is_number(result3) != 1) {
    printf("0");
    return 0;
  }
  get_part(str, 4, result4);
  if (is_number(result4) != 1) {
    printf("0");
    return 0;
  }
  sprintf(result, "%s%s%s%s", result1, result2, result3, result4);
  checked = checksum(result);
  if (checked != str[len - 1] - 48) {
    printf("0");
    return 0;
  }
  printf("1\n");
  pubhouse(result3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x54(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe5f(%rip),%rdi
call   10a0 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x11,-0x54(%rbp)
je     11e4 <main+0x54>
lea    0xe2d(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x1e2>
lea    -0x70(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    $0x1,%esi
call   1070 <get_part@plt>
lea    -0x40(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1242 <main+0xb2>
lea    -0x40(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1242 <main+0xb2>
lea    0xdcf(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x1e2>
lea    -0x70(%rbp),%rdi
lea    -0x31(%rbp),%rdx
mov    $0x2,%esi
call   1070 <get_part@plt>
lea    -0x31(%rbp),%rdi
call   1030 <is_number@plt>
cmp    $0x1,%eax
je     127e <main+0xee>
lea    0xd93(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x1e2>
lea    -0x70(%rbp),%rdi
lea    -0x22(%rbp),%rdx
mov    $0x3,%esi
call   1070 <get_part@plt>
lea    -0x22(%rbp),%rdi
call   1030 <is_number@plt>
cmp    $0x1,%eax
je     12ba <main+0x12a>
lea    0xd57(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x1e2>
lea    -0x70(%rbp),%rdi
lea    -0x4f(%rbp),%rdx
mov    $0x4,%esi
call   1070 <get_part@plt>
lea    -0x4f(%rbp),%rdi
call   1030 <is_number@plt>
cmp    $0x1,%eax
je     12f6 <main+0x166>
lea    0xd1b(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x1e2>
lea    -0x13(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x31(%rbp),%rcx
lea    -0x22(%rbp),%r8
lea    -0x4f(%rbp),%r9
lea    0xcf9(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x13(%rbp),%rdi
call   1060 <checksum@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
sub    $0x30,%ecx
cmp    %ecx,%eax
je     1356 <main+0x1c6>
lea    0xcbb(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1372 <main+0x1e2>
lea    0xcb6(%rip),%rdi
call   1050 <printf@plt>
lea    -0x22(%rbp),%rdi
call   1090 <pubhouse@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xe62(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   10b0 <scanf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x11,%eax
jne    12c9 <main+0x129>
mov    %rsp,%rdi
lea    0x15(%rsp),%rbx
mov    $0x1,%esi
mov    %rbx,%rdx
call   1080 <get_part@plt>
lea    0xe1c(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     120b <main+0x6b>
lea    0xe0c(%rip),%rsi
lea    0x15(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    12c9 <main+0x129>
mov    %rsp,%rdi
lea    0x42(%rsp),%rbx
mov    $0x2,%esi
mov    %rbx,%rdx
call   1080 <get_part@plt>
mov    %rbx,%rdi
call   1040 <is_number@plt>
cmp    $0x1,%eax
jne    12c9 <main+0x129>
mov    %rsp,%rdi
lea    0x24(%rsp),%rbx
mov    $0x3,%esi
mov    %rbx,%rdx
call   1080 <get_part@plt>
mov    %rbx,%rdi
call   1040 <is_number@plt>
cmp    $0x1,%eax
jne    12c9 <main+0x129>
mov    %rsp,%rdi
lea    0x33(%rsp),%rbx
mov    $0x4,%esi
mov    %rbx,%rdx
call   1080 <get_part@plt>
mov    %rbx,%rdi
call   1040 <is_number@plt>
cmp    $0x1,%eax
jne    12c9 <main+0x129>
lea    0xd8c(%rip),%rsi
lea    0x51(%rsp),%rbx
lea    0x15(%rsp),%rdx
lea    0x42(%rsp),%rcx
lea    0x24(%rsp),%r8
lea    0x33(%rsp),%r9
mov    %rbx,%rdi
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <checksum@plt>
movsbl 0x10(%rsp),%ecx
add    $0xffffffd0,%ecx
cmp    %ecx,%eax
jne    12c9 <main+0x129>
lea    0xd59(%rip),%rdi
call   1050 <puts@plt>
lea    0x24(%rsp),%rdi
call   10a0 <pubhouse@plt>
jmp    12d3 <main+0x133>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [4 x i8] c"978\00"
@.str.3 = [4 x i8] c"979\00"
@.str.4 = [9 x i8] c"%s%s%s%s\00"
@.str.5 = [3 x i8] c"1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca [15 x i8]
%5 = alloca [15 x i8]
%6 = alloca [15 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [18 x i8]
store i32 0, i32* %1
store i32 0, i32* %7
%10 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp ne i32 %14, 17
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = 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 %82
18: ; preds = %0
%19 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 0
%20 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%21 = call i32 @get_part(i8* %19, i32 1, i8* %20)
%22 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %18
%26 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = 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 %82
31: ; preds = %25, %18
%32 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 0
%33 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%34 = call i32 @get_part(i8* %32, i32 2, i8* %33)
%35 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%36 = call i32 @is_number(i8* %35)
%37 = icmp ne i32 %36, 1
br i1 %37, label %38, label %40
38: ; preds = %31
%39 = 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 %82
40: ; preds = %31
%41 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 0
%42 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%43 = call i32 @get_part(i8* %41, i32 3, i8* %42)
%44 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%45 = call i32 @is_number(i8* %44)
%46 = icmp ne i32 %45, 1
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = 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 %82
49: ; preds = %40
%50 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 0
%51 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%52 = call i32 @get_part(i8* %50, i32 4, i8* %51)
%53 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%54 = call i32 @is_number(i8* %53)
%55 = icmp ne i32 %54, 1
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = 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 %82
58: ; preds = %49
%59 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%60 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%61 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%62 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%63 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%64 = call i32 @sprintf(i8* %59, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %60, i8* %61, i8* %62, i8* %63)
%65 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%66 = call i32 @checksum(i8* %65)
store i32 %66, i32* %8
%67 = load i32, i32* %8
%68 = load i32, i32* %7
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [18 x i8], [18 x i8]* %9, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = sub nsw i32 %73, 48
%75 = icmp ne i32 %67, %74
br i1 %75, label %76, label %78
76: ; preds = %58
%77 = 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 %82
78: ; preds = %58
%79 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%80 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%81 = call i32 @pubhouse(i8* %80)
store i32 0, i32* %1
br label %82
82: ; preds = %78, %76, %56, %47, %38, %29, %16
%83 = load i32, i32* %1
ret i32 %83
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"978\00"
@.str.3 = [4 x i8] c"979\00"
@.str.4 = [9 x i8] c"%s%s%s%s\00"
@str = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca [15 x i8]
%5 = alloca [15 x i8]
%6 = alloca [18 x i8]
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [18 x i8], [18 x i8]* %6, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @strlen(i8* %12)
%15 = icmp eq i32 %14, 17
br i1 %15, label %18, label %16
16: ; preds = %0
%17 = call i32 @putchar(i32 48)
br label %58
18: ; preds = %0
%19 = call i32 @get_part(i8* %12, i32 1, i8* %10)
%20 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i32 @putchar(i32 48)
br label %58
27: ; preds = %22, %18
%28 = call i32 @get_part(i8* %12, i32 2, i8* %9)
%29 = call i32 @is_number(i8* %9)
%30 = icmp eq i32 %29, 1
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = call i32 @putchar(i32 48)
br label %58
33: ; preds = %27
%34 = call i32 @get_part(i8* %12, i32 3, i8* %8)
%35 = call i32 @is_number(i8* %8)
%36 = icmp eq i32 %35, 1
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = call i32 @putchar(i32 48)
br label %58
39: ; preds = %33
%40 = call i32 @get_part(i8* %12, i32 4, i8* %11)
%41 = call i32 @is_number(i8* %11)
%42 = icmp eq i32 %41, 1
br i1 %42, label %45, label %43
43: ; preds = %39
%44 = call i32 @putchar(i32 48)
br label %58
45: ; preds = %39
%46 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %10, i8* %9, i8* %8, i8* %11)
%47 = call i32 @checksum(i8* %7)
%48 = getelementptr inbounds [18 x i8], [18 x i8]* %6, i64 0, i64 16
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = add nsw i32 %50, -48
%52 = icmp eq i32 %47, %51
br i1 %52, label %55, label %53
53: ; preds = %45
%54 = call i32 @putchar(i32 48)
br label %58
55: ; preds = %45
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%57 = call i32 @pubhouse(i8* %8)
br label %58
58: ; preds = %55, %53, %43, %37, %31, %25, %16
ret i32 0
}