#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *);
scalar_t__ strend(char *, char *);
int main(void) {
  char string1[100], string2[100];
  int character, element;
  for (;;) {
    for (element = 0; element < 100 - 1 && (character = getchar()) != EOF &&
                      character != '\n';
         ++element)
      string1[element] = character;
    string1[element] = '\0';
    if (character == EOF)
      break;
    for (element = 0; element < 100 - 1 && (character = getchar()) != EOF &&
                      character != '\n';
         ++element)
      string2[element] = character;
    string2[element] = '\0';
    if (character == EOF)
      break;
    if (strend(string1, string2))
      printf("The second string occurs at the end of the first string!\n");
    else
      printf("The second string does not occur at the end of the first "
             "string...\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe8(%rbp)
xor    %eax,%eax
cmpl   $0x63,-0xe8(%rbp)
mov    %al,-0xe9(%rbp)
jge    1197 <main+0x67>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xe4(%rbp)
xor    %eax,%eax
mov    0x2e6f(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xe9(%rbp)
je     1197 <main+0x67>
cmpl   $0xa,-0xe4(%rbp)
setne  %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    11aa <main+0x7a>
jmp    11d1 <main+0xa1>
mov    -0xe4(%rbp),%eax
mov    %al,%cl
movslq -0xe8(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    114c <main+0x1c>
movslq -0xe8(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0xe4(%rbp),%eax
mov    0x2dfe(%rip),%rcx
cmp    (%rcx),%eax
jne    11f7 <main+0xc7>
jmp    12ee <main+0x1be>
movl   $0x0,-0xe8(%rbp)
xor    %eax,%eax
cmpl   $0x63,-0xe8(%rbp)
mov    %al,-0xea(%rbp)
jge    124c <main+0x11c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xe4(%rbp)
xor    %eax,%eax
mov    0x2dba(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xea(%rbp)
je     124c <main+0x11c>
cmpl   $0xa,-0xe4(%rbp)
setne  %al
mov    %al,-0xea(%rbp)
mov    -0xea(%rbp),%al
test   $0x1,%al
jne    125f <main+0x12f>
jmp    1289 <main+0x159>
mov    -0xe4(%rbp),%eax
mov    %al,%cl
movslq -0xe8(%rbp),%rax
mov    %cl,-0xe0(%rbp,%rax,1)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    1201 <main+0xd1>
movslq -0xe8(%rbp),%rax
movb   $0x0,-0xe0(%rbp,%rax,1)
mov    -0xe4(%rbp),%eax
mov    0x2d43(%rip),%rcx
cmp    (%rcx),%eax
jne    12b2 <main+0x182>
jmp    12ee <main+0x1be>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strend@plt>
cmp    $0x0,%rax
je     12dd <main+0x1ad>
lea    0xd2d(%rip),%rdi
call   1030 <printf@plt>
jmp    12e9 <main+0x1b9>
lea    0xd56(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    0x2ea0(%rip),%rbx
lea    0x70(%rsp),%r14
mov    %rsp,%r15
lea    0xea9(%rip),%r12
lea    0xee5(%rip),%r13
xchg   %ax,%ax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    (%rbx),%ecx
cmp    $0xa,%eax
je     1190 <main+0x60>
cmp    %ecx,%eax
je     1190 <main+0x60>
mov    %al,0x70(%rsp,%rbp,1)
add    $0x1,%rbp
mov    $0x63,%edx
cmp    $0x63,%rbp
jne    1162 <main+0x32>
jmp    1193 <main+0x63>
nopl   0x0(%rax)
mov    %rbp,%rdx
mov    %edx,%edx
movb   $0x0,0x70(%rsp,%rdx,1)
cmp    %ecx,%eax
je     11ed <main+0xbd>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    (%rbx),%ecx
cmp    $0xa,%eax
je     11c4 <main+0x94>
cmp    %ecx,%eax
je     11c4 <main+0x94>
mov    %al,(%rsp,%rbp,1)
add    $0x1,%rbp
cmp    $0x63,%rbp
jne    11a0 <main+0x70>
mov    $0x63,%ebp
mov    %ebp,%edx
movb   $0x0,(%rsp,%rdx,1)
cmp    %ecx,%eax
je     11ed <main+0xbd>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strend@plt>
test   %rax,%rax
mov    %r13,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [58 x i8] c"The second string occurs at the end of the first string!\0A\00"
@.str.1 = [68 x i8] c"The second string does not occur at the end of the first string...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %75, %0
store i32 0, i32* %5
br label %7
7: ; preds = %25, %6
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 99
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = call i32 (...) @getchar()
store i32 %11, i32* %4
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 10
br label %17
17: ; preds = %14, %10, %7
%18 = phi i1 [ false, %10 ], [ false, %7 ], [ %16, %14 ]
br i1 %18, label %19, label %28
19: ; preds = %17
%20 = load i32, i32* %4
%21 = trunc i32 %20 to i8
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %23
store i8 %21, i8* %24
br label %25
25: ; preds = %19
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %17
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %30
store i8 0, i8* %31
%32 = load i32, i32* %4
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %28
br label %76
36: ; preds = %28
store i32 0, i32* %5
br label %37
37: ; preds = %55, %36
%38 = load i32, i32* %5
%39 = icmp slt i32 %38, 99
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = call i32 (...) @getchar()
store i32 %41, i32* %4
%42 = load i32, i32* @EOF
%43 = icmp ne i32 %41, %42
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* %4
%46 = icmp ne i32 %45, 10
br label %47
47: ; preds = %44, %40, %37
%48 = phi i1 [ false, %40 ], [ false, %37 ], [ %46, %44 ]
br i1 %48, label %49, label %58
49: ; preds = %47
%50 = load i32, i32* %4
%51 = trunc i32 %50 to i8
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %53
store i8 %51, i8* %54
br label %55
55: ; preds = %49
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 1
store i32 %57, i32* %5
br label %37
58: ; preds = %47
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %60
store i8 0, i8* %61
%62 = load i32, i32* %4
%63 = load i32, i32* @EOF
%64 = icmp eq i32 %62, %63
br i1 %64, label %65, label %66
65: ; preds = %58
br label %76
66: ; preds = %58
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%68 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%69 = call i64 @strend(i8* %67, i8* %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %75
73: ; preds = %66
%74 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
br label %75
75: ; preds = %73, %71
br label %6
76: ; preds = %65, %35
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@str = [67 x i8] c"The second string does not occur at the end of the first string...\00"
@str.2 = [57 x i8] c"The second string occurs at the end of the first string!\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %17, %0
%6 = phi i64 [ 0, %0 ], [ %18, %17 ]
%7 = call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
%10 = icmp ne i32 %7, 10
%11 = and i1 %10, %9
br i1 %11, label %12, label %19
12: ; preds = %5
%13 = trunc i32 %7 to i8
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %6
store i8 %13, i8* %14
%15 = add nuw nsw i64 %6, 1
%16 = icmp eq i64 %15, 99
br i1 %16, label %19, label %17
17: ; preds = %12, %41
%18 = phi i64 [ %15, %12 ], [ 0, %41 ]
br label %5
19: ; preds = %12, %5
%20 = phi i64 [ 99, %12 ], [ %6, %5 ]
%21 = and i64 %20, 4294967295
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %21
store i8 0, i8* %22
%23 = icmp eq i32 %7, %8
br i1 %23, label %46, label %24
24: ; preds = %19, %31
%25 = phi i64 [ %34, %31 ], [ 0, %19 ]
%26 = call i32 (...) @getchar()
%27 = load i32, i32* @EOF
%28 = icmp ne i32 %26, %27
%29 = icmp ne i32 %26, 10
%30 = and i1 %29, %28
br i1 %30, label %31, label %36
31: ; preds = %24
%32 = trunc i32 %26 to i8
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %25
store i8 %32, i8* %33
%34 = add nuw nsw i64 %25, 1
%35 = icmp eq i64 %34, 99
br i1 %35, label %36, label %24
36: ; preds = %31, %24
%37 = phi i64 [ 99, %31 ], [ %25, %24 ]
%38 = and i64 %37, 4294967295
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %38
store i8 0, i8* %39
%40 = icmp eq i32 %26, %27
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = call i64 @strend(i8* %3, i8* %4)
%43 = icmp eq i64 %42, 0
%44 = select i1 %43, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @str.2, i64 0, i64 0)
%45 = call i32 @puts(i8* dereferenceable(1) %44)
br label %17
46: ; preds = %36, %19
ret i32 0
}