#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*/ assert(int);
char closing_bracket(char open_bracket) {
  assert(open_bracket == '(' || open_bracket == '[' || open_bracket == '{');
  switch (open_bracket) {
  case '(':
    return ')';
  case '[':
    return ']';
  case '{':
    return '}';
  }
}


x86 assembly (clang, -O0):
<closing_bracket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%ecx
mov    $0x1,%al
cmp    $0x28,%ecx
mov    %al,-0x3(%rbp)
je     114f <closing_bracket+0x3f>
movsbl -0x2(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5b,%ecx
mov    %al,-0x3(%rbp)
je     114f <closing_bracket+0x3f>
movsbl -0x2(%rbp),%eax
cmp    $0x7b,%eax
sete   %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
movzbl %al,%edi
and    $0x1,%edi
call   1030 <assert@plt>
movsbl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x28,%eax
je     1194 <closing_bracket+0x84>
jmp    1172 <closing_bracket+0x62>
mov    -0x8(%rbp),%eax
sub    $0x5b,%eax
je     119d <closing_bracket+0x8d>
jmp    1183 <closing_bracket+0x73>
mov    -0x8(%rbp),%eax
sub    $0x7b,%eax
je     11a6 <closing_bracket+0x96>
jmp    11aa <closing_bracket+0x9a>
movb   $0x29,-0x1(%rbp)
jmp    11aa <closing_bracket+0x9a>
movb   $0x5d,-0x1(%rbp)
jmp    11aa <closing_bracket+0x9a>
movb   $0x7d,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closing_bracket>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
cmp    $0x28,%bl
je     112b <closing_bracket+0x1b>
cmp    $0x5b,%bl
je     112b <closing_bracket+0x1b>
xor    %edi,%edi
cmp    $0x7b,%bl
sete   %dil
call   1030 <assert@plt>
cmp    $0x5b,%bl
mov    $0x5d,%eax
mov    $0x29,%ecx
cmove  %eax,%ecx
cmp    $0x7b,%bl
mov    $0x7d,%eax
cmovne %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @closing_bracket(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 40
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 91
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 123
br label %15
15: ; preds = %11, %7, %1
%16 = phi i1 [ true, %7 ], [ true, %1 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
switch i32 %20, label %24 [
i32 40, label %21
i32 91, label %22
i32 123, label %23
]
21: ; preds = %15
store i8 41, i8* %2
br label %24
22: ; preds = %15
store i8 93, i8* %2
br label %24
23: ; preds = %15
store i8 125, i8* %2
br label %24
24: ; preds = %21, %22, %23, %15
%25 = load i8, i8* %2
ret i8 %25
}

LLVM IR (-O2):
define signext i8 @closing_bracket(i8 signext %0) {
switch i8 %0, label %2 [
i8 91, label %5
i8 40, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 123
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
%7 = tail call i32 @assert(i32 %6)
%8 = icmp eq i8 %0, 91
%9 = select i1 %8, i8 93, i8 41
%10 = icmp eq i8 %0, 123
%11 = select i1 %10, i8 125, i8 %9
ret i8 %11
}