#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int i, q;
  char c;
  for (i = 0, q = 0;; i++) {
    scanf("%c", &c);
    if (c == 10 || c == 13)
      break;
    if (c != '{' && c != '}') {
      printf("Babinata Ti: Unknown Symbol At %d!\n", i);
      getchar();
      return 1;
    }
    if (c == '{')
      q++;
    if (c == '}')
      q--;
    if (q < 0)
      break;
  }
  if (q == 0)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
lea    -0xd(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
je     1177 <main+0x47>
movsbl -0xd(%rbp),%eax
cmp    $0xd,%eax
jne    117c <main+0x4c>
jmp    1208 <main+0xd8>
movsbl -0xd(%rbp),%eax
cmp    $0x7b,%eax
je     11ba <main+0x8a>
movsbl -0xd(%rbp),%eax
cmp    $0x7d,%eax
je     11ba <main+0x8a>
mov    -0x8(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movl   $0x1,-0x4(%rbp)
jmp    123a <main+0x10a>
movsbl -0xd(%rbp),%eax
cmp    $0x7b,%eax
jne    11d0 <main+0xa0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x7d,%eax
jne    11e6 <main+0xb6>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11f5 <main+0xc5>
jmp    1208 <main+0xd8>
jmp    11fa <main+0xca>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
cmpl   $0x0,-0xc(%rbp)
jne    1225 <main+0xf5>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1233 <main+0x103>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xeb0(%rip),%r14
lea    0x7(%rsp),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x7c,%al
jg     1180 <main+0x40>
cmp    $0x7b,%al
jne    1194 <main+0x54>
add    $0x1,%ebp
jmp    1184 <main+0x44>
nopl   (%rax)
cmp    $0x7d,%al
jne    11a9 <main+0x69>
xor    %ecx,%ecx
cmp    $0x7d,%al
sete   %cl
sub    %ecx,%ebp
js     11a0 <main+0x60>
add    $0x1,%ebx
jmp    1160 <main+0x20>
cmp    $0xa,%al
je     119c <main+0x5c>
cmp    $0xd,%al
jne    11a9 <main+0x69>
test   %ebp,%ebp
je     11c7 <main+0x87>
lea    0xe80(%rip),%rdi
jmp    11ce <main+0x8e>
lea    0xe53(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x1,%eax
jmp    11d5 <main+0x95>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [36 x i8] c"Babinata Ti: Unknown Symbol At %d!\0A\00"
@.str.2 = [5 x i8] c"Yes\0A\00"
@.str.3 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %46, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 10
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 13
br i1 %13, label %14, label %15
14: ; preds = %10, %5
br label %49
15: ; preds = %10
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 123
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 125
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @getchar()
store i32 1, i32* %1
br label %57
27: ; preds = %19, %15
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 123
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %34
34: ; preds = %31, %27
%35 = load i8, i8* %4
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 125
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i32, i32* %3
%40 = add nsw i32 %39, -1
store i32 %40, i32* %3
br label %41
41: ; preds = %38, %34
%42 = load i32, i32* %3
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
br label %49
45: ; preds = %41
br label %46
46: ; preds = %45
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %5
49: ; preds = %44, %14
%50 = load i32, i32* %3
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %56
54: ; preds = %49
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %56
56: ; preds = %54, %52
store i32 0, i32* %1
br label %57
57: ; preds = %56, %23
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [36 x i8] c"Babinata Ti: Unknown Symbol At %d!\0A\00"
@str = [3 x i8] c"No\00"
@str.4 = [4 x i8] c"Yes\00"
define i32 @main() {
%1 = alloca i8
br label %2
2: ; preds = %18, %0
%3 = phi i32 [ 0, %0 ], [ %19, %18 ]
%4 = phi i32 [ 0, %0 ], [ %16, %18 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
switch i8 %6, label %7 [
i8 13, label %20
i8 10, label %20
i8 123, label %10
i8 125, label %12
]
7: ; preds = %2
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%9 = call i32 (...) @getchar()
br label %26
10: ; preds = %2
%11 = add nuw nsw i32 %4, 1
br label %12
12: ; preds = %2, %10
%13 = phi i32 [ %11, %10 ], [ %4, %2 ]
%14 = icmp eq i8 %6, 125
%15 = sext i1 %14 to i32
%16 = add nsw i32 %13, %15
%17 = icmp slt i32 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %12
%19 = add nuw nsw i32 %3, 1
br label %2
20: ; preds = %2, %2
%21 = icmp eq i32 %4, 0
br i1 %21, label %22, label %24
22: ; preds = %20
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0))
br label %26
24: ; preds = %12, %20
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %22, %24, %7
%27 = phi i32 [ 1, %7 ], [ 0, %24 ], [ 0, %22 ]
ret i32 %27
}