#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 */
scalar_t__ BemFormada(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  printf("%s\n", BemFormada("((){()})") ? "Bem formada" : "Mal formada");
  printf("%s\n", BemFormada("({)}") ? "Bem formada" : "Mal formada");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed9(%rip),%rdi
call   1040 <BemFormada@plt>
mov    %rax,%rcx
lea    0xedf(%rip),%rsi
lea    0xecc(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
call   1040 <BemFormada@plt>
mov    %rax,%rcx
lea    0xeae(%rip),%rsi
lea    0xe9b(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed8(%rip),%rdi
call   1040 <BemFormada@plt>
test   %rax,%rax
lea    0xede(%rip),%r15
lea    0xecb(%rip),%rbx
mov    %rbx,%rsi
cmove  %r15,%rsi
lea    0xeb0(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
call   1040 <BemFormada@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [9 x i8] c"((){()})\00"
@.str.2 = [12 x i8] c"Bem formada\00"
@.str.3 = [12 x i8] c"Mal formada\00"
@.str.4 = [5 x i8] c"({)}\00"
define i32 @main() {
%1 = call i64 @BemFormada(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i64 @BemFormada(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [9 x i8] c"((){()})\00"
@.str.2 = [12 x i8] c"Bem formada\00"
@.str.3 = [12 x i8] c"Mal formada\00"
@.str.4 = [5 x i8] c"({)}\00"
define i32 @main() {
%1 = tail call i64 @BemFormada(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i64 @BemFormada(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}