#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*/ diagnostics(int, char *, char *);
char *strstr(char *, char *);
void HA_CleanTemplate(char *HA_template) {
  char *s = HA_template;
  while ((s = strstr(s, "\\hfill"))) {
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
  }
  s = HA_template;
  while ((s = strstr(s, "\\hfil"))) {
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
  }
  s = HA_template;
  while ((s = strstr(s, "\\qquad"))) {
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
  }
  s = HA_template;
  while ((s = strstr(s, "\\quad"))) {
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
    *s++ = ' ';
  }
  diagnostics(5, "template='%s'", HA_template);
}


x86 assembly (clang, -O0):
<HA_CleanTemplate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11c3 <HA_CleanTemplate+0xa3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
jmp    1134 <HA_CleanTemplate+0x14>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1248 <HA_CleanTemplate+0x128>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
jmp    11cb <HA_CleanTemplate+0xab>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     12df <HA_CleanTemplate+0x1bf>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
jmp    1250 <HA_CleanTemplate+0x130>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd22(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1364 <HA_CleanTemplate+0x244>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
jmp    12e7 <HA_CleanTemplate+0x1c7>
mov    -0x8(%rbp),%rdx
mov    $0x5,%edi
lea    0xca6(%rip),%rsi
call   1030 <diagnostics@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HA_CleanTemplate>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     115d <HA_CleanTemplate+0x3d>
lea    0xec1(%rip),%rbx
nop
lea    0x6(%rax),%rdi
movw   $0x2020,0x4(%rax)
movl   $0x20202020,(%rax)
mov    %rbx,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
jne    1140 <HA_CleanTemplate+0x20>
lea    0xea3(%rip),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     119b <HA_CleanTemplate+0x7b>
lea    0xe8f(%rip),%rbx
nopl   0x0(%rax,%rax,1)
lea    0x5(%rax),%rdi
movb   $0x20,0x4(%rax)
movl   $0x20202020,(%rax)
mov    %rbx,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
jne    1180 <HA_CleanTemplate+0x60>
lea    0xe6b(%rip),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     11dd <HA_CleanTemplate+0xbd>
lea    0xe57(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
lea    0x6(%rax),%rdi
movw   $0x2020,0x4(%rax)
movl   $0x20202020,(%rax)
mov    %rbx,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
jne    11c0 <HA_CleanTemplate+0xa0>
lea    0xe30(%rip),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     121b <HA_CleanTemplate+0xfb>
lea    0xe1c(%rip),%rbx
nopl   0x0(%rax,%rax,1)
lea    0x5(%rax),%rdi
movb   $0x20,0x4(%rax)
movl   $0x20202020,(%rax)
mov    %rbx,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
jne    1200 <HA_CleanTemplate+0xe0>
lea    0xdf8(%rip),%rsi
mov    $0x5,%edi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <diagnostics@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"\\hfill\00"
@.str.1 = [6 x i8] c"\\hfil\00"
@.str.2 = [7 x i8] c"\\qquad\00"
@.str.3 = [6 x i8] c"\\quad\00"
@.str.4 = [14 x i8] c"template='%s'\00"
define void @HA_CleanTemplate(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %7, %1
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %12, label %15
7: ; preds = %1, %7
%8 = phi i8* [ %10, %7 ], [ %2, %1 ]
%9 = getelementptr inbounds i8, i8* %8, i64 6
%10 = tail call i8* @strstr(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %4, label %7
12: ; preds = %15, %4
%13 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %23
15: ; preds = %4, %15
%16 = phi i8* [ %18, %15 ], [ %5, %4 ]
%17 = getelementptr inbounds i8, i8* %16, i64 5
%18 = tail call i8* @strstr(i8* dereferenceable(1) %17, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %12, label %15
20: ; preds = %23, %12
%21 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i8* %21, null
br i1 %22, label %33, label %28
23: ; preds = %12, %23
%24 = phi i8* [ %26, %23 ], [ %13, %12 ]
%25 = getelementptr inbounds i8, i8* %24, i64 6
%26 = tail call i8* @strstr(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i8* %26, null
br i1 %27, label %20, label %23
28: ; preds = %20, %28
%29 = phi i8* [ %31, %28 ], [ %21, %20 ]
%30 = getelementptr inbounds i8, i8* %29, i64 5
%31 = tail call i8* @strstr(i8* dereferenceable(1) %30, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %28
33: ; preds = %28, %20
%34 = tail call i32 @diagnostics(i32 5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %0)
ret void
}