#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 */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
void extendednameenemy(char *s, int enemy) {
  memset(s, 0, sizeof(s));
  if (enemy % 13 == 10)
    sprintf(s, "adventurer with 10 HP");
  else if (enemy > 51)
    sprintf(s, "Hebrac itself");
  else if (enemy % 13 == 0)
    sprintf(s, "...nothing");
  else if ((enemy % 13 == 11) && (enemy < 26))
    sprintf(s, "white priestess");
  else if ((enemy % 13 == 11) && (enemy > 26))
    sprintf(s, "black priestess");
  else if (enemy % 13 == 12)
    sprintf(s, "merchant");
  else if (enemy < 13)
    sprintf(s, "amazon with %d HP", enemy % 13);
  else if (enemy < 26)
    sprintf(s, "demon with %d HP", enemy % 13);
  else if (enemy < 39)
    sprintf(s, "magician with %d HP", enemy % 13);
  else
    sprintf(s, "warrior with %d HP", enemy % 13);
}


x86 assembly (clang, -O0):
<extendednameenemy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xa,%edx
jne    116a <extendednameenemy+0x4a>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1314 <extendednameenemy+0x1f4>
cmpl   $0x33,-0xc(%rbp)
jle    118b <extendednameenemy+0x6b>
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    130f <extendednameenemy+0x1ef>
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b6 <extendednameenemy+0x96>
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    130a <extendednameenemy+0x1ea>
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jne    11eb <extendednameenemy+0xcb>
cmpl   $0x1a,-0xc(%rbp)
jge    11eb <extendednameenemy+0xcb>
mov    -0x8(%rbp),%rdi
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1305 <extendednameenemy+0x1e5>
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jne    1220 <extendednameenemy+0x100>
cmpl   $0x1a,-0xc(%rbp)
jle    1220 <extendednameenemy+0x100>
mov    -0x8(%rbp),%rdi
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1300 <extendednameenemy+0x1e0>
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
cmp    $0xc,%edx
jne    124b <extendednameenemy+0x12b>
mov    -0x8(%rbp),%rdi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    12fb <extendednameenemy+0x1db>
cmpl   $0xd,-0xc(%rbp)
jge    1277 <extendednameenemy+0x157>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    12f6 <extendednameenemy+0x1d6>
cmpl   $0x1a,-0xc(%rbp)
jge    12a3 <extendednameenemy+0x183>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    12f1 <extendednameenemy+0x1d1>
cmpl   $0x27,-0xc(%rbp)
jge    12cf <extendednameenemy+0x1af>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    12ec <extendednameenemy+0x1cc>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
lea    0xdaa(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    12f1 <extendednameenemy+0x1d1>
jmp    12f6 <extendednameenemy+0x1d6>
jmp    12fb <extendednameenemy+0x1db>
jmp    1300 <extendednameenemy+0x1e0>
jmp    1305 <extendednameenemy+0x1e5>
jmp    130a <extendednameenemy+0x1ea>
jmp    130f <extendednameenemy+0x1ef>
jmp    1314 <extendednameenemy+0x1f4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extendednameenemy>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
movslq %ebp,%rdx
imul   $0x4ec4ec4f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%ecx
lea    (%rax,%rcx,4),%eax
sub    %eax,%edx
cmp    $0xa,%edx
jne    1172 <extendednameenemy+0x52>
movups 0xea1(%rip),%xmm0
movups %xmm0,(%rbx)
movabs $0x50482030312068,%rax
mov    %rax,0xe(%rbx)
jmp    11d5 <extendednameenemy+0xb5>
cmp    $0x34,%ebp
jl     1194 <extendednameenemy+0x74>
movabs $0x666c6573746920,%rax
mov    %rax,0x6(%rbx)
movabs $0x6920636172626548,%rax
63 20 69
mov    %rax,(%rbx)
jmp    11d5 <extendednameenemy+0xb5>
test   %edx,%edx
je     11ab <extendednameenemy+0x8b>
cmp    $0x19,%ebp
jg     11c1 <extendednameenemy+0xa1>
cmp    $0xb,%edx
jne    11c1 <extendednameenemy+0xa1>
movups 0xe86(%rip),%xmm0
jmp    11d2 <extendednameenemy+0xb2>
movabs $0x6968746f6e2e2e2e,%rax
74 68 69
mov    %rax,(%rbx)
movl   $0x676e69,0x7(%rbx)
jmp    11d5 <extendednameenemy+0xb5>
cmp    $0x1b,%ebp
jl     11dc <extendednameenemy+0xbc>
cmp    $0xb,%edx
jne    11dc <extendednameenemy+0xbc>
movups 0xe6d(%rip),%xmm0
movups %xmm0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
cmp    $0xc,%edx
jne    11f4 <extendednameenemy+0xd4>
movabs $0x746e61686372656d,%rax
61 6e 74
mov    %rax,(%rbx)
movb   $0x0,0x8(%rbx)
jmp    11d5 <extendednameenemy+0xb5>
cmp    $0xc,%ebp
jg     1202 <extendednameenemy+0xe2>
lea    0xe58(%rip),%rsi
jmp    1225 <extendednameenemy+0x105>
cmp    $0x19,%ebp
jg     1210 <extendednameenemy+0xf0>
lea    0xe5c(%rip),%rsi
jmp    1225 <extendednameenemy+0x105>
cmp    $0x26,%ebp
ja     121e <extendednameenemy+0xfe>
lea    0xe5f(%rip),%rsi
jmp    1225 <extendednameenemy+0x105>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <sprintf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"adventurer with 10 HP\00"
@.str.1 = [14 x i8] c"Hebrac itself\00"
@.str.2 = [11 x i8] c"...nothing\00"
@.str.3 = [16 x i8] c"white priestess\00"
@.str.4 = [16 x i8] c"black priestess\00"
@.str.5 = [9 x i8] c"merchant\00"
@.str.6 = [18 x i8] c"amazon with %d HP\00"
@.str.7 = [17 x i8] c"demon with %d HP\00"
@.str.8 = [20 x i8] c"magician with %d HP\00"
@.str.9 = [19 x i8] c"warrior with %d HP\00"
define void @extendednameenemy(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @memset(i8* %5, i32 0, i32 8)
%7 = load i32, i32* %4
%8 = srem i32 %7, 13
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %90
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 51
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i8*, i8** %3
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %89
19: ; preds = %13
%20 = load i32, i32* %4
%21 = srem i32 %20, 13
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i8*, i8** %3
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %88
26: ; preds = %19
%27 = load i32, i32* %4
%28 = srem i32 %27, 13
%29 = icmp eq i32 %28, 11
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 26
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i8*, i8** %3
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %87
36: ; preds = %30, %26
%37 = load i32, i32* %4
%38 = srem i32 %37, 13
%39 = icmp eq i32 %38, 11
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i32, i32* %4
%42 = icmp sgt i32 %41, 26
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i8*, i8** %3
%45 = call i32 (i8*, i8*, ...) @sprintf(i8* %44, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %86
46: ; preds = %40, %36
%47 = load i32, i32* %4
%48 = srem i32 %47, 13
%49 = icmp eq i32 %48, 12
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i8*, i8** %3
%52 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %85
53: ; preds = %46
%54 = load i32, i32* %4
%55 = icmp slt i32 %54, 13
br i1 %55, label %56, label %61
56: ; preds = %53
%57 = load i8*, i8** %3
%58 = load i32, i32* %4
%59 = srem i32 %58, 13
%60 = call i32 (i8*, i8*, ...) @sprintf(i8* %57, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %59)
br label %84
61: ; preds = %53
%62 = load i32, i32* %4
%63 = icmp slt i32 %62, 26
br i1 %63, label %64, label %69
64: ; preds = %61
%65 = load i8*, i8** %3
%66 = load i32, i32* %4
%67 = srem i32 %66, 13
%68 = call i32 (i8*, i8*, ...) @sprintf(i8* %65, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %67)
br label %83
69: ; preds = %61
%70 = load i32, i32* %4
%71 = icmp slt i32 %70, 39
br i1 %71, label %72, label %77
72: ; preds = %69
%73 = load i8*, i8** %3
%74 = load i32, i32* %4
%75 = srem i32 %74, 13
%76 = call i32 (i8*, i8*, ...) @sprintf(i8* %73, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %75)
br label %82
77: ; preds = %69
%78 = load i8*, i8** %3
%79 = load i32, i32* %4
%80 = srem i32 %79, 13
%81 = call i32 (i8*, i8*, ...) @sprintf(i8* %78, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %77, %72
br label %83
83: ; preds = %82, %64
br label %84
84: ; preds = %83, %56
br label %85
85: ; preds = %84, %50
br label %86
86: ; preds = %85, %43
br label %87
87: ; preds = %86, %33
br label %88
88: ; preds = %87, %23
br label %89
89: ; preds = %88, %16
br label %90
90: ; preds = %89, %10
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"adventurer with 10 HP\00"
@.str.1 = [14 x i8] c"Hebrac itself\00"
@.str.2 = [11 x i8] c"...nothing\00"
@.str.3 = [16 x i8] c"white priestess\00"
@.str.4 = [16 x i8] c"black priestess\00"
@.str.5 = [9 x i8] c"merchant\00"
@.str.6 = [18 x i8] c"amazon with %d HP\00"
@.str.7 = [17 x i8] c"demon with %d HP\00"
@.str.8 = [20 x i8] c"magician with %d HP\00"
@.str.9 = [19 x i8] c"warrior with %d HP\00"
define void @extendednameenemy(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 8)
%4 = srem i32 %1, 13
%5 = icmp eq i32 %4, 10
br i1 %5, label %6, label %7
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(22) %0, i8* align 1 dereferenceable(22) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 22, i1 false)
br label %38
7: ; preds = %2
%8 = icmp sgt i32 %1, 51
br i1 %8, label %9, label %10
9: ; preds = %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(14) %0, i8* align 1 dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 14, i1 false)
br label %38
10: ; preds = %7
%11 = icmp eq i32 %4, 0
br i1 %11, label %12, label %13
12: ; preds = %10
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(11) %0, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 11, i1 false)
br label %38
13: ; preds = %10
%14 = icmp eq i32 %4, 11
%15 = icmp slt i32 %1, 26
%16 = and i1 %15, %14
br i1 %16, label %17, label %18
17: ; preds = %13
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %0, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 16, i1 false)
br label %38
18: ; preds = %13
%19 = icmp sgt i32 %1, 26
%20 = and i1 %19, %14
br i1 %20, label %21, label %22
21: ; preds = %18
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %0, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i64 16, i1 false)
br label %38
22: ; preds = %18
%23 = icmp eq i32 %4, 12
br i1 %23, label %24, label %25
24: ; preds = %22
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %0, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i64 9, i1 false)
br label %38
25: ; preds = %22
%26 = icmp slt i32 %1, 13
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %4)
br label %38
29: ; preds = %25
br i1 %15, label %30, label %32
30: ; preds = %29
%31 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %4)
br label %38
32: ; preds = %29
%33 = icmp ult i32 %1, 39
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %4)
br label %38
36: ; preds = %32
%37 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %4)
br label %38
38: ; preds = %9, %17, %24, %30, %36, %34, %27, %21, %12, %6
ret void
}