#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*/ print(char *, int /*<<< orphan*/, int, int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
void solve(int n) {
  printf("XKCD-like name(s) of length: %d\n", n);
  if (n == 2) {
    printf("pz\nrx\nsw\ntv\n");
  } else {
    char answer[43];
    answer[n] = '\0';
    int used[26];
    int i;
    for (i = 0; i < 26; i++)
      used[i] = 0;
    used[0] = 1;
    used[4] = 1;
    used[8] = 1;
    used[14] = 1;
    used[20] = 1;
    used[24] = 1;
    int gotone = 0;
    print(answer, 0, n, used, 42, &gotone);
    if (!gotone)
      printf("Mostly Harmless\n");
  }
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    115c <solve+0x3c>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121e <solve+0xfe>
movslq -0x4(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
movl   $0x0,-0xa4(%rbp)
cmpl   $0x1a,-0xa4(%rbp)
jge    11a2 <solve+0x82>
movslq -0xa4(%rbp),%rax
movl   $0x0,-0xa0(%rbp,%rax,4)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    116f <solve+0x4f>
movl   $0x1,-0xa0(%rbp)
movl   $0x1,-0x90(%rbp)
movl   $0x1,-0x80(%rbp)
movl   $0x1,-0x68(%rbp)
movl   $0x1,-0x50(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0xa8(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    -0xa0(%rbp),%rcx
xor    %esi,%esi
mov    $0x2a,%r8d
lea    -0xa8(%rbp),%r9
call   1040 <print@plt>
cmpl   $0x0,-0xa8(%rbp)
jne    1219 <solve+0xf9>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121e <solve+0xfe>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbx
sub    $0xb0,%rsp
mov    %edi,%ebx
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebx
jne    1163 <solve+0x33>
lea    0xedb(%rip),%rdi
add    $0xb0,%rsp
pop    %rbx
jmp    1030 <puts@plt>
movslq %ebx,%rax
movb   $0x0,0x80(%rsp,%rax,1)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movq   $0x0,0x70(%rsp)
movl   $0x1,0x10(%rsp)
movl   $0x1,0x20(%rsp)
movl   $0x1,0x30(%rsp)
movl   $0x1,0x48(%rsp)
movl   $0x1,0x60(%rsp)
movl   $0x1,0x70(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x80(%rsp),%rdi
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r9
xor    %esi,%esi
mov    %ebx,%edx
mov    $0x2a,%r8d
call   1050 <print@plt>
cmpl   $0x0,0xc(%rsp)
jne    1204 <solve+0xd4>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
add    $0xb0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"XKCD-like name(s) of length: %d\0A\00"
@.str.1 = [13 x i8] c"pz\0Arx\0Asw\0Atv\0A\00"
@.str.2 = [17 x i8] c"Mostly Harmless\0A\00"
define void @solve(i32 %0) {
%2 = alloca i32
%3 = alloca [43 x i8]
%4 = alloca [26 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %43
13: ; preds = %1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [43 x i8], [43 x i8]* %3, i64 0, i64 %15
store i8 0, i8* %16
store i32 0, i32* %5
br label %17
17: ; preds = %24, %13
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 26
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %22
store i32 0, i32* %23
br label %24
24: ; preds = %20
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %17
27: ; preds = %17
%28 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 0
store i32 1, i32* %28
%29 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 4
store i32 1, i32* %29
%30 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 8
store i32 1, i32* %30
%31 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 14
store i32 1, i32* %31
%32 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 20
store i32 1, i32* %32
%33 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 24
store i32 1, i32* %33
store i32 0, i32* %6
%34 = getelementptr inbounds [43 x i8], [43 x i8]* %3, i64 0, i64 0
%35 = load i32, i32* %2
%36 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 0
%37 = call i32 @print(i8* %34, i32 0, i32 %35, i32* %36, i32 42, i32* %6)
%38 = load i32, i32* %6
%39 = icmp ne i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %27
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %40, %27
br label %43
43: ; preds = %42, %11
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"XKCD-like name(s) of length: %d\0A\00"
@str = [16 x i8] c"Mostly Harmless\00"
@str.3 = [12 x i8] c"pz\0Arx\0Asw\0Atv\00"
define void @solve(i32 %0) {
%2 = alloca [43 x i8]
%3 = alloca [26 x i32]
%4 = bitcast [26 x i32]* %3 to i8*
%5 = alloca i32
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.3, i64 0, i64 0))
br label %27
10: ; preds = %1
%11 = getelementptr inbounds [43 x i8], [43 x i8]* %2, i64 0, i64 0
%12 = sext i32 %0 to i64
%13 = getelementptr inbounds [43 x i8], [43 x i8]* %2, i64 0, i64 %12
store i8 0, i8* %13
%14 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 0
store i32 1, i32* %14
%15 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 4
store i32 1, i32* %15
%16 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 8
store i32 1, i32* %16
%17 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 14
store i32 1, i32* %17
%18 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 20
store i32 1, i32* %18
%19 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 24
store i32 1, i32* %19
%20 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%21 = call i32 @print(i8* %11, i32 0, i32 %0, i32* %14, i32 42, i32* %5)
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %10
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %24, %10
br label %27
27: ; preds = %26, %8
ret void
}