#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 strlen(char *);
int langoac(char a) {
  int i;
  char ngoac[] = {'(', ')', '<', '>', '{', '}', '[', ']'};
  for (i = 0; i < strlen(ngoac); i++) {
    if (a == ngoac[i])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<langoac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1180 <langoac+0x70>
movsbl -0x5(%rbp),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x14(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    116d <langoac+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    1187 <langoac+0x77>
jmp    1172 <langoac+0x62>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1130 <langoac+0x20>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<langoac>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebp
movabs $0x5d5b7d7b3e3c2928,%rax
7d 5b 5d
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    115a <langoac+0x4a>
xor    %ebx,%ebx
lea    0x8(%rsp),%r14
xchg   %ax,%ax
cmp    %bpl,0x8(%rsp,%rbx,1)
je     115e <langoac+0x4e>
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <langoac+0x30>
xor    %eax,%eax
jmp    1163 <langoac+0x53>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.langoac.ngoac = [8 x i8] c"()<>{}[]"
define i32 @langoac(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
%5 = alloca [8 x i8]
store i8 %0, i8* %3
%6 = bitcast [8 x i8]* %5 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %23, %1
%8 = load i32, i32* %4
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %26
12: ; preds = %7
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %14, %19
br i1 %20, label %21, label %22
21: ; preds = %12
store i32 1, i32* %2
br label %27
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %7
26: ; preds = %7
store i32 0, i32* %2
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @langoac(i8 signext %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to [8 x i8]*
%4 = bitcast i64* %2 to i8*
store i64 6727108436686547240, i64* %2
%5 = call i32 @strlen(i8* %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %11, label %17
7: ; preds = %11
%8 = call i32 @strlen(i8* %4)
%9 = sext i32 %8 to i64
%10 = icmp slt i64 %16, %9
br i1 %10, label %11, label %17
11: ; preds = %1, %7
%12 = phi i64 [ %16, %7 ], [ 0, %1 ]
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, %0
%16 = add nuw nsw i64 %12, 1
br i1 %15, label %17, label %7
17: ; preds = %11, %7, %1
%18 = phi i32 [ 0, %1 ], [ 0, %7 ], [ 1, %11 ]
ret i32 %18
}