#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*/ balance_symbols_c(char *);
int /*<<< orphan*/ balance_symbols_pascal(char *);
char *get_filename_ext(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void balance_symbols(char *filename) {
  char *ext = get_filename_ext(filename);
  if (!strcmp(ext, "pas"))
    balance_symbols_pascal(filename);
  if (!strcmp(ext, "c"))
    balance_symbols_c(filename);
}


x86 assembly (clang, -O0):
<balance_symbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_filename_ext@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    117b <balance_symbols+0x3b>
mov    -0x8(%rbp),%rdi
call   1030 <balance_symbols_pascal@plt>
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119d <balance_symbols+0x5d>
mov    -0x8(%rbp),%rdi
call   1060 <balance_symbols_c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<balance_symbols>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <get_filename_ext@plt>
mov    %rax,%rbx
lea    0xeaa(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    116a <balance_symbols+0x2a>
mov    %r14,%rdi
call   1030 <balance_symbols_pascal@plt>
lea    0xe93(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1185 <balance_symbols+0x45>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <balance_symbols_c@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"pas\00"
@.str.1 = [2 x i8] c"c\00"
define void @balance_symbols(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @get_filename_ext(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @balance_symbols_pascal(i8* %10)
br label %12
12: ; preds = %9, %1
%13 = load i8*, i8** %3
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i8*, i8** %2
%18 = call i32 @balance_symbols_c(i8* %17)
br label %19
19: ; preds = %16, %12
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"pas\00"
@.str.1 = [2 x i8] c"c\00"
define void @balance_symbols(i8* %0) {
%2 = tail call i8* @get_filename_ext(i8* %0)
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @balance_symbols_pascal(i8* %0)
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @balance_symbols_c(i8* %0)
br label %12
12: ; preds = %10, %7
ret void
}