#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 *, ...);
void display_sequence(char *str0, char *str1, int len_str1, int *tab, int depth,
                      int pos) {
  if (depth == len_str1) {
    int i;
    for (i = 0; i < depth; ++i)
      printf("%d", tab[i]);
    printf("\n");
  } else {
    while (*str0) {
      if (*str0 == *str1) {
        tab[depth] = pos + 1;
        display_sequence(str0 + 1, str1 + 1, len_str1, tab, depth + 1, pos + 1);
      }
      ++str0;
      ++pos;
    }
  }
}


x86 assembly (clang, -O0):
<display_sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1198 <display_sequence+0x78>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1185 <display_sequence+0x65>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1152 <display_sequence+0x32>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <display_sequence+0xfc>
jmp    119d <display_sequence+0x7d>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1217 <display_sequence+0xf7>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11fd <display_sequence+0xdd>
mov    -0x28(%rbp),%edx
add    $0x1,%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
add    $0x1,%r8d
mov    -0x28(%rbp),%r9d
add    $0x1,%r9d
call   1040 <display_sequence@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119d <display_sequence+0x7d>
jmp    121c <display_sequence+0xfc>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_sequence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r14d
mov    %rcx,%r13
cmp    %edx,%r8d
jne    1190 <display_sequence+0x60>
test   %r14d,%r14d
jle    1178 <display_sequence+0x48>
mov    %r14d,%ebp
lea    0xea8(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <display_sequence+0x30>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     11f9 <display_sequence+0xc9>
mov    %r9d,%ebp
mov    %edx,%r15d
mov    %rsi,%r12
movslq %r14d,%rcx
mov    %rcx,0x10(%rsp)
lea    0x1(%rsi),%rcx
mov    %rcx,0x8(%rsp)
add    $0x1,%r14d
add    $0x1,%ebp
add    $0x1,%rbx
jmp    11ce <display_sequence+0x9e>
movzbl (%rbx),%eax
add    $0x1,%ebp
add    $0x1,%rbx
test   %al,%al
je     11f9 <display_sequence+0xc9>
cmp    (%r12),%al
jne    11c0 <display_sequence+0x90>
mov    0x10(%rsp),%rax
mov    %ebp,0x0(%r13,%rax,4)
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    %r15d,%edx
mov    %r13,%rcx
mov    %r14d,%r8d
mov    %ebp,%r9d
call   1050 <display_sequence@plt>
jmp    11c0 <display_sequence+0x90>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @display_sequence(i8* %0, i8* %1, i32 %2, i32* %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %11
%15 = load i32, i32* %9
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %34
17: ; preds = %6
store i32 0, i32* %13
br label %18
18: ; preds = %29, %17
%19 = load i32, i32* %13
%20 = load i32, i32* %11
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32*, i32** %10
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %13
%31 = add nsw i32 %30, 1
store i32 %31, i32* %13
br label %18
32: ; preds = %18
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %70
34: ; preds = %6
br label %35
35: ; preds = %64, %34
%36 = load i8*, i8** %7
%37 = load i8, i8* %36
%38 = icmp ne i8 %37, 0
br i1 %38, label %39, label %69
39: ; preds = %35
%40 = load i8*, i8** %7
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = load i8*, i8** %8
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %42, %45
br i1 %46, label %47, label %64
47: ; preds = %39
%48 = load i32, i32* %12
%49 = add nsw i32 %48, 1
%50 = load i32*, i32** %10
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
store i32 %49, i32* %53
%54 = load i8*, i8** %7
%55 = getelementptr inbounds i8, i8* %54, i64 1
%56 = load i8*, i8** %8
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = load i32, i32* %9
%59 = load i32*, i32** %10
%60 = load i32, i32* %11
%61 = add nsw i32 %60, 1
%62 = load i32, i32* %12
%63 = add nsw i32 %62, 1
br label %64
64: ; preds = %47, %39
%65 = load i8*, i8** %7
%66 = getelementptr inbounds i8, i8* %65, i32 1
store i8* %66, i8** %7
%67 = load i32, i32* %12
%68 = add nsw i32 %67, 1
store i32 %68, i32* %12
br label %35
69: ; preds = %35
br label %70
70: ; preds = %69, %32
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @display_sequence(i8* nocapture %0, i8* nocapture %1, i32 %2, i32* nocapture %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %4, %2
br i1 %7, label %16, label %8
8: ; preds = %6
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %42, label %11
11: ; preds = %8
%12 = sext i32 %4 to i64
%13 = getelementptr inbounds i32, i32* %3, i64 %12
%14 = getelementptr inbounds i8, i8* %1, i64 1
%15 = add nsw i32 %4, 1
br label %29
16: ; preds = %6
%17 = icmp sgt i32 %4, 0
br i1 %17, label %18, label %27
18: ; preds = %16
%19 = zext i32 %4 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %25, %20 ]
%22 = getelementptr inbounds i32, i32* %3, i64 %21
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, %19
br i1 %26, label %27, label %20
27: ; preds = %20, %16
%28 = tail call i32 @putchar(i32 10)
br label %42
29: ; preds = %11, %38
%30 = phi i8 [ %9, %11 ], [ %40, %38 ]
%31 = phi i32 [ %5, %11 ], [ %35, %38 ]
%32 = phi i8* [ %0, %11 ], [ %39, %38 ]
%33 = load i8, i8* %1
%34 = icmp eq i8 %30, %33
%35 = add nsw i32 %31, 1
br i1 %34, label %36, label %38
36: ; preds = %29
store i32 %35, i32* %13
%37 = getelementptr inbounds i8, i8* %32, i64 1
tail call void @display_sequence(i8* %37, i8* %14, i32 %2, i32* %3, i32 %15, i32 %35)
br label %38
38: ; preds = %29, %36
%39 = getelementptr inbounds i8, i8* %32, i64 1
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %42, label %29
42: ; preds = %38, %8, %27
ret void
}