#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*/ mystrtrim(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void test3() {
  char s1[20];
  strcpy(s1, "    hello   ");
  printf("Original: s1=<%s>\n", s1);
  mystrtrim(s1);
  printf("s1=<%s>\n", s1);
  strcpy(s1, "hello   ");
  printf("Original: s1=<%s>\n", s1);
  mystrtrim(s1);
  printf("s1=<%s>\n", s1);
  strcpy(s1, "    hello");
  printf("Original: s1=<%s>\n", s1);
  mystrtrim(s1);
  printf("s1=<%s>\n", s1);
  strcpy(s1, "hello");
  printf("Original: s1=<%s>\n", s1);
  mystrtrim(s1);
  printf("s1=<%s>\n", s1);
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <mystrtrim@plt>
lea    -0x20(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <mystrtrim@plt>
lea    -0x20(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <mystrtrim@plt>
lea    -0x20(%rbp),%rsi
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xe0f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <mystrtrim@plt>
lea    -0x20(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xec0(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xebb(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <mystrtrim@plt>
lea    0xeab(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <mystrtrim@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <mystrtrim@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <mystrtrim@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c" hello \00"
@.str.1 = [19 x i8] c"Original: s1=<%s>\0A\00"
@.str.2 = [9 x i8] c"s1=<%s>\0A\00"
@.str.3 = [9 x i8] c"hello \00"
@.str.4 = [10 x i8] c" hello\00"
@.str.5 = [6 x i8] c"hello\00"
define void @test3() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%7 = call i32 @mystrtrim(i8* %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%15 = call i32 @mystrtrim(i8* %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%23 = call i32 @mystrtrim(i8* %22)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%31 = call i32 @mystrtrim(i8* %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c" hello \00"
@.str.1 = [19 x i8] c"Original: s1=<%s>\0A\00"
@.str.2 = [9 x i8] c"s1=<%s>\0A\00"
@.str.3 = [9 x i8] c"hello \00"
@.str.4 = [10 x i8] c" hello\00"
@.str.5 = [6 x i8] c"hello\00"
define void @test3() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @mystrtrim(i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = call i32 @mystrtrim(i8* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%11 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%13 = call i32 @mystrtrim(i8* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%15 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%17 = call i32 @mystrtrim(i8* %2)
%18 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}