#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*/ test(char *, char *, int);
int main() {
  test(NULL, NULL, -1);
  test("a", "x", -1);
  test("a", "a", 0);
  test("ab", "b", 1);
  test("abcd", "bc", 1);
  test("abc", "", -1);
  test("a", "xxx", -1);
  test("", "ab", -1);
  test("", "", -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffff,%edx
mov    %rsi,%rdi
call   1030 <test@plt>
lea    0xec9(%rip),%rdi
lea    0xed2(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
lea    0xeb1(%rip),%rsi
xor    %edx,%edx
mov    %rsi,%rdi
call   1030 <test@plt>
lea    0xea2(%rip),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x1,%edx
call   1030 <test@plt>
lea    0xe8d(%rip),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x1,%edx
call   1030 <test@plt>
lea    0xe7a(%rip),%rdi
lea    0xe6a(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
lea    0xe58(%rip),%rdi
lea    0xe5f(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
lea    0xe41(%rip),%rdi
lea    0xe3b(%rip),%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
lea    0xe29(%rip),%rsi
mov    $0xffffffff,%edx
mov    %rsi,%rdi
call   1030 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1030 <test@plt>
lea    0xed6(%rip),%r15
lea    0xedf(%rip),%rsi
mov    %r15,%rdi
mov    $0xffffffff,%edx
call   1030 <test@plt>
mov    %r15,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <test@plt>
lea    0xeb0(%rip),%r14
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1030 <test@plt>
lea    0xe98(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x1,%edx
call   1030 <test@plt>
lea    0xe85(%rip),%rdi
lea    0xe75(%rip),%rbx
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
lea    0xe6e(%rip),%rsi
mov    %r15,%rdi
mov    $0xffffffff,%edx
call   1030 <test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [3 x i8] c"ab\00"
@.str.3 = [2 x i8] c"b\00"
@.str.4 = [5 x i8] c"abcd\00"
@.str.5 = [3 x i8] c"bc\00"
@.str.6 = [4 x i8] c"abc\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [4 x i8] c"xxx\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test(i8* null, i8* null, i32 -1)
%3 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%4 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%6 = call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 1)
%7 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%8 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 -1)
%9 = call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%10 = call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i32 -1)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [3 x i8] c"ab\00"
@.str.3 = [2 x i8] c"b\00"
@.str.4 = [5 x i8] c"abcd\00"
@.str.5 = [3 x i8] c"bc\00"
@.str.6 = [4 x i8] c"abc\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [4 x i8] c"xxx\00"
define i32 @main() {
%1 = tail call i32 @test(i8* null, i8* null, i32 -1)
%2 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%3 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = tail call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 1)
%6 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%7 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 -1)
%8 = tail call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%9 = tail call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i32 -1)
ret i32 0
}