#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*/ substring(char *, int, int);
int /*<<< orphan*/ test(int /*<<< orphan*/, char *);
void testSubString(void) {
  test(substring("abcde", 0, 1), "ab");
  test(substring("abcde", 0, 4), "abcde");
  test(substring("abcde", -1, 5), "abcde");
  test(substring("abcde", 3, 2), "");
}


x86 assembly (clang, -O0):
<testSubString>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <substring@plt>
mov    %eax,%edi
lea    0xec6(%rip),%rsi
call   1040 <test@plt>
lea    0xeb4(%rip),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <substring@plt>
mov    %eax,%edi
lea    0xe9f(%rip),%rsi
call   1040 <test@plt>
lea    0xe93(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x5,%edx
call   1030 <substring@plt>
mov    %eax,%edi
lea    0xe7b(%rip),%rsi
call   1040 <test@plt>
lea    0xe6f(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <substring@plt>
mov    %eax,%edi
lea    0xe5f(%rip),%rsi
call   1040 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testSubString>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <substring@plt>
lea    0xec8(%rip),%rsi
mov    %eax,%edi
call   1040 <test@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <substring@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x5,%edx
call   1030 <substring@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <test@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <substring@plt>
lea    0xe75(%rip),%rsi
mov    %eax,%edi
pop    %rbx
jmp    1040 <test@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"abcde\00"
@.str.1 = [3 x i8] c"ab\00"
@.str.2 = [1 x i8] zeroinitializer
define void @testSubString() {
%1 = call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 1)
%2 = call i32 @test(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 4)
%4 = call i32 @test(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i32 5)
%6 = call i32 @test(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 3, i32 2)
%8 = call i32 @test(i32 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"abcde\00"
@.str.1 = [3 x i8] c"ab\00"
@.str.2 = [1 x i8] zeroinitializer
define void @testSubString() {
%1 = tail call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 1)
%2 = tail call i32 @test(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 4)
%4 = tail call i32 @test(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1, i32 5)
%6 = tail call i32 @test(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @substring(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 3, i32 2)
%8 = tail call i32 @test(i32 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}