#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 */
char *Pascal2DownLine(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int test21() {
  char *camelback_test = "AaaBbCccDdd";
  char *anticipated_test = "aaa_bb_ccc_ddd";
  printf("Input is %s\n", camelback_test);
  char *result = Pascal2DownLine(camelback_test);
  printf("result is %s \n", result);
  if (strcmp(anticipated_test, result) == 0) {
    free(result);
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<test21>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <Pascal2DownLine@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <test21+0x77>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11be <test21+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test21>:
push   %rbx
lea    0xed3(%rip),%rdi
lea    0xeb1(%rip),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Pascal2DownLine@plt>
mov    %rax,%rbx
lea    0xebf(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     118c <test21+0x4c>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"AaaBbCccDdd\00"
@.str.1 = [15 x i8] c"aaa_bb_ccc_ddd\00"
@.str.2 = [13 x i8] c"Input is %s\0A\00"
@.str.3 = [15 x i8] c"result is %s \0A\00"
define i32 @test21() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %2
%8 = call i8* @Pascal2DownLine(i8* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = load i8*, i8** %4
%17 = call i32 @free(i8* %16)
store i32 1, i32* %1
br label %19
18: ; preds = %0
store i32 0, i32* %1
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [12 x i8] c"AaaBbCccDdd\00"
@.str.1 = [15 x i8] c"aaa_bb_ccc_ddd\00"
@.str.2 = [13 x i8] c"Input is %s\0A\00"
@.str.3 = [15 x i8] c"result is %s \0A\00"
define i32 @test21() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i8* @Pascal2DownLine(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @free(i8* %2)
br label %8
8: ; preds = %0, %6
%9 = phi i32 [ 1, %6 ], [ 0, %0 ]
ret i32 %9
}