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


x86 assembly (clang, -O0):
<stic_assert_string_ends_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
lea    -0x186d0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe8b(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x186e0(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x186e8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x186d4(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x186e8(%rbp),%rsi
mov    -0x186e0(%rbp),%rdi
mov    %eax,%ecx
mov    -0x186d4(%rbp),%eax
sub    %ecx,%eax
cltq
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    -0x186d0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1050 <stic_simple_test_result@plt>
add    $0x186f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stic_assert_string_ends_with>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186a8,%rsp
mov    %r8d,%r14d
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xe99(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1030 <strlen@plt>
sub    %eax,%r15d
movslq %r15d,%rsi
add    %rbx,%rsi
mov    %rbp,%rdi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
mov    %rsp,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <stic_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 @stic_assert_string_ends_with(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [100000 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = getelementptr inbounds [100000 x i8], [100000 x i8]* %11, i64 0, i64 0
%13 = load i8*, i8** %7
%14 = load i8*, i8** %6
%15 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = load i8*, i8** %7
%19 = call i32 @strlen(i8* %18)
%20 = load i8*, i8** %6
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %19, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %17, i64 %23
%25 = call i64 @strcmp(i8* %16, i8* %24)
%26 = icmp eq i64 %25, 0
%27 = zext i1 %26 to i32
%28 = getelementptr inbounds [100000 x i8], [100000 x i8]* %11, i64 0, i64 0
%29 = load i8*, i8** %8
%30 = load i8*, i8** %9
%31 = load i32, i32* %10
%32 = call i32 @stic_simple_test_result(i32 %27, i8* %28, i8* %29, i8* %30, i32 %31)
ret void
}

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