#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*/ compare_strings(char *, char *);
char *solve_sub_paren(char *);
char *solve_sub_string(char *);
char *solve(char buffer[]) {
  char *string = buffer;
  do {
    buffer = string;
    string = solve_sub_paren(buffer);
  } while (!compare_strings(string, buffer));
  do {
    buffer = string;
    string = solve_sub_string(buffer);
  } while (!compare_strings(string, buffer));
  return string;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <solve_sub_paren@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <compare_strings@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1144 <solve+0x14>
jmp    117b <solve+0x4b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <solve_sub_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <compare_strings@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117b <solve+0x4b>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%r14
mov    %rbx,%rdi
call   1030 <solve_sub_paren@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <compare_strings@plt>
test   %eax,%eax
je     1140 <solve+0x10>
nopl   (%rax)
mov    %rbx,%r14
mov    %rbx,%rdi
call   1050 <solve_sub_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <compare_strings@plt>
test   %eax,%eax
je     1160 <solve+0x30>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @solve(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %9, %1
%6 = load i8*, i8** %3
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @solve_sub_paren(i8* %7)
store i8* %8, i8** %3
br label %9
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = call i32 @compare_strings(i8* %10, i8* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %5, label %15
15: ; preds = %9
br label %16
16: ; preds = %20, %15
%17 = load i8*, i8** %3
store i8* %17, i8** %2
%18 = load i8*, i8** %2
%19 = call i8* @solve_sub_string(i8* %18)
store i8* %19, i8** %3
br label %20
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = load i8*, i8** %2
%23 = call i32 @compare_strings(i8* %21, i8* %22)
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
br i1 %25, label %16, label %26
26: ; preds = %20
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
define i8* @solve(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = tail call i8* @solve_sub_paren(i8* %3)
%5 = tail call i32 @compare_strings(i8* %4, i8* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %2, label %7
7: ; preds = %2, %7
%8 = phi i8* [ %9, %7 ], [ %4, %2 ]
%9 = tail call i8* @solve_sub_string(i8* %8)
%10 = tail call i32 @compare_strings(i8* %9, i8* %8)
%11 = icmp eq i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7
ret i8* %9
}