#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__ control_num(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ valid(char *);
int main() {
  int a;
  char str[12];
  scanf("%s", str);
  if ((valid(str) && control_num(str)) == 1)
    printf("1");
  else
    printf("0");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x14(%rbp),%rdi
call   1050 <valid@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
je     118d <main+0x4d>
lea    -0x14(%rbp),%rdi
call   1040 <control_num@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
jne    11af <main+0x6f>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    11bb <main+0x7b>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1050 <valid@plt>
test   %rax,%rax
je     117a <main+0x3a>
lea    0x4(%rsp),%rdi
call   1040 <control_num@plt>
mov    $0x31,%edi
test   %rax,%rax
jne    117f <main+0x3f>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [12 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%7 = call i64 @valid(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%11 = call i64 @control_num(i8* %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %9, %0
%14 = phi i1 [ false, %0 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %21
19: ; preds = %13
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 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 i64 @valid(i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = call i64 @control_num(i8* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0, %6
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 48, %9 ], [ 49, %6 ]
%12 = call i32 @putchar(i32 %11)
ret i32 0
}