#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 *, int);
main() {
  int strend(char *, char *);
  char first[] = "the begining";
  char second[] = "ing";
  char third[] = "john";
  printf("Does \"%s\" end in \"%s\": %d\n", first, second,
         strend(first, second));
  printf("Does \"%s\" end in \"%s\": %d\n", first, third, strend(first, third));
  printf("Does \"%s\" end in \"%s\": %d\n", second, third,
         strend(second, third));
  printf("Does \"%s\" end in \"%s\": %d\n", second, first,
         strend(second, first));
  printf("Does \"%s\" end in \"%s\": %d\n", third, first, strend(third, first));
  printf("Does \"%s\" end in \"%s\": %d\n", third, second,
         strend(third, second));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0xece(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xec7(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x11(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeb1(%rip),%al
mov    %al,-0x12(%rbp)
lea    -0xd(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x11(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0xd(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <strend@plt>
mov    -0x78(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    %eax,%ecx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    -0xd(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0xd(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <strend@plt>
mov    -0x68(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    %eax,%ecx
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x11(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x11(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <strend@plt>
mov    -0x58(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    %eax,%ecx
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x11(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0xd(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x11(%rbp),%rdi
lea    -0xd(%rbp),%rsi
call   1040 <strend@plt>
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    %eax,%ecx
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
lea    -0x16(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0xd(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x16(%rbp),%rdi
lea    -0xd(%rbp),%rsi
call   1040 <strend@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
lea    0xdb5(%rip),%rdi
call   1030 <printf@plt>
lea    -0x16(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x11(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x16(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <strend@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
lea    0xd82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movabs $0x676e696e696765,%rax
mov    %rax,0x1d(%rsp)
movabs $0x6967656220656874,%rax
65 67 69
mov    %rax,0x18(%rsp)
movl   $0x676e69,0x14(%rsp)
movb   $0x0,0x10(%rsp)
movl   $0x6e686f6a,0xc(%rsp)
6e
lea    0x18(%rsp),%r12
lea    0x14(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strend@plt>
lea    0xe98(%rip),%r14
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
lea    0xc(%rsp),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <strend@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strend@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strend@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strend@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strend@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.first = [13 x i8] c"the begining\00"
@__const.main.second = [4 x i8] c"ing\00"
@__const.main.third = [5 x i8] c"john\00"
@.str = [27 x i8] c"Does \22%s\22 end in \22%s\22: %d\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [4 x i8]
%3 = alloca [5 x i8]
%4 = bitcast [13 x i8]* %1 to i8*
%5 = bitcast [4 x i8]* %2 to i8*
%6 = bitcast [5 x i8]* %3 to i8*
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = call i32 @strend(i8* %9, i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i32 %11)
%13 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%17 = call i32 @strend(i8* %15, i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14, i32 %17)
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%23 = call i32 @strend(i8* %21, i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20, i32 %23)
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%28 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%29 = call i32 @strend(i8* %27, i8* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %25, i8* %26, i32 %29)
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%34 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%35 = call i32 @strend(i8* %33, i8* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %31, i8* %32, i32 %35)
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%41 = call i32 @strend(i8* %39, i8* %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %37, i8* %38, i32 %41)
ret i32 0
}

LLVM IR (-O2):
@__const.main.first = [13 x i8] c"the begining\00"
@__const.main.third = [5 x i8] c"john\00"
@.str = [27 x i8] c"Does \22%s\22 end in \22%s\22: %d\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca i32
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
store i32 6778473, i32* %2
%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 ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5, i32 %7)
%9 = call i32 @strend(i8* %4, i8* %6)
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i32 %9)
%11 = call i32 @strend(i8* %5, i8* %6)
%12 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6, i32 %11)
%13 = call i32 @strend(i8* %5, i8* %4)
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %4, i32 %13)
%15 = call i32 @strend(i8* %6, i8* %4)
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %4, i32 %15)
%17 = call i32 @strend(i8* %6, i8* %5)
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %5, i32 %17)
ret i32 0
}