#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 */
scalar_t__ strsize(char *);
int strend(char *s, char *t) {
  s += (strsize(s) - strsize(t));
  while (*s++ == *t++)
    if (*t == '\0')
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<strend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strsize@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strsize@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1195 <strend+0x85>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1190 <strend+0x80>
movl   $0x1,-0x4(%rbp)
jmp    119c <strend+0x8c>
jmp    1148 <strend+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strend>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strsize@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strsize@plt>
sub    %rax,%rbx
add    %r15,%rbx
mov    (%r14),%dl
xor    %eax,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %dl,(%rbx,%rcx,1)
jne    1158 <strend+0x48>
movzbl 0x1(%r14,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1140 <strend+0x30>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @strend(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = call i64 @strsize(i8* %6)
%8 = load i8*, i8** %5
%9 = call i64 @strsize(i8* %8)
%10 = sub nsw i64 %7, %9
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 %10
store i8* %12, i8** %4
br label %13
13: ; preds = %29, %2
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
%20 = load i8, i8* %18
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %17, %21
br i1 %22, label %23, label %30
23: ; preds = %13
%24 = load i8*, i8** %5
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 1, i32* %3
br label %31
29: ; preds = %23
br label %13
30: ; preds = %13
store i32 0, i32* %3
br label %31
31: ; preds = %30, %28
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @strend(i8* %0, i8* %1) {
%3 = tail call i64 @strsize(i8* %0)
%4 = tail call i64 @strsize(i8* %1)
%5 = sub nsw i64 %3, %4
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %1
br label %8
8: ; preds = %15, %2
%9 = phi i8 [ %7, %2 ], [ %17, %15 ]
%10 = phi i8* [ %6, %2 ], [ %16, %15 ]
%11 = phi i8* [ %1, %2 ], [ %13, %15 ]
%12 = load i8, i8* %10
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = icmp eq i8 %12, %9
br i1 %14, label %15, label %19
15: ; preds = %8
%16 = getelementptr inbounds i8, i8* %10, i64 1
%17 = load i8, i8* %13
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %8
19: ; preds = %8, %15
%20 = phi i32 [ 1, %15 ], [ 0, %8 ]
ret i32 %20
}