#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 EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ escape_sequence();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ inside_single_quote();
int /*<<< orphan*/ inside_string();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
is_parentheses(int *c) {
  if (*c == ')') {
    printf("\nUnitialized parentheses | missing ( token");
    exit(EXIT_FAILURE);
  }
  if (*c == '(') {
    while ((*c = getchar()) != EOF) {
      putchar(*c);
      if (*c == ')')
        return 0;
      if (*c == EOF) {
        printf("\nError: Terminated token ) missing\n");
        exit(EXIT_FAILURE);
      }
      if (*c == '(')
        is_parentheses(&*c);
      if (*c == '\\')
        escape_sequence();
      if (*c == '\'')
        inside_single_quote();
      if (*c == '"')
        inside_string();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_parentheses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x29,(%rax)
jne    11b3 <is_parentheses+0x33>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x28,(%rax)
jne    1290 <is_parentheses+0x110>
jmp    11c5 <is_parentheses+0x45>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x10(%rbp),%rcx
mov    %eax,(%rcx)
mov    0x2e0f(%rip),%rcx
cmp    (%rcx),%eax
je     128b <is_parentheses+0x10b>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x29,(%rax)
jne    1205 <is_parentheses+0x85>
movl   $0x0,-0x4(%rbp)
jmp    1297 <is_parentheses+0x117>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2dd6(%rip),%rcx
cmp    (%rcx),%eax
jne    1234 <is_parentheses+0xb4>
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x28,(%rax)
jne    124a <is_parentheses+0xca>
mov    -0x10(%rbp),%rdi
call   1070 <is_parentheses@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x5c,(%rax)
jne    125e <is_parentheses+0xde>
mov    $0x0,%al
call   1080 <escape_sequence@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x27,(%rax)
jne    1272 <is_parentheses+0xf2>
mov    $0x0,%al
call   1050 <inside_single_quote@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x22,(%rax)
jne    1286 <is_parentheses+0x106>
mov    $0x0,%al
call   1090 <inside_string@plt>
jmp    11c5 <is_parentheses+0x45>
jmp    1290 <is_parentheses+0x110>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_parentheses>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%eax
cmp    $0x28,%eax
je     11ae <is_parentheses+0x1e>
cmp    $0x29,%eax
je     125e <is_parentheses+0xce>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,(%rbx)
mov    0x2e27(%rip),%r14
jmp    11d9 <is_parentheses+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %eax,(%rbx)
cmp    (%r14),%eax
je     11a4 <is_parentheses+0x14>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    (%rbx),%eax
cmp    $0x29,%eax
je     11a4 <is_parentheses+0x14>
cmp    (%r14),%eax
je     1244 <is_parentheses+0xb4>
cmp    $0x28,%eax
je     1210 <is_parentheses+0x80>
cmp    $0x5c,%eax
je     121f <is_parentheses+0x8f>
cmp    $0x27,%eax
je     122d <is_parentheses+0x9d>
cmp    $0x22,%eax
jne    11d0 <is_parentheses+0x40>
jmp    123b <is_parentheses+0xab>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <is_parentheses@plt>
mov    (%rbx),%eax
cmp    $0x5c,%eax
jne    11fb <is_parentheses+0x6b>
xor    %eax,%eax
call   1090 <escape_sequence@plt>
mov    (%rbx),%eax
cmp    $0x27,%eax
jne    1200 <is_parentheses+0x70>
xor    %eax,%eax
call   1060 <inside_single_quote@plt>
mov    (%rbx),%eax
cmp    $0x22,%eax
jne    11d0 <is_parentheses+0x40>
xor    %eax,%eax
call   10a0 <inside_string@plt>
jmp    11d0 <is_parentheses+0x40>
lea    0xde0(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xd9b(%rip),%rdi
call   1050 <printf@plt>
jmp    1250 <is_parentheses+0xc0>

LLVM IR (-O0):
@.str = [43 x i8] c"\0AUnitialized parentheses | missing ( token\00"
@EXIT_FAILURE = global i32 0
@EOF = global i32 0
@.str.1 = [36 x i8] c"\0AError: Terminated token ) missing\0A\00"
define i32 @is_parentheses(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 41
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 40
br i1 %14, label %15, label %65
15: ; preds = %11
br label %16
16: ; preds = %63, %15
%17 = call i32 (...) @getchar()
%18 = load i32*, i32** %3
store i32 %17, i32* %18
%19 = load i32, i32* @EOF
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %64
21: ; preds = %16
%22 = load i32*, i32** %3
%23 = load i32, i32* %22
%24 = call i32 @putchar(i32 %23)
%25 = load i32*, i32** %3
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 41
br i1 %27, label %28, label %29
28: ; preds = %21
store i32 0, i32* %2
br label %66
29: ; preds = %21
%30 = load i32*, i32** %3
%31 = load i32, i32* %30
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %29
%39 = load i32*, i32** %3
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 40
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32*, i32** %3
%44 = call i32 @is_parentheses(i32* %43)
br label %45
45: ; preds = %42, %38
%46 = load i32*, i32** %3
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 92
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 (...) @escape_sequence()
br label %51
51: ; preds = %49, %45
%52 = load i32*, i32** %3
%53 = load i32, i32* %52
%54 = icmp eq i32 %53, 39
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 (...) @inside_single_quote()
br label %57
57: ; preds = %55, %51
%58 = load i32*, i32** %3
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, 34
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 (...) @inside_string()
br label %63
63: ; preds = %61, %57
br label %16
64: ; preds = %16
br label %65
65: ; preds = %64, %11
store i32 0, i32* %2
br label %66
66: ; preds = %65, %28
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
@.str = [43 x i8] c"\0AUnitialized parentheses | missing ( token\00"
@EXIT_FAILURE = global i32 0
@EOF = global i32 0
@str = [35 x i8] c"\0AError: Terminated token ) missing\00"
define i32 @is_parentheses(i32* nocapture %0) {
%2 = load i32, i32* %0
switch i32 %2, label %49 [
i32 41, label %7
i32 40, label %3
]
3: ; preds = %1
%4 = tail call i32 (...) @getchar()
store i32 %4, i32* %0
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %49, label %11
7: ; preds = %1
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3, %45
%12 = phi i32 [ %46, %45 ], [ %4, %3 ]
%13 = tail call i32 @putchar(i32 %12)
%14 = load i32, i32* %0
%15 = icmp eq i32 %14, 41
br i1 %15, label %49, label %16
16: ; preds = %11
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %14, %17
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %16
%24 = icmp eq i32 %14, 40
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = tail call i32 @is_parentheses(i32* %0)
%27 = load i32, i32* %0
br label %28
28: ; preds = %25, %23
%29 = phi i32 [ %27, %25 ], [ %14, %23 ]
%30 = icmp eq i32 %29, 92
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = tail call i32 (...) @escape_sequence()
%33 = load i32, i32* %0
br label %34
34: ; preds = %31, %28
%35 = phi i32 [ %33, %31 ], [ %29, %28 ]
%36 = icmp eq i32 %35, 39
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = tail call i32 (...) @inside_single_quote()
%39 = load i32, i32* %0
br label %40
40: ; preds = %37, %34
%41 = phi i32 [ %39, %37 ], [ %35, %34 ]
%42 = icmp eq i32 %41, 34
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 (...) @inside_string()
br label %45
45: ; preds = %43, %40
%46 = tail call i32 (...) @getchar()
store i32 %46, i32* %0
%47 = load i32, i32* @EOF
%48 = icmp eq i32 %46, %47
br i1 %48, label %49, label %11
49: ; preds = %11, %45, %3, %1
ret i32 0
}