#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 *, int);
int strend(char *, char *);
int main() {
  char s[] = "I am a frog";
  char t1[] = "frog";
  char t2[] = "duck";
  printf("%d\n", strend(s, t1));
  printf("%d\n", strend(s, t2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xeb9(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0x1a(%rbp)
mov    0xeac(%rip),%al
mov    %al,-0x16(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x15(%rbp),%rsi
call   1040 <strend@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1040 <strend@plt>
mov    %eax,%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movabs $0x662061206d612049,%rax
61 20 66
mov    %rax,0x18(%rsp)
movl   $0x676f72,0x20(%rsp)
movb   $0x0,0x14(%rsp)
movl   $0x676f7266,0x10(%rsp)
67
movb   $0x0,0xc(%rsp)
movl   $0x6b637564,0x8(%rsp)
6b
lea    0x18(%rsp),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <strend@plt>
lea    0xea0(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <strend@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s = [12 x i8] c"I am a frog\00"
@__const.main.t1 = [5 x i8] c"frog\00"
@__const.main.t2 = [5 x i8] c"duck\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
store i32 0, i32* %1
%5 = bitcast [12 x i8]* %2 to i8*
%6 = bitcast [5 x i8]* %3 to i8*
%7 = bitcast [5 x i8]* %4 to i8*
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%10 = call i32 @strend(i8* %8, i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%14 = call i32 @strend(i8* %12, i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [12 x i8] c"I am a frog\00"
@__const.main.t1 = [5 x i8] c"frog\00"
@__const.main.t2 = [5 x i8] c"duck\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = call i32 @strend(i8* %4, i8* %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @strend(i8* %4, i8* %6)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}