#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 */
struct stack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int work_with2(char, struct stack **);
void work_with(char c, struct stack **pstack) {
  int r = work_with2(c, pstack);
  if (r & 0x10) {
    if (r & 0)
      fprintf(stderr, "closing parenthese error\n");
    if (r & 1)
      fprintf(stderr, "closing bracket error\n");
    if (r & 2)
      fprintf(stderr, "closing brace error\n");
  }
}


x86 assembly (clang, -O0):
<work_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <work_with2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11c4 <work_with+0xa4>
mov    -0x14(%rbp),%eax
and    $0x0,%eax
cmp    $0x0,%eax
je     1177 <work_with+0x57>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     119b <work_with+0x7b>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11bf <work_with+0x9f>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c4 <work_with+0xa4>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<work_with>:
push   %rbx
call   1040 <work_with2@plt>
mov    %eax,%ebx
test   $0x10,%bl
je     114c <work_with+0x2c>
test   $0x1,%bl
je     1147 <work_with+0x27>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
test   $0x2,%bl
jne    114e <work_with+0x2e>
pop    %rbx
ret
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.stack = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"closing parenthese error\0A\00"
@.str.1 = [23 x i8] c"closing bracket error\0A\00"
@.str.2 = [21 x i8] c"closing brace error\0A\00"
define void @work_with(i8 signext %0, %struct.stack** %1) {
%3 = alloca i8
%4 = alloca %struct.stack**
%5 = alloca i32
store i8 %0, i8* %3
store %struct.stack** %1, %struct.stack*** %4
%6 = load i8, i8* %3
%7 = load %struct.stack**, %struct.stack*** %4
%8 = call i32 @work_with2(i8 signext %6, %struct.stack** %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = and i32 %9, 16
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %2
%13 = load i32, i32* %5
%14 = and i32 %13, 0
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %16, %12
%20 = load i32, i32* %5
%21 = and i32 %20, 1
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %23, %19
%27 = load i32, i32* %5
%28 = and i32 %27, 2
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %30, %26
br label %34
34: ; preds = %33, %2
ret void
}

LLVM IR (-O2):
%struct.stack = type { i32 }
@stderr = global i32 0
@.str.1 = [23 x i8] c"closing bracket error\0A\00"
@.str.2 = [21 x i8] c"closing brace error\0A\00"
define void @work_with(i8 signext %0, %struct.stack** %1) {
%3 = tail call i32 @work_with2(i8 signext %0, %struct.stack** %1)
%4 = and i32 %3, 16
%5 = icmp eq i32 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %2
%7 = and i32 %3, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %6
%13 = and i32 %3, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %12, %15, %2
ret void
}