#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 bc(char);
char *segment(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
char *parttwo(char *g) {
  int brackets = 0, i = 0;
  while (1) {
    char c = g[i];
    if (c == '(') {
      brackets += 1;
    }
    if (c == ')') {
      brackets -= 1;
    }
    if (bc(c) == 1 && brackets == 1) {
      char *fmla2 = segment(g, i + 2, strlen(g));
      return fmla2;
      break;
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<parttwo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x28,%eax
jne    116e <parttwo+0x3e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x29,%eax
jne    1184 <parttwo+0x54>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <bc@plt>
cmp    $0x1,%eax
jne    11d6 <parttwo+0xa6>
cmpl   $0x1,-0xc(%rbp)
jne    11d6 <parttwo+0xa6>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1050 <segment@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114a <parttwo+0x1a>

x86 assembly (clang, -O2):
<parttwo>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
xor    %eax,%eax
cmp    $0x29,%edi
sete   %al
xor    %ecx,%ecx
cmp    $0x28,%edi
sete   %cl
add    %ecx,%ebp
sub    %eax,%ebp
call   1030 <bc@plt>
add    $0x1,%rbx
cmp    $0x1,%eax
jne    1140 <parttwo+0x10>
cmp    $0x1,%ebp
jne    1140 <parttwo+0x10>
add    $0x1,%ebx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <segment@plt>

LLVM IR (-O0):
define i8* @parttwo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %1, %41
%8 = load i8*, i8** %2
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %5
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 40
br i1 %15, label %16, label %19
16: ; preds = %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %19
19: ; preds = %16, %7
%20 = load i8, i8* %5
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 41
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %19
%27 = load i8, i8* %5
%28 = call i32 @bc(i8 signext %27)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load i8*, i8** %2
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 2
%37 = load i8*, i8** %2
%38 = call i32 @strlen(i8* %37)
%39 = call i8* @segment(i8* %34, i32 %36, i32 %38)
store i8* %39, i8** %6
%40 = load i8*, i8** %6
ret i8* %40
41: ; preds = %30, %26
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %7
}

LLVM IR (-O2):
define i8* @parttwo(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %17, %2 ], [ 0, %1 ]
%4 = phi i32 [ %12, %2 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 40
%8 = zext i1 %7 to i32
%9 = add nsw i32 %4, %8
%10 = icmp eq i8 %6, 41
%11 = sext i1 %10 to i32
%12 = add nsw i32 %9, %11
%13 = tail call i32 @bc(i8 signext %6)
%14 = icmp eq i32 %13, 1
%15 = icmp eq i32 %12, 1
%16 = select i1 %14, i1 %15, i1 false
%17 = add nuw i64 %3, 1
br i1 %16, label %18, label %2
18: ; preds = %2
%19 = trunc i64 %3 to i32
%20 = add nuw nsw i32 %19, 2
%21 = tail call i32 @strlen(i8* %0)
%22 = tail call i8* @segment(i8* %0, i32 %20, i32 %21)
ret i8* %22
}