#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__ strcmp(char *, char *);
size_t trimwhitespace(char *, char *);
char *test_trimwhitespace1() {
  char str[] = "  dt  ";
  char out[20];
  size_t size = trimwhitespace(out, str);
  do {
    if (!(size == 2))
      return "1: size != 2";
  } while (0);
  do {
    if (!(strcmp(out, "dt") == 0))
      return "1: after trim str != dt";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_trimwhitespace1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xec4(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0xf(%rbp),%rsi
call   1030 <trimwhitespace@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x2,-0x38(%rbp)
je     1171 <test_trimwhitespace1+0x51>
lea    0xe9f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b2 <test_trimwhitespace1+0x92>
jmp    1176 <test_trimwhitespace1+0x56>
jmp    117b <test_trimwhitespace1+0x5b>
lea    -0x30(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11a5 <test_trimwhitespace1+0x85>
lea    0xe78(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b2 <test_trimwhitespace1+0x92>
jmp    11aa <test_trimwhitespace1+0x8a>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_trimwhitespace1>:
sub    $0x28,%rsp
movl   $0x202074,0xb(%rsp)
movl   $0x74642020,0x8(%rsp)
74
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <trimwhitespace@plt>
cmp    $0x2,%rax
jne    1170 <test_trimwhitespace1+0x50>
lea    0xed9(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
test   %rax,%rax
lea    0xead(%rip),%rax
cmove  %rcx,%rax
add    $0x28,%rsp
ret
lea    0xe90(%rip),%rax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_trimwhitespace1.str = [7 x i8] c" dt \00"
@.str = [13 x i8] c"1: size != 2\00"
@.str.1 = [3 x i8] c"dt\00"
@.str.2 = [24 x i8] c"1: after trim str != dt\00"
define i8* @test_trimwhitespace1() {
%1 = alloca i8*
%2 = alloca [7 x i8]
%3 = alloca [20 x i8]
%4 = alloca i64
%5 = bitcast [7 x i8]* %2 to i8*
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = call i64 @trimwhitespace(i8* %6, i8* %7)
store i64 %8, i64* %4
br label %9
9: ; preds = %0
%10 = load i64, i64* %4
%11 = icmp eq i64 %10, 2
br i1 %11, label %13, label %12
12: ; preds = %9
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %1
br label %22
13: ; preds = %9
br label %14
14: ; preds = %13
br label %15
15: ; preds = %14
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %15
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %22
20: ; preds = %15
br label %21
21: ; preds = %20
store i8* null, i8** %1
br label %22
22: ; preds = %21, %19, %12
%23 = load i8*, i8** %1
ret i8* %23
}

LLVM IR (-O2):
@__const.test_trimwhitespace1.str = [7 x i8] c" dt \00"
@.str = [13 x i8] c"1: size != 2\00"
@.str.1 = [3 x i8] c"dt\00"
@.str.2 = [24 x i8] c"1: after trim str != dt\00"
define i8* @test_trimwhitespace1() {
%1 = alloca [7 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i64 @trimwhitespace(i8* %4, i8* %3)
%6 = icmp eq i64 %5, 2
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* null, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0)
br label %11
11: ; preds = %7, %0
%12 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %0 ], [ %10, %7 ]
ret i8* %12
}