#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*/ seatest_simple_test_result(int, char *, char const *,
                                              unsigned int);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
scalar_t__ strcmp(char const *, char const *);
int strlen(char const *);
void seatest_assert_string_ends_with(const char *expected, const char *actual,
                                     const char *function, unsigned int line) {
  char s[100000];
  sprintf(s, "Expected \"%s\" to end with \"%s\"", actual, expected);
  seatest_simple_test_result(
      strcmp(expected, actual + (strlen(actual) - strlen(expected))) == 0, s,
      function, line);
}


x86 assembly (clang, -O0):
<seatest_assert_string_ends_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186e0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0x186c0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe90(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x186d0(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x186d8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x186c4(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x186d8(%rbp),%rsi
mov    -0x186d0(%rbp),%rdi
mov    %eax,%ecx
mov    -0x186c4(%rbp),%eax
sub    %ecx,%eax
cltq
add    %rax,%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    -0x186c0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <seatest_simple_test_result@plt>
add    $0x186e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seatest_assert_string_ends_with>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186a8,%rsp
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%r13
lea    0xe9c(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbp,%rdx
mov    %r13,%rcx
call   1060 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1030 <strlen@plt>
sub    %eax,%ebx
movslq %ebx,%rsi
add    %rbp,%rsi
mov    %r13,%rdi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1040 <seatest_simple_test_result@plt>
add    $0x186a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Expected \22%s\22 to end with \22%s\22\00"
define void @seatest_assert_string_ends_with(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [100000 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %6
%12 = load i8*, i8** %5
%13 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = load i8*, i8** %5
%19 = call i32 @strlen(i8* %18)
%20 = sub nsw i32 %17, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %15, i64 %21
%23 = call i64 @strcmp(i8* %14, i8* %22)
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
%26 = getelementptr inbounds [100000 x i8], [100000 x i8]* %9, i64 0, i64 0
%27 = load i8*, i8** %7
%28 = load i32, i32* %8
%29 = call i32 @seatest_simple_test_result(i32 %25, i8* %26, i8* %27, i32 %28)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Expected \22%s\22 to end with \22%s\22\00"
define void @seatest_assert_string_ends_with(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [100000 x i8]
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%8 = tail call i32 @strlen(i8* %1)
%9 = tail call i32 @strlen(i8* %0)
%10 = sub nsw i32 %8, %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = tail call i64 @strcmp(i8* %0, i8* %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @seatest_simple_test_result(i32 %15, i8* %6, i8* %2, i32 %3)
ret void
}