#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*/ my_mvaddstr(int, int, char *);
int add_man(int y, int x) {
  static char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}};
  int i;
  for (i = 0; i < 2; ++i) {
    my_mvaddstr(y + i, x, man[(84 + x) / 12 % 2][i]);
  }
}


x86 assembly (clang, -O0):
<add_man>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    117a <add_man+0x6a>
mov    -0x8(%rbp),%edi
add    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%eax
add    $0x54,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2ed8(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1030 <my_mvaddstr@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1125 <add_man+0x15>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_man>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
lea    0x54(%rbx),%eax
cltq
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cltq
shl    $0x4,%rax
lea    0x2cb6(%rip),%rcx
mov    (%rax,%rcx,1),%rdx
mov    0x8(%rax,%rcx,1),%r14
call   1030 <my_mvaddstr@plt>
add    $0x1,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <my_mvaddstr@plt>

LLVM IR (-O0):
@add_man.man = internal global [2 x [2 x i8*]] [[2 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0)], [2 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]]
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"(O)\00"
@.str.2 = [6 x i8] c"Help!\00"
@.str.3 = [4 x i8] c"\\O/\00"
define i32 @add_man(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %26, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %29
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %5
%16 = add nsw i32 84, %15
%17 = sdiv i32 %16, 12
%18 = srem i32 %17, 2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [2 x [2 x i8*]], [2 x [2 x i8*]]* @add_man.man, i64 0, i64 %19
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [2 x i8*], [2 x i8*]* %20, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @my_mvaddstr(i32 %13, i32 %14, i8* %24)
br label %26
26: ; preds = %10
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %7
29: ; preds = %7
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@add_man.man = internal unnamed_addr constant [2 x [2 x i8*]] [[2 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0)], [2 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]]
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"(O)\00"
@.str.2 = [6 x i8] c"Help!\00"
@.str.3 = [4 x i8] c"\\O/\00"
define i32 @add_man(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 84
%4 = sdiv i32 %3, 12
%5 = srem i32 %4, 2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [2 x [2 x i8*]], [2 x [2 x i8*]]* @add_man.man, i64 0, i64 %6, i64 0
%8 = load i8*, i8** %7
%9 = tail call i32 @my_mvaddstr(i32 %0, i32 %1, i8* %8)
%10 = add i32 %0, 1
%11 = getelementptr inbounds [2 x [2 x i8*]], [2 x [2 x i8*]]* @add_man.man, i64 0, i64 %6, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @my_mvaddstr(i32 %10, i32 %1, i8* %12)
ret i32 undef
}