#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*/ __crow_f8(int /*<<< orphan*/, int /*<<< orphan*/);
int expect(int /*<<< orphan*/, int /*<<< orphan*/);
char *listToString(int /*<<< orphan*/);
int /*<<< orphan*/ memcmp(char const *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stringToList(char const *);
int /*<<< orphan*/ strlen(char const *);
int test_f8() {
  const char *foo = "foo";
  const char *bar = "bar";
  const char *foobar = "foobar";
  char *s = listToString(__crow_f8(stringToList(foo), stringToList(bar)));
  return expect(0, memcmp(foobar, s, strlen(foobar)));
}


x86 assembly (clang, -O0):
<test_f8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe7f(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <stringToList@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <stringToList@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1030 <__crow_f8@plt>
mov    %eax,%edi
call   1080 <listToString@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1060 <memcmp@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1040 <expect@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_f8>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rdi
call   1070 <stringToList@plt>
mov    %eax,%ebx
lea    0xe8e(%rip),%rdi
call   1070 <stringToList@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <__crow_f8@plt>
mov    %eax,%edi
call   1080 <listToString@plt>
mov    %rax,%rbx
lea    0xe6c(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <memcmp@plt>
xor    %edi,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <expect@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
@.str.2 = [7 x i8] c"foobar\00"
define i32 @test_f8() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %1
%6 = call i32 @stringToList(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @stringToList(i8* %7)
%9 = call i32 @__crow_f8(i32 %6, i32 %8)
%10 = call i8* @listToString(i32 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @memcmp(i8* %11, i8* %12, i32 %14)
%16 = call i32 @expect(i32 0, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
@.str.2 = [7 x i8] c"foobar\00"
define i32 @test_f8() {
%1 = tail call i32 @stringToList(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @stringToList(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @__crow_f8(i32 %1, i32 %2)
%4 = tail call i8* @listToString(i32 %3)
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32 %5)
%7 = tail call i32 @expect(i32 0, i32 %6)
ret i32 %7
}