#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]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<add_man>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    117a <add_man+0x6a>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x8(%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 -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1030 <my_mvaddstr@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <add_man+0x15>
xor    %eax,%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
call   1030 <my_mvaddstr@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %25, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = add nsw i32 84, %14
%16 = sdiv i32 %15, 12
%17 = srem i32 %16, 2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [2 x [2 x i8*]], [2 x [2 x i8*]]* @add_man.man, i64 0, i64 %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [2 x i8*], [2 x i8*]* %19, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @my_mvaddstr(i32 %12, i32 %13, i8* %23)
br label %25
25: ; preds = %9
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %6
28: ; preds = %6
ret i32 0
}

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 0
}