#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int strend(char *, char *);
int main() {
  char s[2 * 100], t[100];
  int i;
  printf("Enter two strings (separated by Enter): ");
  i = 0;
  while ((s[i++] = getchar()) != '\n')
    ;
  s[i - 1] = '\0';
  i = 0;
  while ((t[i++] = getchar()) != '\n')
    ;
  t[i - 1] = '\0';
  printf("The result of strend is: %d\n", strend(s, t));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x144(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x144(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x144(%rbp)
movslq %ecx,%rcx
mov    %al,-0xd0(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     118d <main+0x5d>
jmp    115a <main+0x2a>
mov    -0x144(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0xd0(%rbp,%rax,1)
movl   $0x0,-0x144(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x144(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x144(%rbp)
movslq %ecx,%rcx
mov    %al,-0x140(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11dd <main+0xad>
jmp    11aa <main+0x7a>
mov    -0x144(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x140(%rbp,%rax,1)
lea    -0xd0(%rbp),%rdi
lea    -0x140(%rbp),%rsi
call   1050 <strend@plt>
mov    %eax,%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x140,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x71(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1150 <main+0x20>
mov    %ebx,%eax
movb   $0x0,0x70(%rsp,%rax,1)
mov    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x1(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1180 <main+0x50>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <strend@plt>
lea    0xe7c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter two strings (separated by Enter): \00"
@.str.1 = [29 x i8] c"The result of strend is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %6
6: ; preds = %14, %0
%7 = call signext i8 (...) @getchar()
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
store i32 %9, i32* %4
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %10
store i8 %7, i8* %11
%12 = sext i8 %7 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %6
br label %6
15: ; preds = %6
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %18
store i8 0, i8* %19
store i32 0, i32* %4
br label %20
20: ; preds = %28, %15
%21 = call signext i8 (...) @getchar()
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %24
store i8 %21, i8* %25
%26 = sext i8 %21 to i32
%27 = icmp ne i32 %26, 10
br i1 %27, label %28, label %29
28: ; preds = %20
br label %20
29: ; preds = %20
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %32
store i8 0, i8* %33
%34 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%36 = call i32 @strend(i8* %34, i8* %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Enter two strings (separated by Enter): \00"
@.str.1 = [29 x i8] c"The result of strend is: %d\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ %9, %6 ], [ 0, %0 ]
%8 = tail call signext i8 (...) @getchar()
%9 = add nuw i64 %7, 1
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %7
store i8 %8, i8* %10
%11 = icmp eq i8 %8, 10
br i1 %11, label %12, label %6
12: ; preds = %6
%13 = and i64 %7, 4294967295
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %15, %12
%16 = phi i64 [ %18, %15 ], [ 0, %12 ]
%17 = tail call signext i8 (...) @getchar()
%18 = add nuw i64 %16, 1
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %16
store i8 %17, i8* %19
%20 = icmp eq i8 %17, 10
br i1 %20, label %21, label %15
21: ; preds = %15
%22 = and i64 %16, 4294967295
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %22
store i8 0, i8* %23
%24 = call i32 @strend(i8* %3, i8* %4)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
}