#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*/ endsWith(char *, char *);
int /*<<< orphan*/ test(int /*<<< orphan*/, int);
void testEndsWith(void) {
  test(endsWith("start", ""), (1 == 1));
  test(endsWith("start", "tart"), (1 == 1));
  test(endsWith("start", "start"), (1 == 1));
  test(endsWith("start", "xstart"), (1 == 0));
}


x86 assembly (clang, -O0):
<testEndsWith>:
push   %rbp
mov    %rsp,%rbp
lea    0xed6(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <endsWith@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <test@plt>
lea    0xeb7(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <endsWith@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <test@plt>
lea    0xe98(%rip),%rsi
mov    %rsi,%rdi
call   1030 <endsWith@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <test@plt>
lea    0xe7d(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1030 <endsWith@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1040 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testEndsWith>:
push   %rbx
lea    0xed9(%rip),%rbx
lea    0xed7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <endsWith@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <test@plt>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <endsWith@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <test@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <endsWith@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <test@plt>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1030 <endsWith@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rbx
jmp    1040 <test@plt>

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

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