#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__ is_excess_seq(char *, char *, char *, char *, size_t *);
scalar_t__ is_missing_seq(char *, char *, char *, char *, size_t *);
void analyse(char *expect_buf, size_t expect_buf_len, char *actual_buf,
             size_t actual_buf_len, char *mark_buf, size_t mark_buf_len) {
  char *mark_buf_idx = mark_buf;
  char *mark_buf_end = mark_buf + mark_buf_len;
  char *expect_buf_idx = expect_buf;
  char *expect_buf_end = expect_buf + expect_buf_len;
  char *actual_buf_idx = actual_buf;
  char *actual_buf_end = actual_buf + actual_buf_len;
  while (mark_buf_idx < mark_buf_end) {
    size_t runlen;
    if (expect_buf_idx >= expect_buf_end && actual_buf_idx >= actual_buf_end) {
      *mark_buf_idx++ = ' ';
    } else if (expect_buf_idx >= expect_buf_end &&
               actual_buf_idx < actual_buf_end) {
      *mark_buf_idx++ = '^';
      actual_buf_idx++;
    } else if (expect_buf_idx < expect_buf_end &&
               actual_buf_idx >= actual_buf_end) {
      *mark_buf_idx++ = '!';
      expect_buf_idx++;
    } else if (expect_buf_idx < expect_buf_end &&
               actual_buf_idx < actual_buf_end &&
               *expect_buf_idx == *actual_buf_idx) {
      *mark_buf_idx++ = ' ';
      expect_buf_idx++;
      actual_buf_idx++;
    } else if (is_missing_seq(expect_buf_idx, expect_buf_end, actual_buf_idx,
                              actual_buf_end, &runlen)) {
      *mark_buf_idx++ = '!';
      expect_buf_idx += runlen + 1;
      actual_buf_idx++;
    } else if (is_excess_seq(expect_buf_idx, expect_buf_end, actual_buf_idx,
                             actual_buf_end, &runlen)) {
      *mark_buf_idx++ = '^';
      actual_buf_idx += runlen;
    } else {
      *mark_buf_idx++ = '*';
      expect_buf_idx++;
      actual_buf_idx++;
    }
  }
}


x86 assembly (clang, -O0):
<analyse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    1380 <analyse+0x260>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jb     11bd <analyse+0x9d>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jb     11bd <analyse+0x9d>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x20,(%rax)
jmp    137b <analyse+0x25b>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jb     11fc <analyse+0xdc>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    11fc <analyse+0xdc>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x5e,(%rax)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1376 <analyse+0x256>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    123b <analyse+0x11b>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jb     123b <analyse+0x11b>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x21,(%rax)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1371 <analyse+0x251>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    129c <analyse+0x17c>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    129c <analyse+0x17c>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
mov    -0x58(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    129c <analyse+0x17c>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x20,(%rax)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    136c <analyse+0x24c>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
lea    -0x68(%rbp),%r8
call   1030 <is_missing_seq@plt>
cmp    $0x0,%rax
je     12f2 <analyse+0x1d2>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x21,(%rax)
mov    -0x68(%rbp),%rax
add    $0x1,%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1367 <analyse+0x247>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
lea    -0x68(%rbp),%r8
call   1040 <is_excess_seq@plt>
cmp    $0x0,%rax
je     1338 <analyse+0x218>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x5e,(%rax)
mov    -0x68(%rbp),%rax
add    -0x58(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    1362 <analyse+0x242>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x2a,(%rax)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1367 <analyse+0x247>
jmp    136c <analyse+0x24c>
jmp    1371 <analyse+0x251>
jmp    1376 <analyse+0x256>
jmp    137b <analyse+0x25b>
jmp    117c <analyse+0x5c>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %r9,%r9
jle    122f <analyse+0x10f>
mov    %r8,%rbx
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbp
add    %r8,%r9
add    %rdi,%r13
add    %rdx,%r15
lea    0x8(%rsp),%r14
mov    %r9,0x10(%rsp)
jmp    1170 <analyse+0x50>
nopl   0x0(%rax,%rax,1)
movb   $0x20,(%rbx)
add    $0x1,%rbx
cmp    %r9,%rbx
jae    122f <analyse+0x10f>
cmp    %r13,%rbp
jb     117a <analyse+0x5a>
cmp    %r15,%r12
jae    1160 <analyse+0x40>
cmp    %r13,%rbp
setae  %al
jb     1190 <analyse+0x70>
cmp    %r15,%r12
jae    1190 <analyse+0x70>
movb   $0x5e,(%rbx)
add    $0x1,%r12
jmp    1163 <analyse+0x43>
cmp    %r15,%r12
setb   %cl
or     %cl,%al
je     11bb <analyse+0x9b>
cmp    %r13,%rbp
jae    11c4 <analyse+0xa4>
cmp    %r15,%r12
jae    11c4 <analyse+0xa4>
movzbl 0x0(%rbp),%eax
cmp    (%r12),%al
jne    11c4 <analyse+0xa4>
movb   $0x20,(%rbx)
add    $0x1,%rbp
add    $0x1,%r12
jmp    1163 <analyse+0x43>
movb   $0x21,(%rbx)
add    $0x1,%rbp
jmp    1163 <analyse+0x43>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <is_missing_seq@plt>
test   %rax,%rax
je     11f2 <analyse+0xd2>
movb   $0x21,(%rbx)
mov    0x8(%rsp),%rax
add    %rax,%rbp
add    $0x1,%rbp
add    $0x1,%r12
jmp    1225 <analyse+0x105>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <is_excess_seq@plt>
test   %rax,%rax
je     1215 <analyse+0xf5>
movb   $0x5e,(%rbx)
add    0x8(%rsp),%r12
jmp    1220 <analyse+0x100>
movb   $0x2a,(%rbx)
add    $0x1,%rbp
add    $0x1,%r12
lea    0x8(%rsp),%r14
mov    0x10(%rsp),%r9
jmp    1163 <analyse+0x43>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @analyse(i8* %0, i64 %1, i8* %2, i64 %3, i8* %4, i64 %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i64
store i8* %0, i8** %7
store i64 %1, i64* %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i64 %5, i64* %12
%20 = load i8*, i8** %11
store i8* %20, i8** %13
%21 = load i8*, i8** %11
%22 = load i64, i64* %12
%23 = getelementptr inbounds i8, i8* %21, i64 %22
store i8* %23, i8** %14
%24 = load i8*, i8** %7
store i8* %24, i8** %15
%25 = load i8*, i8** %7
%26 = load i64, i64* %8
%27 = getelementptr inbounds i8, i8* %25, i64 %26
store i8* %27, i8** %16
%28 = load i8*, i8** %9
store i8* %28, i8** %17
%29 = load i8*, i8** %9
%30 = load i64, i64* %10
%31 = getelementptr inbounds i8, i8* %29, i64 %30
store i8* %31, i8** %18
br label %32
32: ; preds = %137, %6
%33 = load i8*, i8** %13
%34 = load i8*, i8** %14
%35 = icmp ult i8* %33, %34
br i1 %35, label %36, label %138
36: ; preds = %32
%37 = load i8*, i8** %15
%38 = load i8*, i8** %16
%39 = icmp uge i8* %37, %38
br i1 %39, label %40, label %47
40: ; preds = %36
%41 = load i8*, i8** %17
%42 = load i8*, i8** %18
%43 = icmp uge i8* %41, %42
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i8*, i8** %13
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %13
store i8 32, i8* %45
br label %137
47: ; preds = %40, %36
%48 = load i8*, i8** %15
%49 = load i8*, i8** %16
%50 = icmp uge i8* %48, %49
br i1 %50, label %51, label %60
51: ; preds = %47
%52 = load i8*, i8** %17
%53 = load i8*, i8** %18
%54 = icmp ult i8* %52, %53
br i1 %54, label %55, label %60
55: ; preds = %51
%56 = load i8*, i8** %13
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %13
store i8 94, i8* %56
%58 = load i8*, i8** %17
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %17
br label %136
60: ; preds = %51, %47
%61 = load i8*, i8** %15
%62 = load i8*, i8** %16
%63 = icmp ult i8* %61, %62
br i1 %63, label %64, label %73
64: ; preds = %60
%65 = load i8*, i8** %17
%66 = load i8*, i8** %18
%67 = icmp uge i8* %65, %66
br i1 %67, label %68, label %73
68: ; preds = %64
%69 = load i8*, i8** %13
%70 = getelementptr inbounds i8, i8* %69, i32 1
store i8* %70, i8** %13
store i8 33, i8* %69
%71 = load i8*, i8** %15
%72 = getelementptr inbounds i8, i8* %71, i32 1
store i8* %72, i8** %15
br label %135
73: ; preds = %64, %60
%74 = load i8*, i8** %15
%75 = load i8*, i8** %16
%76 = icmp ult i8* %74, %75
br i1 %76, label %77, label %96
77: ; preds = %73
%78 = load i8*, i8** %17
%79 = load i8*, i8** %18
%80 = icmp ult i8* %78, %79
br i1 %80, label %81, label %96
81: ; preds = %77
%82 = load i8*, i8** %15
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = load i8*, i8** %17
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %84, %87
br i1 %88, label %89, label %96
89: ; preds = %81
%90 = load i8*, i8** %13
%91 = getelementptr inbounds i8, i8* %90, i32 1
store i8* %91, i8** %13
store i8 32, i8* %90
%92 = load i8*, i8** %15
%93 = getelementptr inbounds i8, i8* %92, i32 1
store i8* %93, i8** %15
%94 = load i8*, i8** %17
%95 = getelementptr inbounds i8, i8* %94, i32 1
store i8* %95, i8** %17
br label %134
96: ; preds = %81, %77, %73
%97 = load i8*, i8** %15
%98 = load i8*, i8** %16
%99 = load i8*, i8** %17
%100 = load i8*, i8** %18
%101 = call i64 @is_missing_seq(i8* %97, i8* %98, i8* %99, i8* %100, i64* %19)
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %112
103: ; preds = %96
%104 = load i8*, i8** %13
%105 = getelementptr inbounds i8, i8* %104, i32 1
store i8* %105, i8** %13
store i8 33, i8* %104
%106 = load i64, i64* %19
%107 = add i64 %106, 1
%108 = load i8*, i8** %15
%109 = getelementptr inbounds i8, i8* %108, i64 %107
store i8* %109, i8** %15
%110 = load i8*, i8** %17
%111 = getelementptr inbounds i8, i8* %110, i32 1
store i8* %111, i8** %17
br label %133
112: ; preds = %96
%113 = load i8*, i8** %15
%114 = load i8*, i8** %16
%115 = load i8*, i8** %17
%116 = load i8*, i8** %18
%117 = call i64 @is_excess_seq(i8* %113, i8* %114, i8* %115, i8* %116, i64* %19)
%118 = icmp ne i64 %117, 0
br i1 %118, label %119, label %125
119: ; preds = %112
%120 = load i8*, i8** %13
%121 = getelementptr inbounds i8, i8* %120, i32 1
store i8* %121, i8** %13
store i8 94, i8* %120
%122 = load i64, i64* %19
%123 = load i8*, i8** %17
%124 = getelementptr inbounds i8, i8* %123, i64 %122
store i8* %124, i8** %17
br label %132
125: ; preds = %112
%126 = load i8*, i8** %13
%127 = getelementptr inbounds i8, i8* %126, i32 1
store i8* %127, i8** %13
store i8 42, i8* %126
%128 = load i8*, i8** %15
%129 = getelementptr inbounds i8, i8* %128, i32 1
store i8* %129, i8** %15
%130 = load i8*, i8** %17
%131 = getelementptr inbounds i8, i8* %130, i32 1
store i8* %131, i8** %17
br label %132
132: ; preds = %125, %119
br label %133
133: ; preds = %132, %103
br label %134
134: ; preds = %133, %89
br label %135
135: ; preds = %134, %68
br label %136
136: ; preds = %135, %55
br label %137
137: ; preds = %136, %44
br label %32
138: ; preds = %32
ret void
}

LLVM IR (-O2):
define void @analyse(i8* %0, i64 %1, i8* %2, i64 %3, i8* writeonly %4, i64 %5) {
%7 = alloca i64
%8 = getelementptr inbounds i8, i8* %4, i64 %5
%9 = getelementptr inbounds i8, i8* %0, i64 %1
%10 = getelementptr inbounds i8, i8* %2, i64 %3
%11 = icmp sgt i64 %5, 0
br i1 %11, label %12, label %62
12: ; preds = %6
%13 = bitcast i64* %7 to i8*
br label %14
14: ; preds = %12, %57
%15 = phi i8* [ %4, %12 ], [ %60, %57 ]
%16 = phi i8* [ %2, %12 ], [ %59, %57 ]
%17 = phi i8* [ %0, %12 ], [ %58, %57 ]
%18 = icmp ult i8* %17, %9
%19 = icmp ult i8* %16, %10
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %22, label %21
21: ; preds = %14
store i8 32, i8* %15
br label %57
22: ; preds = %14
%23 = xor i1 %18, true
%24 = select i1 %23, i1 %19, i1 false
br i1 %24, label %25, label %27
25: ; preds = %22
store i8 94, i8* %15
%26 = getelementptr inbounds i8, i8* %16, i64 1
br label %57
27: ; preds = %22
%28 = select i1 %23, i1 true, i1 %19
br i1 %28, label %31, label %29
29: ; preds = %27
store i8 33, i8* %15
%30 = getelementptr inbounds i8, i8* %17, i64 1
br label %57
31: ; preds = %27
%32 = select i1 %18, i1 %19, i1 false
br i1 %32, label %33, label %40
33: ; preds = %31
%34 = load i8, i8* %17
%35 = load i8, i8* %16
%36 = icmp eq i8 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %33
store i8 32, i8* %15
%38 = getelementptr inbounds i8, i8* %17, i64 1
%39 = getelementptr inbounds i8, i8* %16, i64 1
br label %57
40: ; preds = %33, %31
%41 = call i64 @is_missing_seq(i8* %17, i8* %9, i8* %16, i8* %10, i64* %7)
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %40
store i8 33, i8* %15
%44 = load i64, i64* %7
%45 = add i64 %44, 1
%46 = getelementptr inbounds i8, i8* %17, i64 %45
%47 = getelementptr inbounds i8, i8* %16, i64 1
br label %57
48: ; preds = %40
%49 = call i64 @is_excess_seq(i8* %17, i8* %9, i8* %16, i8* %10, i64* %7)
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %48
store i8 94, i8* %15
%52 = load i64, i64* %7
%53 = getelementptr inbounds i8, i8* %16, i64 %52
br label %57
54: ; preds = %48
store i8 42, i8* %15
%55 = getelementptr inbounds i8, i8* %17, i64 1
%56 = getelementptr inbounds i8, i8* %16, i64 1
br label %57
57: ; preds = %25, %37, %51, %54, %43, %29, %21
%58 = phi i8* [ %17, %21 ], [ %17, %25 ], [ %30, %29 ], [ %38, %37 ], [ %46, %43 ], [ %17, %51 ], [ %55, %54 ]
%59 = phi i8* [ %16, %21 ], [ %26, %25 ], [ %16, %29 ], [ %39, %37 ], [ %47, %43 ], [ %53, %51 ], [ %56, %54 ]
%60 = getelementptr inbounds i8, i8* %15, i64 1
%61 = icmp ult i8* %60, %8
br i1 %61, label %14, label %62
62: ; preds = %57, %6
ret void
}