#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*/ printf(char *, ...);
int /*<<< orphan*/ trim(char *);
int /*<<< orphan*/ trim2(char *);
int main(int argc, char *argv[]) {
  printf("Hello, world!\n");
  char test1[] = "  AB C ";
  trim(test1);
  printf("test1: [%s] \n", test1);
  char test2[] = "  AB C ";
  trim2(test2);
  printf("test2: [%s] \n", test2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <trim@plt>
lea    -0x18(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe8e(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <trim2@plt>
lea    -0x20(%rbp),%rsi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
movabs $0x20432042412020,%r14
mov    %r14,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <trim@plt>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <trim2@plt>
lea    0xe75(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, world!\0A\00"
@__const.main.test1 = [8 x i8] c" AB C \00"
@.str.1 = [14 x i8] c"test1: [%s] \0A\00"
@__const.main.test2 = [8 x i8] c" AB C \00"
@.str.2 = [14 x i8] c"test2: [%s] \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i8]
%7 = alloca [8 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = bitcast [8 x i8]* %6 to i8*
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%11 = call i32 @trim(i8* %10)
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = bitcast [8 x i8]* %7 to i8*
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%16 = call i32 @trim2(i8* %15)
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"test1: [%s] \0A\00"
@.str.2 = [14 x i8] c"test2: [%s] \0A\00"
@str = [14 x i8] c"Hello, world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i64
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%6 = bitcast i64* %3 to i8*
store i64 9081005084319776, i64* %3
%7 = call i32 @trim(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%9 = bitcast i64* %4 to i8*
store i64 9081005084319776, i64* %4
%10 = call i32 @trim2(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i64* %4)
ret i32 0
}