#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main() {
  int signal = 0;
  int number = 0;
  char character = 0;
  printf("\nNow , boy Please enter a string ,I will checkwhether the big brace "
         "is a couple!\n\n");
  while ((character = getchar()) != '\n') {
    if (character == '{') {
      signal = 1;
    }
    if (character == '}') {
      if (signal == 1) {
        signal = 0;
        number++;
      }
    }
  }
  printf(
      "\n\nThere are %d couple big brace in the string that you entered !\n\n",
      number);
  system("pause");
  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)
movb   $0x0,-0xd(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11ba <main+0x8a>
movsbl -0xd(%rbp),%eax
cmp    $0x7b,%eax
jne    1189 <main+0x59>
movl   $0x1,-0x8(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x7d,%eax
jne    11b5 <main+0x85>
cmpl   $0x1,-0x8(%rbp)
jne    11b0 <main+0x80>
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b5 <main+0x85>
jmp    115f <main+0x2f>
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1167 <main+0x27>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl %cl,%ecx
add    %ecx,%ebx
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x7b,%al
je     1180 <main+0x40>
cmp    $0xa,%al
jne    1185 <main+0x45>
jmp    119a <main+0x5a>
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebp
cmp    $0x7d,%al
sete   %dl
cmp    $0x1,%ebp
sete   %cl
xor    %eax,%eax
and    %dl,%cl
jne    1160 <main+0x20>
mov    %ebp,%eax
jmp    1160 <main+0x20>
lea    0xe5f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [83 x i8] c"\0ANow , boy Please enter a string ,I will checkwhether the big brace is a couple!\0A\0A\00"
@.str.1 = [67 x i8] c"\0A\0AThere are %d couple big brace in the string that you entered !\0A\0A\00"
@.str.2 = [6 x i8] c"pause\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
store i8 0, i8* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %26, %0
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %27
10: ; preds = %6
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 123
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %2
br label %15
15: ; preds = %14, %10
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 125
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %19
store i32 0, i32* %2
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25, %15
br label %6
27: ; preds = %6
%28 = load i32, i32* %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [67 x i8] c"\0A\0AThere are %d couple big brace in the string that you entered !\0A\0A\00"
@.str.2 = [6 x i8] c"pause\00"
@str = [82 x i8] c"\0ANow , boy Please enter a string ,I will checkwhether the big brace is a couple!\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %7, %0
%3 = phi i32 [ 0, %0 ], [ %12, %7 ]
%4 = phi i32 [ 0, %0 ], [ %14, %7 ]
%5 = tail call signext i8 (...) @getchar()
switch i8 %5, label %7 [
i8 10, label %15
i8 123, label %6
]
6: ; preds = %2
br label %7
7: ; preds = %2, %6
%8 = phi i32 [ 1, %6 ], [ %3, %2 ]
%9 = icmp eq i8 %5, 125
%10 = icmp eq i32 %8, 1
%11 = select i1 %9, i1 %10, i1 false
%12 = select i1 %11, i32 0, i32 %8
%13 = zext i1 %11 to i32
%14 = add nuw nsw i32 %4, %13
br label %2
15: ; preds = %2
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%17 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}