#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 *findAnagrams(char *, char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main() {
  char *s = "anticonstitutional";
  char *p = "it";
  int retSize;
  int *anagrams = findAnagrams(s, p, &retSize);
  printf("%s :: %s\n", s, p);
  for (int i = 0; i < retSize; i++) {
    printf("%d: ", anagrams[i]);
    for (int c = 0; c < strlen(s); c++) {
      if (c == anagrams[i])
        printf("(");
      else if (c == anagrams[i] + strlen(p))
        printf(")");
      printf("%c", s[c]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <findAnagrams@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    127c <main+0x14c>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    1260 <main+0x130>
mov    -0x30(%rbp),%eax
mov    -0x28(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    11f6 <main+0xc6>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1238 <main+0x108>
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x3c(%rbp),%ecx
mov    %eax,%edx
mov    -0x38(%rbp),%eax
add    %edx,%ecx
cmp    %ecx,%eax
jne    1233 <main+0x103>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1238 <main+0x108>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b3 <main+0x83>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1187 <main+0x57>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%r14
lea    0xeba(%rip),%r15
lea    0x4(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <findAnagrams@plt>
mov    %rax,%r13
lea    0xea3(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1229 <main+0xe9>
lea    0xe81(%rip),%r12
xor    %ebx,%ebx
jmp    11b8 <main+0x78>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jge    1229 <main+0xe9>
mov    0x0(%r13,%rbx,4),%esi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11a0 <main+0x60>
xor    %ebp,%ebp
jmp    1203 <main+0xc3>
nopl   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
movsbl 0x0(%rbp,%r14,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    11a0 <main+0x60>
mov    0x0(%r13,%rbx,4),%r15d
mov    $0x28,%edi
cmp    %r15,%rbp
je     11e0 <main+0xa0>
mov    %r12,%rdi
call   1040 <strlen@plt>
add    %r15d,%eax
mov    $0x29,%edi
cmp    %rax,%rbp
je     11e0 <main+0xa0>
jmp    11e5 <main+0xa5>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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