#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*/ printf(char *, char *, char *);
scalar_t__ strend(char *, char *);
int main(void) {
  char *s1 = "some really long string.";
  char *s2 = "ng.";
  char *s3 = "ng";
  if (strend(s1, s2)) {
    printf("The string (%s) has (%s) at the end.\n", s1, s2);
  } else {
    printf("The string (%s) doesn't have (%s) at the end.\n", s1, s2);
  }
  if (strend(s1, s3)) {
    printf("The string (%s) has (%s) at the end.\n", s1, s3);
  } else {
    printf("The string (%s) doesn't have (%s) at the end.\n", s1, s3);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strend@plt>
cmp    $0x0,%rax
je     1180 <main+0x60>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <main+0x74>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strend@plt>
cmp    $0x0,%rax
je     11c4 <main+0xa4>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <main+0xb8>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%r15
lea    0xedf(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strend@plt>
test   %rax,%rax
lea    0xef7(%rip),%r12
lea    0xeca(%rip),%rbx
mov    %rbx,%rdi
cmove  %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
lea    0xeae(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strend@plt>
test   %rax,%rax
cmove  %r12,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"some really long string.\00"
@.str.1 = [4 x i8] c"ng.\00"
@.str.2 = [3 x i8] c"ng\00"
@.str.3 = [38 x i8] c"The string (%s) has (%s) at the end.\0A\00"
@.str.4 = [47 x i8] c"The string (%s) doesn't have (%s) at the end.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i64 @strend(i8* %5, i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %10, i8* %11)
br label %17
13: ; preds = %0
%14 = load i8*, i8** %2
%15 = load i8*, i8** %3
%16 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* %14, i8* %15)
br label %17
17: ; preds = %13, %9
%18 = load i8*, i8** %2
%19 = load i8*, i8** %4
%20 = call i64 @strend(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = load i8*, i8** %2
%24 = load i8*, i8** %4
%25 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %23, i8* %24)
br label %30
26: ; preds = %17
%27 = load i8*, i8** %2
%28 = load i8*, i8** %4
%29 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* %27, i8* %28)
br label %30
30: ; preds = %26, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"some really long string.\00"
@.str.1 = [4 x i8] c"ng.\00"
@.str.2 = [3 x i8] c"ng\00"
@.str.3 = [38 x i8] c"The string (%s) has (%s) at the end.\0A\00"
@.str.4 = [47 x i8] c"The string (%s) doesn't have (%s) at the end.\0A\00"
define i32 @main() {
%1 = tail call i64 @strend(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i64 @strend(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0)
%8 = tail call i32 @printf(i8* %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}