#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*/ bsCompare(char *);
int /*<<< orphan*/ bsConcat(char *);
int /*<<< orphan*/ bsFree(char *);
int /*<<< orphan*/ bsInstr(char *);
int /*<<< orphan*/ bsLen(char *);
int /*<<< orphan*/ bsMid(char *);
int /*<<< orphan*/ bsPrint(char *);
int /*<<< orphan*/ bsPrintLn(char *);
int /*<<< orphan*/ bsUcase(char *);
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int test(char *in) {
  char *t = malloc(strlen(in) + 1);
  int ret = 0;
  printf("==============================\n");
  printf("New Test: \"%s\"\n", in);
  printf("==============================\n");
  strcpy(t, in);
  bsFree(t);
  printf("bsFree  : \"%s\"\n", t);
  strcpy(t, in);
  bsLen(t);
  printf("bsLen  : \"%s\"\n", t);
  strcpy(t, in);
  bsConcat(t);
  printf("bsConcat    : \"%s\"\n", t);
  strcpy(t, in);
  bsPrint(t);
  printf("bsPrint  : \"%s\"\n", t);
  strcpy(t, in);
  bsPrintLn(t);
  printf("bsPrintLn     : \"%s\"\n", t);
  strcpy(t, in);
  bsMid(t);
  printf("bsMid: \"%s\"\n", t);
  strcpy(t, in);
  bsUcase(t);
  printf("bsUcase     : \"%s\"\n", t);
  strcpy(t, in);
  bsCompare(t);
  printf("bsCompare     : \"%s\"\n", t);
  strcpy(t, in);
  bsInstr(t);
  printf("bsPrintLn     : \"%s\"\n", t);
  free(t);
  return 1;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10e0 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1080 <bsFree@plt>
mov    -0x10(%rbp),%rsi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <bsLen@plt>
mov    -0x10(%rbp),%rsi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <bsConcat@plt>
mov    -0x10(%rbp),%rsi
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1100 <bsPrint@plt>
mov    -0x10(%rbp),%rsi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <bsPrintLn@plt>
mov    -0x10(%rbp),%rsi
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <bsMid@plt>
mov    -0x10(%rbp),%rsi
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <bsUcase@plt>
mov    -0x10(%rbp),%rsi
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   10d0 <bsCompare@plt>
mov    -0x10(%rbp),%rsi
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   10f0 <bsInstr@plt>
mov    -0x10(%rbp),%rsi
lea    0xcd9(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <free@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1080 <strlen@plt>
lea    0x1(%rax),%rdi
call   10f0 <malloc@plt>
mov    %rax,%rbx
lea    0xe91(%rip),%r15
mov    %r15,%rdi
call   1070 <puts@plt>
lea    0xde1(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r15,%rdi
call   1070 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   1090 <bsFree@plt>
lea    0xdc5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <bsLen@plt>
lea    0xdb1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   10c0 <bsConcat@plt>
lea    0xd9c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   1110 <bsPrint@plt>
lea    0xd8c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <bsPrintLn@plt>
lea    0xd79(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   10b0 <bsMid@plt>
lea    0xd68(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   10d0 <bsUcase@plt>
lea    0xd51(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   10e0 <bsCompare@plt>
lea    0xd41(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   1100 <bsInstr@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
call   1050 <free@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"==============================\0A\00"
@.str.1 = [16 x i8] c"New Test: \22%s\22\0A\00"
@.str.2 = [16 x i8] c"bsFree : \22%s\22\0A\00"
@.str.3 = [15 x i8] c"bsLen : \22%s\22\0A\00"
@.str.4 = [20 x i8] c"bsConcat : \22%s\22\0A\00"
@.str.5 = [17 x i8] c"bsPrint : \22%s\22\0A\00"
@.str.6 = [22 x i8] c"bsPrintLn : \22%s\22\0A\00"
@.str.7 = [13 x i8] c"bsMid: \22%s\22\0A\00"
@.str.8 = [20 x i8] c"bsUcase : \22%s\22\0A\00"
@.str.9 = [22 x i8] c"bsCompare : \22%s\22\0A\00"
define i32 @test(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %3
store i32 0, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 @bsFree(i8* %16)
%18 = load i8*, i8** %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %3
%21 = load i8*, i8** %2
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = load i8*, i8** %3
%24 = call i32 @bsLen(i8* %23)
%25 = load i8*, i8** %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %3
%28 = load i8*, i8** %2
%29 = call i32 @strcpy(i8* %27, i8* %28)
%30 = load i8*, i8** %3
%31 = call i32 @bsConcat(i8* %30)
%32 = load i8*, i8** %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%34 = load i8*, i8** %3
%35 = load i8*, i8** %2
%36 = call i32 @strcpy(i8* %34, i8* %35)
%37 = load i8*, i8** %3
%38 = call i32 @bsPrint(i8* %37)
%39 = load i8*, i8** %3
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %3
%42 = load i8*, i8** %2
%43 = call i32 @strcpy(i8* %41, i8* %42)
%44 = load i8*, i8** %3
%45 = call i32 @bsPrintLn(i8* %44)
%46 = load i8*, i8** %3
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %46)
%48 = load i8*, i8** %3
%49 = load i8*, i8** %2
%50 = call i32 @strcpy(i8* %48, i8* %49)
%51 = load i8*, i8** %3
%52 = call i32 @bsMid(i8* %51)
%53 = load i8*, i8** %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %53)
%55 = load i8*, i8** %3
%56 = load i8*, i8** %2
%57 = call i32 @strcpy(i8* %55, i8* %56)
%58 = load i8*, i8** %3
%59 = call i32 @bsUcase(i8* %58)
%60 = load i8*, i8** %3
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %60)
%62 = load i8*, i8** %3
%63 = load i8*, i8** %2
%64 = call i32 @strcpy(i8* %62, i8* %63)
%65 = load i8*, i8** %3
%66 = call i32 @bsCompare(i8* %65)
%67 = load i8*, i8** %3
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %67)
%69 = load i8*, i8** %3
%70 = load i8*, i8** %2
%71 = call i32 @strcpy(i8* %69, i8* %70)
%72 = load i8*, i8** %3
%73 = call i32 @bsInstr(i8* %72)
%74 = load i8*, i8** %3
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %74)
%76 = load i8*, i8** %3
%77 = call i32 @free(i8* %76)
ret i32 1
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"New Test: \22%s\22\0A\00"
@.str.2 = [16 x i8] c"bsFree : \22%s\22\0A\00"
@.str.3 = [15 x i8] c"bsLen : \22%s\22\0A\00"
@.str.4 = [20 x i8] c"bsConcat : \22%s\22\0A\00"
@.str.5 = [17 x i8] c"bsPrint : \22%s\22\0A\00"
@.str.6 = [22 x i8] c"bsPrintLn : \22%s\22\0A\00"
@.str.7 = [13 x i8] c"bsMid: \22%s\22\0A\00"
@.str.8 = [20 x i8] c"bsUcase : \22%s\22\0A\00"
@.str.9 = [22 x i8] c"bsCompare : \22%s\22\0A\00"
@str.10 = [31 x i8] c"==============================\00"
define i32 @test(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%8 = tail call i32 @strcpy(i8* %4, i8* %0)
%9 = tail call i32 @bsFree(i8* %4)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%11 = tail call i32 @strcpy(i8* %4, i8* %0)
%12 = tail call i32 @bsLen(i8* %4)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%14 = tail call i32 @strcpy(i8* %4, i8* %0)
%15 = tail call i32 @bsConcat(i8* %4)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%17 = tail call i32 @strcpy(i8* %4, i8* %0)
%18 = tail call i32 @bsPrint(i8* %4)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%20 = tail call i32 @strcpy(i8* %4, i8* %0)
%21 = tail call i32 @bsPrintLn(i8* %4)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%23 = tail call i32 @strcpy(i8* %4, i8* %0)
%24 = tail call i32 @bsMid(i8* %4)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%26 = tail call i32 @strcpy(i8* %4, i8* %0)
%27 = tail call i32 @bsUcase(i8* %4)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%29 = tail call i32 @strcpy(i8* %4, i8* %0)
%30 = tail call i32 @bsCompare(i8* %4)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %4)
%32 = tail call i32 @strcpy(i8* %4, i8* %0)
%33 = tail call i32 @bsInstr(i8* %4)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%35 = tail call i32 @free(i8* %4)
ret i32 1
}