#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 */
scalar_t__ EOF;
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, char *, char *);
char strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, char);
int main(void) {
  char N1[15], N2[35], *pN2, nmatches, pmatch, n1len, n2len;
  unsigned long i = 0;
  while (scanf("%s %s", N1, N2) != EOF) {
    nmatches = pmatch = 0;
    n1len = strlen(N1);
    n2len = strlen(N2);
    pN2 = N2;
    while (pN2 + n1len <= &N2[n2len]) {
      if (!strncmp(N1, pN2, n1len))
        nmatches++, pmatch = (pN2 - N2) + 1, pN2 += n1len;
      else
        pN2++;
    }
    memset(N1, 0, 15);
    memset(N2, 0, 35);
    printf("Caso #%ld:\n", ++i);
    if (nmatches)
      printf("Qtd.Subsequencias: %d\nPos: %d\n\n", nmatches, pmatch);
    else
      printf("Nao existe subsequencia\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x58(%rbp)
lea    -0x13(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xe8a(%rip),%rdi
call   1070 <scanf@plt>
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%rax
je     12a4 <main+0x154>
movb   $0x0,-0x4a(%rbp)
movb   $0x0,-0x49(%rbp)
lea    -0x13(%rbp),%rdi
call   1040 <strlen@plt>
mov    %al,-0x4b(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %al,-0x4c(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl -0x4b(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movsbq -0x4c(%rbp),%rdx
lea    -0x40(%rbp),%rcx
add    %rdx,%rcx
cmp    %rcx,%rax
ja     1232 <main+0xe2>
lea    -0x13(%rbp),%rdi
mov    -0x48(%rbp),%rsi
movsbl -0x4b(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1221 <main+0xd1>
mov    -0x49(%rbp),%al
add    $0x1,%al
mov    %al,-0x49(%rbp)
mov    -0x48(%rbp),%rax
lea    -0x40(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %al,-0x4a(%rbp)
movsbl -0x4b(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    122d <main+0xdd>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    11b3 <main+0x63>
lea    -0x13(%rbp),%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1060 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x23,%edx
call   1060 <memset@plt>
mov    -0x58(%rbp),%rsi
add    $0x1,%rsi
mov    %rsi,-0x58(%rbp)
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpb   $0x0,-0x49(%rbp)
je     1291 <main+0x141>
movsbl -0x49(%rbp),%esi
movsbl -0x4a(%rbp),%edx
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    129f <main+0x14f>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1167 <main+0x17>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xe8b(%rip),%rdi
lea    0x39(%rsp),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdx
call   1080 <scanf@plt>
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%rax
jne    11a4 <main+0x44>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x39(%rsp),%r15
xor    %ebp,%ebp
jmp    11da <main+0x7a>
nopl   (%rax)
lea    0xe7b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3d(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1080 <scanf@plt>
mov    0x2e13(%rip),%rcx
cmp    (%rcx),%rax
je     1193 <main+0x33>
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    %al,%bl
mov    %rbp,(%rsp)
jle    1200 <main+0xa0>
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    1271 <main+0x111>
nopl   0x0(%rax,%rax,1)
movsbq %bl,%rbp
movsbq %al,%rax
add    %rsp,%rax
add    $0x10,%rax
mov    %rax,0x8(%rsp)
lea    (%rsp,%rbp,1),%r13
add    $0x10,%r13
xor    %ebx,%ebx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <strncmp@plt>
lea    0x1(%r14),%rcx
lea    0x10(%rsp),%rdx
sub    %edx,%r14d
add    $0x1,%r14b
test   %eax,%eax
movzbl %r14b,%eax
movzbl %bl,%ebx
cmove  %eax,%ebx
cmove  %r13,%rcx
sete   %al
add    %al,%r12b
lea    (%rcx,%rbp,1),%r13
mov    %rcx,%r14
cmp    0x8(%rsp),%r13
jbe    1230 <main+0xd0>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1070 <memset@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x23,%edx
call   1070 <memset@plt>
mov    (%rsp),%rbp
add    $0x1,%rbp
lea    0xd63(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r12b,%r12b
je     11b0 <main+0x50>
movsbl %r12b,%esi
movsbl %bl,%edx
lea    0xd4e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11bc <main+0x5c>

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
@EOF = global i64 0
@.str.1 = [12 x i8] c"Caso #%ld:\0A\00"
@.str.2 = [32 x i8] c"Qtd.Subsequencias: %d\0APos: %d\0A\0A\00"
@.str.3 = [26 x i8] c"Nao existe subsequencia\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [35 x i8]
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %9
br label %10
10: ; preds = %75, %0
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%13 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i64, i64* @EOF
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %76
16: ; preds = %10
store i8 0, i8* %6
store i8 0, i8* %5
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%18 = call signext i8 @strlen(i8* %17)
store i8 %18, i8* %7
%19 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%20 = call signext i8 @strlen(i8* %19)
store i8 %20, i8* %8
%21 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
store i8* %21, i8** %4
br label %22
22: ; preds = %56, %16
%23 = load i8*, i8** %4
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
%28 = load i8, i8* %8
%29 = sext i8 %28 to i64
%30 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 %29
%31 = icmp ule i8* %27, %30
br i1 %31, label %32, label %57
32: ; preds = %22
%33 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%34 = load i8*, i8** %4
%35 = load i8, i8* %7
%36 = call i32 @strncmp(i8* %33, i8* %34, i8 signext %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %53, label %38
38: ; preds = %32
%39 = load i8, i8* %5
%40 = add i8 %39, 1
store i8 %40, i8* %5
%41 = load i8*, i8** %4
%42 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%43 = ptrtoint i8* %41 to i64
%44 = ptrtoint i8* %42 to i64
%45 = sub i64 %43, %44
%46 = add nsw i64 %45, 1
%47 = trunc i64 %46 to i8
store i8 %47, i8* %6
%48 = load i8, i8* %7
%49 = sext i8 %48 to i32
%50 = load i8*, i8** %4
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds i8, i8* %50, i64 %51
store i8* %52, i8** %4
br label %56
53: ; preds = %32
%54 = load i8*, i8** %4
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %4
br label %56
56: ; preds = %53, %38
br label %22
57: ; preds = %22
%58 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%59 = call i32 @memset(i8* %58, i32 0, i32 15)
%60 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%61 = call i32 @memset(i8* %60, i32 0, i32 35)
%62 = load i64, i64* %9
%63 = add i64 %62, 1
store i64 %63, i64* %9
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 %63)
%65 = load i8, i8* %5
%66 = icmp ne i8 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %57
%68 = load i8, i8* %5
%69 = sext i8 %68 to i32
%70 = load i8, i8* %6
%71 = sext i8 %70 to i32
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %69, i32 %71)
br label %75
73: ; preds = %57
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %75
75: ; preds = %73, %67
br label %10
76: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
@EOF = global i64 0
@.str.1 = [12 x i8] c"Caso #%ld:\0A\00"
@.str.2 = [32 x i8] c"Qtd.Subsequencias: %d\0APos: %d\0A\0A\00"
@str = [25 x i8] c"Nao existe subsequencia\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [35 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [35 x i8], [35 x i8]* %2, i64 0, i64 0
%5 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %56, label %8
8: ; preds = %0
%9 = ptrtoint [35 x i8]* %2 to i64
br label %10
10: ; preds = %8, %52
%11 = phi i64 [ 0, %8 ], [ %43, %52 ]
%12 = call signext i8 @strlen(i8* %3)
%13 = call signext i8 @strlen(i8* %4)
%14 = sext i8 %12 to i64
%15 = sext i8 %13 to i64
%16 = getelementptr inbounds [35 x i8], [35 x i8]* %2, i64 0, i64 %15
%17 = icmp sgt i8 %12, %13
br i1 %17, label %38, label %18
18: ; preds = %10
%19 = getelementptr inbounds [35 x i8], [35 x i8]* %2, i64 0, i64 %14
br label %20
20: ; preds = %18, %20
%21 = phi i8* [ %36, %20 ], [ %19, %18 ]
%22 = phi i8* [ %35, %20 ], [ %4, %18 ]
%23 = phi i8 [ %34, %20 ], [ 0, %18 ]
%24 = phi i8 [ %33, %20 ], [ 0, %18 ]
%25 = call i32 @strncmp(i8* %3, i8* %22, i8 signext %12)
%26 = icmp eq i32 %25, 0
%27 = getelementptr inbounds i8, i8* %22, i64 1
%28 = ptrtoint i8* %22 to i64
%29 = sub i64 %28, %9
%30 = trunc i64 %29 to i8
%31 = add i8 %30, 1
%32 = zext i1 %26 to i8
%33 = add i8 %24, %32
%34 = select i1 %26, i8 %31, i8 %23
%35 = select i1 %26, i8* %21, i8* %27
%36 = getelementptr inbounds i8, i8* %35, i64 %14
%37 = icmp ugt i8* %36, %16
br i1 %37, label %38, label %20
38: ; preds = %20, %10
%39 = phi i8 [ 0, %10 ], [ %33, %20 ]
%40 = phi i8 [ 0, %10 ], [ %34, %20 ]
%41 = call i32 @memset(i8* %3, i32 0, i32 15)
%42 = call i32 @memset(i8* %4, i32 0, i32 35)
%43 = add i64 %11, 1
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 %43)
%45 = icmp eq i8 %39, 0
br i1 %45, label %50, label %46
46: ; preds = %38
%47 = sext i8 %39 to i32
%48 = sext i8 %40 to i32
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 %48)
br label %52
50: ; preds = %38
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %52
52: ; preds = %50, %46
%53 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%54 = load i64, i64* @EOF
%55 = icmp eq i64 %53, %54
br i1 %55, label %56, label %10
56: ; preds = %52, %0
ret i32 0
}