#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 d(int);
int /*<<< orphan*/ nicename(unsigned int, char *, char *);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ putchar(char);
void grick(unsigned count) {
  int i;
  nicename(count, "grick", "MM 173");
  for (i = 0; i < count; i++) {
    printf("%d: %d hp, 14 AC", i + 1, d(8) + d(8) + d(8) + d(8) + d(8) + d(8));
    (void)putchar('\n');
  }
  (void)putchar('\n');
}


x86 assembly (clang, -O0):
<grick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xeab(%rip),%rsi
lea    0xeaa(%rip),%rdx
call   1060 <nicename@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1210 <grick+0xd0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x8,%edi
call   1040 <d@plt>
mov    %eax,-0x20(%rbp)
mov    $0x8,%edi
call   1040 <d@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x8,%edi
call   1040 <d@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0x8,%edi
call   1040 <d@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x8,%edi
call   1040 <d@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x8,%edi
call   1040 <d@plt>
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%esi
add    %eax,%edx
lea    0xe1a(%rip),%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1168 <grick+0x28>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grick>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
lea    0xeaf(%rip),%rsi
lea    0xeae(%rip),%rdx
call   1060 <nicename@plt>
test   %r14d,%r14d
je     11f1 <grick+0xb1>
neg    %r14d
mov    $0x1,%ebx
lea    0xe98(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x8,%edi
call   1040 <d@plt>
mov    %eax,%ebp
mov    $0x8,%edi
call   1040 <d@plt>
add    %eax,%ebp
mov    $0x8,%edi
call   1040 <d@plt>
add    %eax,%ebp
mov    $0x8,%edi
call   1040 <d@plt>
add    %eax,%ebp
mov    $0x8,%edi
call   1040 <d@plt>
add    %eax,%ebp
mov    $0x8,%edi
call   1040 <d@plt>
add    %eax,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1180 <grick+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"grick\00"
@.str.1 = [7 x i8] c"MM 173\00"
@.str.2 = [17 x i8] c"%d: %d hp, 14 AC\00"
define void @grick(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @nicename(i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %26, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %29
10: ; preds = %6
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
%13 = call i32 @d(i32 8)
%14 = call i32 @d(i32 8)
%15 = add nsw i32 %13, %14
%16 = call i32 @d(i32 8)
%17 = add nsw i32 %15, %16
%18 = call i32 @d(i32 8)
%19 = add nsw i32 %17, %18
%20 = call i32 @d(i32 8)
%21 = add nsw i32 %19, %20
%22 = call i32 @d(i32 8)
%23 = add nsw i32 %21, %22
%24 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %23)
%25 = call i32 @putchar(i8 signext 10)
br label %26
26: ; preds = %10
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %6
29: ; preds = %6
%30 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"grick\00"
@.str.1 = [7 x i8] c"MM 173\00"
@.str.2 = [17 x i8] c"%d: %d hp, 14 AC\00"
define void @grick(i32 %0) {
%2 = tail call i32 @nicename(i32 %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %0, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw i32 %5, 1
%7 = tail call i32 @d(i32 8)
%8 = tail call i32 @d(i32 8)
%9 = add nsw i32 %8, %7
%10 = tail call i32 @d(i32 8)
%11 = add nsw i32 %9, %10
%12 = tail call i32 @d(i32 8)
%13 = add nsw i32 %11, %12
%14 = tail call i32 @d(i32 8)
%15 = add nsw i32 %13, %14
%16 = tail call i32 @d(i32 8)
%17 = add nsw i32 %15, %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %17)
%19 = tail call i32 @putchar(i8 signext 10)
%20 = icmp eq i32 %6, %0
br i1 %20, label %21, label %4
21: ; preds = %4, %1
%22 = tail call i32 @putchar(i8 signext 10)
ret void
}