#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*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char const *, char *);
char *trimWhitespace(char const *);
bool testTrimWhitespace0(void) {
  char const *line = "   Something in between  \n";
  char const *expected = "Something in between";
  char *actual = trimWhitespace(line);
  bool retval;
  if (NULL == actual) {
    return false;
  }
  if (0 == strcmp(expected, actual)) {
    retval = true;
  } else {
    printf("Bad trimmed value: '%s'\n", actual);
    retval = false;
  }
  free(actual);
  return retval;
}


x86 assembly (clang, -O0):
<testTrimWhitespace0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <trimWhitespace@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1183 <testTrimWhitespace0+0x43>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <testTrimWhitespace0+0x90>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11aa <testTrimWhitespace0+0x6a>
movl   $0x1,-0x24(%rbp)
jmp    11c1 <testTrimWhitespace0+0x81>
mov    -0x20(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTrimWhitespace0>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
call   1040 <trimWhitespace@plt>
test   %rax,%rax
je     117e <testTrimWhitespace0+0x3e>
mov    %rax,%rbx
lea    0xebd(%rip),%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1182 <testTrimWhitespace0+0x42>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %ebp,%ebp
jmp    1187 <testTrimWhitespace0+0x47>
xor    %ebp,%ebp
jmp    118f <testTrimWhitespace0+0x4f>
mov    $0x1,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c" Something in between \0A\00"
@.str.1 = [21 x i8] c"Something in between\00"
@.str.2 = [25 x i8] c"Bad trimmed value: '%s'\0A\00"
define i32 @testTrimWhitespace0() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %3
%6 = load i8*, i8** %2
%7 = call i8* @trimWhitespace(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp eq i8* null, %8
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 0, i32* %1
br label %24
11: ; preds = %0
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 0, %14
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 1, i32* %5
br label %20
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %18)
store i32 0, i32* %5
br label %20
20: ; preds = %17, %16
%21 = load i8*, i8** %4
%22 = call i32 @free(i8* %21)
%23 = load i32, i32* %5
store i32 %23, i32* %1
br label %24
24: ; preds = %20, %10
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [27 x i8] c" Something in between \0A\00"
@.str.1 = [21 x i8] c"Something in between\00"
@.str.2 = [25 x i8] c"Bad trimmed value: '%s'\0A\00"
define i32 @testTrimWhitespace0() {
%1 = tail call i8* @trimWhitespace(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ 0, %6 ], [ 1, %3 ]
%10 = tail call i32 @free(i8* %1)
br label %11
11: ; preds = %0, %8
%12 = phi i32 [ %9, %8 ], [ 0, %0 ]
ret i32 %12
}