#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();
scalar_t__ is_empty();
int /*<<< orphan*/ nested();
int /*<<< orphan*/ not_nested();
char pop();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push(char);
int main(void) {
  char i;
  printf("enter the parentheses and/or braces: ");
  while ((i = getchar()) != '\n') {
    switch (i) {
    case '(':
    case '{': {
      push(i);
      break;
    }
    case ')': {
      if (is_empty() || pop() != '(')
        not_nested();
      break;
    }
    case '}': {
      if (is_empty() || pop() != '{')
        not_nested();
      break;
    }
    }
  }
  if (is_empty())
    nested();
  else
    not_nested();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     125c <main+0xec>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x28,%eax
je     11e9 <main+0x79>
jmp    11b6 <main+0x46>
mov    -0xc(%rbp),%eax
sub    $0x29,%eax
je     11f7 <main+0x87>
jmp    11c7 <main+0x57>
mov    -0xc(%rbp),%eax
sub    $0x7b,%eax
je     11e9 <main+0x79>
jmp    11d8 <main+0x68>
mov    -0xc(%rbp),%eax
sub    $0x7d,%eax
je     1227 <main+0xb7>
jmp    1257 <main+0xe7>
movsbl -0x5(%rbp),%edi
call   1090 <push@plt>
jmp    1257 <main+0xe7>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%rax
jne    121b <main+0xab>
mov    $0x0,%al
call   1060 <pop@plt>
movsbl %al,%eax
cmp    $0x28,%eax
je     1222 <main+0xb2>
mov    $0x0,%al
call   1080 <not_nested@plt>
jmp    1257 <main+0xe7>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%rax
jne    124b <main+0xdb>
mov    $0x0,%al
call   1060 <pop@plt>
movsbl %al,%eax
cmp    $0x7b,%eax
je     1252 <main+0xe2>
mov    $0x0,%al
call   1080 <not_nested@plt>
jmp    1257 <main+0xe7>
jmp    118b <main+0x1b>
mov    $0x0,%al
call   1050 <is_empty@plt>
cmp    $0x0,%rax
je     1279 <main+0x109>
mov    $0x0,%al
call   1030 <nested@plt>
jmp    1280 <main+0x110>
mov    $0x0,%al
call   1080 <not_nested@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
jmp    1185 <main+0x15>
nop
call   1090 <push@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    $0xa,%al
je     11f9 <main+0x89>
movsbl %al,%edi
cmp    $0x7a,%edi
jg     11c0 <main+0x50>
cmp    $0x28,%edi
je     1180 <main+0x10>
cmp    $0x29,%edi
jne    1185 <main+0x15>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %rax,%rax
jne    11f0 <main+0x80>
xor    %eax,%eax
call   1060 <pop@plt>
cmp    $0x28,%al
je     1185 <main+0x15>
jmp    11f0 <main+0x80>
nopl   0x0(%rax,%rax,1)
cmp    $0x7d,%edi
je     11cc <main+0x5c>
cmp    $0x7b,%edi
je     1180 <main+0x10>
jmp    1185 <main+0x15>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %rax,%rax
jne    11f0 <main+0x80>
xor    %eax,%eax
call   1060 <pop@plt>
cmp    $0x7b,%al
je     1185 <main+0x15>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1080 <not_nested@plt>
jmp    1185 <main+0x15>
xor    %eax,%eax
call   1050 <is_empty@plt>
test   %rax,%rax
je     120e <main+0x9e>
xor    %eax,%eax
call   1030 <nested@plt>
jmp    1215 <main+0xa5>
xor    %eax,%eax
call   1080 <not_nested@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"enter the parentheses and/or braces: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %34, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %35
8: ; preds = %4
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
switch i32 %10, label %34 [
i32 40, label %11
i32 123, label %11
i32 41, label %14
i32 125, label %24
]
11: ; preds = %8, %8
%12 = load i8, i8* %2
%13 = call i32 @push(i8 signext %12)
br label %34
14: ; preds = %8
%15 = call i64 (...) @is_empty()
%16 = icmp ne i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = call signext i8 (...) @pop()
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 40
br i1 %20, label %21, label %23
21: ; preds = %17, %14
%22 = call i32 (...) @not_nested()
br label %23
23: ; preds = %21, %17
br label %34
24: ; preds = %8
%25 = call i64 (...) @is_empty()
%26 = icmp ne i64 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = call signext i8 (...) @pop()
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 123
br i1 %30, label %31, label %33
31: ; preds = %27, %24
%32 = call i32 (...) @not_nested()
br label %33
33: ; preds = %31, %27
br label %34
34: ; preds = %8, %33, %23, %11
br label %4
35: ; preds = %4
%36 = call i64 (...) @is_empty()
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (...) @nested()
br label %42
40: ; preds = %35
%41 = call i32 (...) @not_nested()
br label %42
42: ; preds = %40, %38
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"enter the parentheses and/or braces: \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %28, label %4
4: ; preds = %0, %25
%5 = phi i8 [ %26, %25 ], [ %2, %0 ]
%6 = sext i8 %5 to i32
switch i32 %6, label %25 [
i32 40, label %7
i32 123, label %7
i32 41, label %9
i32 125, label %17
]
7: ; preds = %4, %4
%8 = tail call i32 @push(i8 signext %5)
br label %25
9: ; preds = %4
%10 = tail call i64 (...) @is_empty()
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = tail call signext i8 (...) @pop()
%14 = icmp eq i8 %13, 40
br i1 %14, label %25, label %15
15: ; preds = %12, %9
%16 = tail call i32 (...) @not_nested()
br label %25
17: ; preds = %4
%18 = tail call i64 (...) @is_empty()
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = tail call signext i8 (...) @pop()
%22 = icmp eq i8 %21, 123
br i1 %22, label %25, label %23
23: ; preds = %20, %17
%24 = tail call i32 (...) @not_nested()
br label %25
25: ; preds = %20, %23, %12, %15, %4, %7
%26 = tail call signext i8 (...) @getchar()
%27 = icmp eq i8 %26, 10
br i1 %27, label %28, label %4
28: ; preds = %25, %0
%29 = tail call i64 (...) @is_empty()
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 (...) @nested()
br label %35
33: ; preds = %28
%34 = tail call i32 (...) @not_nested()
br label %35
35: ; preds = %33, %31
ret i32 0
}