#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 EXIT_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ strappend(char *, char *);
int strchrncount(char *, char, int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char *);
char *strdup(char *);
int strendswith(char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strstrstrip(char *, char *);
int main(int argc, char **argv) {
  char *v = strdup("hello");
  assert(!strcmp(strappend(v, " world!"), "hello world!"));
  assert(strchrncount(v, 'o', strlen(v)) == 2);
  assert(strendswith(v, "world!") == 1);
  assert(!strcmp(strstrstrip(v, "o w"), "hellorld!"));
  return EXIT_SUCCESS;
}


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    0xe63(%rip),%rdi
call   10a0 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1060 <strappend@plt>
mov    %eax,%edi
lea    0xe47(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
mov    $0x6f,%esi
call   1040 <strchrncount@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x18(%rbp),%rdi
lea    0xdfa(%rip),%rsi
call   1030 <strendswith@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x18(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1090 <strstrstrip@plt>
mov    %eax,%edi
lea    0xdd7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xe78(%rip),%rdi
call   10a0 <strdup@plt>
mov    %rax,%rbx
lea    0xe74(%rip),%rsi
mov    %rax,%rdi
call   1060 <strappend@plt>
lea    0xe60(%rip),%rsi
mov    %eax,%edi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    %eax,%edx
call   1040 <strchrncount@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strendswith@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xe10(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strstrstrip@plt>
lea    0xe05(%rip),%rsi
mov    %eax,%edi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [8 x i8] c" world!\00"
@.str.2 = [13 x i8] c"hello world!\00"
@.str.3 = [7 x i8] c"world!\00"
@.str.4 = [4 x i8] c"o w\00"
@.str.5 = [10 x i8] c"hellorld!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @strappend(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @strcmp(i32 %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i8*, i8** %6
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @strchrncount(i8* %15, i8 signext 111, i32 %17)
%19 = icmp eq i32 %18, 2
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i8*, i8** %6
%23 = call i32 @strendswith(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i8*, i8** %6
%28 = call i32 @strstrstrip(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @strcmp(i32 %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load i32, i32* @EXIT_SUCCESS
ret i32 %34
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [8 x i8] c" world!\00"
@.str.2 = [13 x i8] c"hello world!\00"
@.str.3 = [7 x i8] c"world!\00"
@.str.4 = [4 x i8] c"o w\00"
@.str.5 = [10 x i8] c"hellorld!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(6) i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strappend(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @strcmp(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @strlen(i8* %3)
%10 = tail call i32 @strchrncount(i8* %3, i8 signext 111, i32 %9)
%11 = icmp eq i32 %10, 2
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @strendswith(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @strstrstrip(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%19 = tail call i32 @strcmp(i32 %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}