#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__ check_sum(char *);
scalar_t__ first_number_check(char *);
int /*<<< orphan*/ house(char *);
scalar_t__ length_check(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
int main() {
  char input[20];
  scanf("%[^\n]s", input);
  char save[20];
  strcpy(save, input);
  if (length_check(input) == 0) {
    printf("0");
    return 0;
  }
  char *token;
  token = strtok(input, "-");
  if (first_number_check(token) == 0) {
    printf("0");
    return 0;
  }
  if (check_sum(save) == 0) {
    printf("0");
    return 0;
  } else {
    printf("1");
  }
  for (int i = 0; token != NULL; i++) {
    token = strtok(NULL, "-");
    if (i == 1) {
      house(token);
      break;
    } else if (i > 1) {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xe66(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
call   1060 <length_check@plt>
cmp    $0x0,%rax
jne    11d7 <main+0x57>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b9 <main+0x139>
lea    -0x20(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
call   10a0 <first_number_check@plt>
cmp    $0x0,%rax
jne    1216 <main+0x96>
lea    0xe02(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b9 <main+0x139>
lea    -0x40(%rbp),%rdi
call   1050 <check_sum@plt>
cmp    $0x0,%rax
jne    1241 <main+0xc1>
lea    0xdd7(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b9 <main+0x139>
lea    0xdc3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4c(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     12b2 <main+0x132>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd9f(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x48(%rbp)
cmpl   $0x1,-0x4c(%rbp)
jne    128b <main+0x10b>
mov    -0x48(%rbp),%rdi
call   1080 <house@plt>
jmp    12b2 <main+0x132>
cmpl   $0x1,-0x4c(%rbp)
jle    129a <main+0x11a>
jmp    12b2 <main+0x132>
jmp    129f <main+0x11f>
jmp    12a4 <main+0x124>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1254 <main+0xd4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xe74(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <length_check@plt>
test   %rax,%rax
je     1219 <main+0x99>
lea    0xe4f(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1090 <strtok@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10a0 <first_number_check@plt>
test   %rax,%rax
je     1219 <main+0x99>
mov    %rsp,%rdi
call   1050 <check_sum@plt>
test   %rax,%rax
je     1219 <main+0x99>
mov    $0x31,%edi
call   1030 <putchar@plt>
test   %rbx,%rbx
je     1223 <main+0xa3>
lea    0xe12(%rip),%rsi
xor    %edi,%edi
call   1090 <strtok@plt>
test   %rax,%rax
je     1223 <main+0xa3>
lea    0xdff(%rip),%rsi
xor    %edi,%edi
call   1090 <strtok@plt>
mov    %rax,%rdi
call   1080 <house@plt>
jmp    1223 <main+0xa3>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i64 @length_check(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = 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 %53
16: ; preds = %0
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%18 = call i8* @strtok(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %18, i8** %4
%19 = load i8*, i8** %4
%20 = call i64 @first_number_check(i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = 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 %53
24: ; preds = %16
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%26 = call i64 @check_sum(i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = 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 %53
30: ; preds = %24
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30
store i32 0, i32* %5
br label %33
33: ; preds = %49, %32
%34 = load i8*, i8** %4
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %52
36: ; preds = %33
%37 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %37, i8** %4
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i8*, i8** %4
%42 = call i32 @house(i8* %41)
br label %52
43: ; preds = %36
%44 = load i32, i32* %5
%45 = icmp sgt i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %43
br label %52
47: ; preds = %43
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %33
52: ; preds = %46, %40, %33
store i32 0, i32* %1
br label %53
53: ; preds = %52, %28, %22, %14
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [2 x i8] c"-\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 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 @strcpy(i8* %5, i8* %3)
%7 = call i64 @length_check(i8* %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @putchar(i32 48)
br label %31
11: ; preds = %0
%12 = call i8* @strtok(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = call i64 @first_number_check(i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @putchar(i32 48)
br label %31
17: ; preds = %11
%18 = call i64 @check_sum(i8* %5)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @putchar(i32 48)
br label %31
22: ; preds = %17
%23 = call i32 @putchar(i32 49)
%24 = icmp eq i8* %12, null
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i8* %26, null
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @house(i8* %29)
br label %31
31: ; preds = %22, %25, %15, %20, %28, %9
ret i32 0
}