#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
size_t strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, size_t);
int /*<<< orphan*/ trim_r(char *);
int main() {
  char dna[1001], sub[1001];
  size_t i, len;
  assert(fgets(dna, 1001, stdin));
  trim_r(dna);
  assert(fgets(sub, 1001, stdin));
  trim_r(sub);
  len = strlen(sub);
  for (i = 0; *(dna + i + len - 1) != '\0'; i++) {
    if (!strncmp(dna + i, sub, len))
      printf("%ld ", i + 1);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
mov    $0x3e9,%esi
call   1070 <fgets@plt>
mov    %eax,%edi
call   1080 <assert@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <trim_r@plt>
lea    -0x7e0(%rbp),%rdi
mov    0x2e3b(%rip),%rax
mov    (%rax),%edx
mov    $0x3e9,%esi
call   1070 <fgets@plt>
mov    %eax,%edi
call   1080 <assert@plt>
lea    -0x7e0(%rbp),%rdi
call   1030 <trim_r@plt>
lea    -0x7e0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x7f0(%rbp)
movq   $0x0,-0x7e8(%rbp)
lea    -0x3f0(%rbp),%rax
add    -0x7e8(%rbp),%rax
mov    -0x7f0(%rbp),%rcx
movsbl -0x1(%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     126c <main+0x10c>
lea    -0x3f0(%rbp),%rdi
add    -0x7e8(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
mov    -0x7f0(%rbp),%rdx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1250 <main+0xf0>
mov    -0x7e8(%rbp),%rsi
add    $0x1,%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1255 <main+0xf5>
mov    -0x7e8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x7e8(%rbp)
jmp    11ea <main+0x8a>
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e0,%rsp
mov    0x2e61(%rip),%rbx
mov    (%rbx),%edx
lea    0x3f0(%rsp),%r15
mov    %r15,%rdi
mov    $0x3e9,%esi
call   1080 <fgets@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    %r15,%rdi
call   1030 <trim_r@plt>
mov    (%rbx),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3e9,%esi
call   1080 <fgets@plt>
mov    %eax,%edi
call   1090 <assert@plt>
mov    %rbx,%rdi
call   1030 <trim_r@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmpb   $0x0,0x3ef(%rsp,%rax,1)
je     1230 <main+0xc0>
mov    %rax,%r14
mov    $0x1,%ebx
mov    %rsp,%r12
lea    0xe0e(%rip),%r13
jmp    120f <main+0x9f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmpb   $0x0,(%r15,%r14,1)
lea    0x1(%r15),%r15
je     1230 <main+0xc0>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1050 <strncmp@plt>
test   %eax,%eax
jne    1200 <main+0x90>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1200 <main+0x90>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"%ld \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1001 x i8]
%3 = alloca [1001 x i8]
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 1001, i32 %7)
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%11 = call i32 @trim_r(i8* %10)
%12 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 1001, i32 %13)
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%17 = call i32 @trim_r(i8* %16)
%18 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%19 = call i64 @strlen(i8* %18)
store i64 %19, i64* %5
store i64 0, i64* %4
br label %20
20: ; preds = %43, %0
%21 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%22 = load i64, i64* %4
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = load i64, i64* %5
%25 = getelementptr inbounds i8, i8* %23, i64 %24
%26 = getelementptr inbounds i8, i8* %25, i64 -1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %46
30: ; preds = %20
%31 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%32 = load i64, i64* %4
%33 = getelementptr inbounds i8, i8* %31, i64 %32
%34 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%35 = load i64, i64* %5
%36 = call i32 @strncmp(i8* %33, i8* %34, i64 %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %30
%39 = load i64, i64* %4
%40 = add i64 %39, 1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %40)
br label %42
42: ; preds = %38, %30
br label %43
43: ; preds = %42
%44 = load i64, i64* %4
%45 = add i64 %44, 1
store i64 %45, i64* %4
br label %20
46: ; preds = %20
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [5 x i8] c"%ld \00"
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = alloca [1001 x i8]
%3 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %3, i32 1001, i32 %5)
%7 = call i32 @assert(i32 %6)
%8 = call i32 @trim_r(i8* %3)
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %4, i32 1001, i32 %9)
%11 = call i32 @assert(i32 %10)
%12 = call i32 @trim_r(i8* %4)
%13 = call i64 @strlen(i8* %4)
%14 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %13
%15 = getelementptr inbounds i8, i8* %14, i64 -1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %32, label %18
18: ; preds = %0, %26
%19 = phi i8* [ %27, %26 ], [ %3, %0 ]
%20 = phi i64 [ %23, %26 ], [ 0, %0 ]
%21 = call i32 @strncmp(i8* %19, i8* %4, i64 %13)
%22 = icmp eq i32 %21, 0
%23 = add i64 %20, 1
br i1 %22, label %24, label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %23)
br label %26
26: ; preds = %18, %24
%27 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %23
%28 = getelementptr inbounds i8, i8* %27, i64 %13
%29 = getelementptr inbounds i8, i8* %28, i64 -1
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %18
32: ; preds = %26, %0
%33 = call i32 @putchar(i32 10)
ret i32 0
}