#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*/ check_oparthe(char *, char *);
int /*<<< orphan*/ check_operator(char *, char *);
int /*<<< orphan*/ check_parthe(char *, char *);
int /*<<< orphan*/ my_putstr(char *);
int check_expr(char *expr, char *base, char *ops) {
  if (expr == NULL || base == NULL || ops == NULL)
    return (0);
  if (!check_parthe(expr, ops)) {
    my_putstr("Incorrect number of parentheses\n");
    return (0);
  }
  if (!check_operator(expr, ops)) {
    my_putstr("Error with operators\n");
    return (0);
  }
  if (!check_oparthe(expr, ops)) {
    my_putstr("Operator before close parenthese\n");
    return (0);
  }
}


x86 assembly (clang, -O0):
<check_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1175 <check_expr+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1175 <check_expr+0x35>
cmpq   $0x0,-0x20(%rbp)
jne    1181 <check_expr+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1206 <check_expr+0xc6>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <check_parthe@plt>
cmp    $0x0,%eax
jne    11af <check_expr+0x6f>
lea    0xe62(%rip),%rdi
call   1050 <my_putstr@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <check_expr+0xc6>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <check_operator@plt>
cmp    $0x0,%eax
jne    11dd <check_expr+0x9d>
lea    0xe55(%rip),%rdi
call   1050 <my_putstr@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <check_expr+0xc6>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <check_oparthe@plt>
cmp    $0x0,%eax
jne    1206 <check_expr+0xc6>
lea    0xe3d(%rip),%rdi
call   1050 <my_putstr@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_expr>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11a1 <check_expr+0x61>
test   %rsi,%rsi
je     11a1 <check_expr+0x61>
mov    %rdx,%r14
test   %rdx,%rdx
je     11a1 <check_expr+0x61>
mov    %rdi,%rbx
mov    %r14,%rsi
call   1040 <check_parthe@plt>
test   %eax,%eax
je     118c <check_expr+0x4c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <check_operator@plt>
test   %eax,%eax
je     1195 <check_expr+0x55>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <check_oparthe@plt>
test   %eax,%eax
jne    11a1 <check_expr+0x61>
lea    0xead(%rip),%rdi
jmp    119c <check_expr+0x5c>
lea    0xe6d(%rip),%rdi
jmp    119c <check_expr+0x5c>
lea    0xe85(%rip),%rdi
call   1050 <my_putstr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Incorrect number of parentheses\0A\00"
@.str.1 = [22 x i8] c"Error with operators\0A\00"
@.str.2 = [34 x i8] c"Operator before close parenthese\0A\00"
define i32 @check_expr(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i8*, i8** %7
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %13, %10, %3
store i32 0, i32* %4
br label %38
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = load i8*, i8** %7
%20 = call i32 @check_parthe(i8* %18, i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = call i32 @my_putstr(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %38
24: ; preds = %17
%25 = load i8*, i8** %5
%26 = load i8*, i8** %7
%27 = call i32 @check_operator(i8* %25, i8* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = call i32 @my_putstr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %38
31: ; preds = %24
%32 = load i8*, i8** %5
%33 = load i8*, i8** %7
%34 = call i32 @check_oparthe(i8* %32, i8* %33)
%35 = icmp ne i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %31
%37 = call i32 @my_putstr(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %38
38: ; preds = %16, %22, %29, %36, %31
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
@.str = [33 x i8] c"Incorrect number of parentheses\0A\00"
@.str.1 = [22 x i8] c"Error with operators\0A\00"
@.str.2 = [34 x i8] c"Operator before close parenthese\0A\00"
define i32 @check_expr(i8* %0, i8* readnone %1, i8* %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i8* %1, null
%6 = or i1 %4, %5
%7 = icmp eq i8* %2, null
%8 = or i1 %6, %7
br i1 %8, label %21, label %9
9: ; preds = %3
%10 = tail call i32 @check_parthe(i8* %0, i8* %2)
%11 = icmp eq i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = tail call i32 @check_operator(i8* %0, i8* %2)
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i32 @check_oparthe(i8* %0, i8* %2)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15, %12, %9
%19 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), %9 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %12 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), %15 ]
%20 = tail call i32 @my_putstr(i8* %19)
br label %21
21: ; preds = %18, %3, %15
ret i32 0
}