#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*/ strindexright(char *, char *, int, int);
int main(void) {
  char tsource[22] = "Good Morning, Vietnam!";
  char tt1[3] = "ing";
  char tt2[3] = "log";
  char tt3[3] = "eng";
  char tt4[3] = "orn";
  strindexright(tsource, tt1, 22, 3);
  strindexright(tsource, tt2, 22, 3);
  strindexright(tsource, tt3, 22, 3);
  strindexright(tsource, tt4, 22, 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xed6(%rip),%ax
mov    %ax,-0xc(%rbp)
mov    0xecd(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xec5(%rip),%al
mov    %al,-0x21(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x26(%rbp)
mov    0xeb4(%rip),%al
mov    %al,-0x24(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x29(%rbp)
mov    0xea3(%rip),%al
mov    %al,-0x27(%rbp)
mov    0xe9a(%rip),%ax
mov    %ax,-0x2c(%rbp)
mov    0xe92(%rip),%al
mov    %al,-0x2a(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x23(%rbp),%rsi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
lea    -0x20(%rbp),%rdi
lea    -0x26(%rbp),%rsi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
lea    -0x20(%rbp),%rdi
lea    -0x29(%rbp),%rsi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
lea    -0x20(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x216d616e74656956,%rax
61 6d 21
mov    %rax,0x1e(%rsp)
movb   $0x67,0xe(%rsp)
movw   $0x6e69,0xc(%rsp)
movb   $0x67,0xa(%rsp)
movw   $0x6f6c,0x8(%rsp)
movb   $0x67,0x6(%rsp)
movw   $0x6e65,0x4(%rsp)
movb   $0x6e,0x2(%rsp)
movw   $0x726f,(%rsp)
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x16,%edx
mov    $0x3,%ecx
call   1030 <strindexright@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.tsource = [22 x i8] c"Good Morning, Vietnam!"
@__const.main.tt1 = [3 x i8] c"ing"
@__const.main.tt2 = [3 x i8] c"log"
@__const.main.tt3 = [3 x i8] c"eng"
@__const.main.tt4 = [3 x i8] c"orn"
define i32 @main() {
%1 = alloca [22 x i8]
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = alloca [3 x i8]
%6 = bitcast [22 x i8]* %1 to i8*
%7 = bitcast [3 x i8]* %2 to i8*
%8 = bitcast [3 x i8]* %3 to i8*
%9 = bitcast [3 x i8]* %4 to i8*
%10 = bitcast [3 x i8]* %5 to i8*
%11 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%13 = call i32 @strindexright(i8* %11, i8* %12, i32 22, i32 3)
%14 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%16 = call i32 @strindexright(i8* %14, i8* %15, i32 22, i32 3)
%17 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%19 = call i32 @strindexright(i8* %17, i8* %18, i32 22, i32 3)
%20 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%22 = call i32 @strindexright(i8* %20, i8* %21, i32 22, i32 3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tsource = [22 x i8] c"Good Morning, Vietnam!"
@__const.main.tt1 = [3 x i8] c"ing"
@__const.main.tt2 = [3 x i8] c"log"
@__const.main.tt3 = [3 x i8] c"eng"
@__const.main.tt4 = [3 x i8] c"orn"
define i32 @main() {
%1 = alloca [22 x i8]
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = alloca [3 x i8]
%6 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%11 = call i32 @strindexright(i8* %6, i8* %7, i32 22, i32 3)
%12 = call i32 @strindexright(i8* %6, i8* %8, i32 22, i32 3)
%13 = call i32 @strindexright(i8* %6, i8* %9, i32 22, i32 3)
%14 = call i32 @strindexright(i8* %6, i8* %10, i32 22, i32 3)
ret i32 0
}