#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 fgets(char *, int, int /*<<< orphan*/);
scalar_t__ palavrasComecamPelaMesmaLetra(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int main(void) {
  char linha[1024];
  while (fgets(linha, 1024, stdin), strcmp(linha, "*\n") != 0) {
    if (palavrasComecamPelaMesmaLetra(linha)) {
      printf("Y\n");
    } else {
      printf("N\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x410(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11c1 <main+0x81>
lea    -0x410(%rbp),%rdi
call   1060 <palavrasComecamPelaMesmaLetra@plt>
cmp    $0x0,%rax
je     11b0 <main+0x70>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
jmp    11bc <main+0x7c>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    0x2e91(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d7 <main+0x97>
mov    %rsp,%rbx
lea    0xe7b(%rip),%r12
lea    0xe76(%rip),%r13
lea    0xe6a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <palavrasComecamPelaMesmaLetra@plt>
test   %rax,%rax
mov    %r13,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11a0 <main+0x60>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"*\0A\00"
@.str.1 = [3 x i8] c"Y\0A\00"
@.str.2 = [3 x i8] c"N\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %18, %0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 1024, i32 %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %3
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%12 = call i64 @palavrasComecamPelaMesmaLetra(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %3
19: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"*\0A\00"
@str = [2 x i8] c"N\00"
@str.3 = [2 x i8] c"Y\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 1024, i32 %3)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %7
%8 = call i64 @palavrasComecamPelaMesmaLetra(i8* %2)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0)
%11 = call i32 @puts(i8* dereferenceable(1) %10)
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %2, i32 1024, i32 %12)
%14 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %0
ret i32 0
}