#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_smoke(int y, int x) {
  static struct smokes {
    int y, x;
    int ptrn, kind;
  } S[1000];
  static int sum = 0;
  static char *Smoke[2][16] = {
      {"(   )", "(    )", "(    )", "(   )", "(  )", "(  )", "( )", "( )", "()",
       "()", "O", "O", "O", "O", "O", " "},
      {"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)", "(@@)", "(@)", "(@)", "@@",
       "@@", "@", "@", "@", "@", "@", " "}};
  static char *Eraser[16] = {
      "     ", "      ", "      ", "     ", "    ", "    ", "   ", "   ",
      "  ",    "  ",     " ",      " ",     " ",    " ",    " ",   " "};
  static int dy[16] = {2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  static int dx[16] = {-2, -1, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3};
  int i;
  if (x % 4 == 0) {
    for (i = 0; i < sum; ++i) {
      my_mvaddstr(S[i].y, S[i].x, Eraser[S[i].ptrn]);
      S[i].y -= dy[S[i].ptrn];
      S[i].x += dx[S[i].ptrn];
      S[i].ptrn += (S[i].ptrn < 16 - 1) ? 1 : 0;
      my_mvaddstr(S[i].y, S[i].x, Smoke[S[i].kind][S[i].ptrn]);
    }
    my_mvaddstr(y, x, Smoke[sum % 2][0]);
    S[sum].y = y;
    S[sum].x = x;
    S[sum].ptrn = 0;
    S[sum].kind = sum % 2;
    sum++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<add_smoke>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    136e <add_smoke+0x25e>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    0x6f7e(%rip),%eax
jge    12bb <add_smoke+0x1ab>
movslq -0xc(%rbp),%rcx
lea    0x30ed(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%edi
movslq -0xc(%rbp),%rcx
lea    0x30d9(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
movslq -0xc(%rbp),%rcx
lea    0x30c4(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
lea    0x2fa2(%rip),%rax
mov    (%rax,%rcx,8),%rdx
call   1030 <my_mvaddstr@plt>
movslq -0xc(%rbp),%rcx
lea    0x309e(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
lea    0x2ffc(%rip),%rax
mov    (%rax,%rcx,4),%edx
movslq -0xc(%rbp),%rcx
lea    0x307e(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
movslq -0xc(%rbp),%rcx
lea    0x3066(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
lea    0x3004(%rip),%rax
mov    (%rax,%rcx,4),%ecx
movslq -0xc(%rbp),%rdx
lea    0x3046(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
add    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
movslq -0xc(%rbp),%rcx
lea    0x302e(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%edx
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0xf,%edx
cmovl  %eax,%ecx
movslq -0xc(%rbp),%rdx
lea    0x300c(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
add    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
movslq -0xc(%rbp),%rcx
lea    0x2ff4(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%edi
movslq -0xc(%rbp),%rcx
lea    0x2fe0(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
movslq -0xc(%rbp),%rcx
lea    0x2fcb(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0xc(%rax),%rcx
lea    0x2da9(%rip),%rax
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rdx
lea    0x2fa7(%rip),%rcx
shl    $0x4,%rdx
add    %rdx,%rcx
movslq 0x8(%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
call   1030 <my_mvaddstr@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <add_smoke+0x29>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x6df9(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2d57(%rip),%rax
shl    $0x7,%rcx
add    %rcx,%rax
mov    (%rax),%rdx
call   1030 <my_mvaddstr@plt>
mov    -0x4(%rbp),%ecx
movslq 0x6dce(%rip),%rdx
lea    0x2f47(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
movslq 0x6db4(%rip),%rdx
lea    0x2f2d(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
movslq 0x6d9c(%rip),%rcx
lea    0x2f15(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movl   $0x0,0x8(%rax)
mov    0x6d81(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq 0x6d72(%rip),%rcx
lea    0x2eeb(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    %edx,0xc(%rax)
mov    0x6d5b(%rip),%eax
add    $0x1,%eax
mov    %eax,0x6d52(%rip)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_smoke>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
test   $0x3,%bl
jne    1241 <add_smoke+0x131>
mov    %edi,%ebp
mov    0x6d92(%rip),%eax
test   %eax,%eax
jle    11df <add_smoke+0xcf>
mov    %ebp,(%rsp)
mov    %ebx,0x4(%rsp)
lea    0x2efc(%rip),%rbp
xor    %ebx,%ebx
lea    0xef3(%rip),%r12
lea    0xf2c(%rip),%r13
lea    0xf65(%rip),%r14
lea    0x2bbe(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp),%edi
mov    0x4(%rbp),%esi
movslq 0x8(%rbp),%rax
movslq (%r12,%rax,4),%rdx
add    %r12,%rdx
call   1030 <my_mvaddstr@plt>
movslq 0x8(%rbp),%rax
xor    %ecx,%ecx
cmp    $0xf,%rax
setl   %cl
mov    0x0(%rbp),%edi
sub    0x0(%r13,%rax,4),%edi
mov    0x4(%rbp),%esi
mov    %edi,0x0(%rbp)
add    (%r14,%rax,4),%esi
mov    %esi,0x4(%rbp)
add    %eax,%ecx
mov    %ecx,0x8(%rbp)
movslq 0xc(%rbp),%rax
movslq %ecx,%rcx
shl    $0x7,%rax
add    %r15,%rax
mov    (%rax,%rcx,8),%rdx
call   1030 <my_mvaddstr@plt>
add    $0x1,%rbx
movslq 0x6cf1(%rip),%rax
add    $0x10,%rbp
cmp    %rax,%rbx
jl     1170 <add_smoke+0x60>
mov    0x4(%rsp),%ebx
mov    (%rsp),%ebp
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cltq
shl    $0x7,%rax
lea    0x2b28(%rip),%rcx
mov    (%rax,%rcx,1),%rdx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <my_mvaddstr@plt>
movslq 0x6cb4(%rip),%rax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
mov    %eax,%edx
lea    0x1(%rax),%esi
shl    $0x4,%rax
lea    0x2e1d(%rip),%rdi
mov    %ebp,(%rax,%rdi,1)
mov    %ebx,0x4(%rax,%rdi,1)
movl   $0x0,0x8(%rax,%rdi,1)
and    $0xfffffffe,%ecx
sub    %ecx,%edx
mov    %edx,0xc(%rax,%rdi,1)
mov    %esi,0x6c7f(%rip)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.smokes = type { i32, i32, i32, i32 }
@add_smoke.S = internal global [1000 x %struct.smokes] zeroinitializer
@add_smoke.sum = internal global i32 0
@add_smoke.Smoke = internal global [2 x [16 x i8*]] [[16 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0)], [16 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0)]]
@.str = [6 x i8] c"( )\00"
@.str.1 = [7 x i8] c"( )\00"
@.str.2 = [5 x i8] c"( )\00"
@.str.3 = [4 x i8] c"( )\00"
@.str.4 = [3 x i8] c"()\00"
@.str.5 = [2 x i8] c"O\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [6 x i8] c"(@@@)\00"
@.str.8 = [7 x i8] c"(@@@@)\00"
@.str.9 = [5 x i8] c"(@@)\00"
@.str.10 = [4 x i8] c"(@)\00"
@.str.11 = [3 x i8] c"@@\00"
@.str.12 = [2 x i8] c"@\00"
@add_smoke.Eraser = internal global [16 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0)]
@.str.13 = [6 x i8] c" \00"
@.str.14 = [7 x i8] c" \00"
@.str.15 = [5 x i8] c" \00"
@.str.16 = [4 x i8] c" \00"
@.str.17 = [3 x i8] c" \00"
@add_smoke.dy = internal global <{ i32, i32, i32, i32, [12 x i32] }> <{ i32 2, i32 1, i32 1, i32 1, [12 x i32] zeroinitializer }>
@add_smoke.dx = internal global [16 x i32] [i32 -2, i32 -1, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3]
define i32 @add_smoke(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = srem i32 %6, 4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %137
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %102, %9
%11 = load i32, i32* %5
%12 = load i32, i32* @add_smoke.sum
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %105
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %16
%18 = getelementptr inbounds %struct.smokes, %struct.smokes* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %21
%23 = getelementptr inbounds %struct.smokes, %struct.smokes* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %26
%28 = getelementptr inbounds %struct.smokes, %struct.smokes* %27, i32 0, i32 2
%29 = load i32, i32* %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [16 x i8*], [16 x i8*]* @add_smoke.Eraser, i64 0, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @my_mvaddstr(i32 %19, i32 %24, i8* %32)
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %35
%37 = getelementptr inbounds %struct.smokes, %struct.smokes* %36, i32 0, i32 2
%38 = load i32, i32* %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [16 x i32], [16 x i32]* bitcast (<{ i32, i32, i32, i32, [12 x i32] }>* @add_smoke.dy to [16 x i32]*), i64 0, i64 %39
%41 = load i32, i32* %40
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %43
%45 = getelementptr inbounds %struct.smokes, %struct.smokes* %44, i32 0, i32 0
%46 = load i32, i32* %45
%47 = sub nsw i32 %46, %41
store i32 %47, i32* %45
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %49
%51 = getelementptr inbounds %struct.smokes, %struct.smokes* %50, i32 0, i32 2
%52 = load i32, i32* %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [16 x i32], [16 x i32]* @add_smoke.dx, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %57
%59 = getelementptr inbounds %struct.smokes, %struct.smokes* %58, i32 0, i32 1
%60 = load i32, i32* %59
%61 = add nsw i32 %60, %55
store i32 %61, i32* %59
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %63
%65 = getelementptr inbounds %struct.smokes, %struct.smokes* %64, i32 0, i32 2
%66 = load i32, i32* %65
%67 = icmp slt i32 %66, 15
%68 = zext i1 %67 to i64
%69 = select i1 %67, i32 1, i32 0
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %71
%73 = getelementptr inbounds %struct.smokes, %struct.smokes* %72, i32 0, i32 2
%74 = load i32, i32* %73
%75 = add nsw i32 %74, %69
store i32 %75, i32* %73
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %77
%79 = getelementptr inbounds %struct.smokes, %struct.smokes* %78, i32 0, i32 0
%80 = load i32, i32* %79
%81 = load i32, i32* %5
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %82
%84 = getelementptr inbounds %struct.smokes, %struct.smokes* %83, i32 0, i32 1
%85 = load i32, i32* %84
%86 = load i32, i32* %5
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %87
%89 = getelementptr inbounds %struct.smokes, %struct.smokes* %88, i32 0, i32 3
%90 = load i32, i32* %89
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %91
%93 = load i32, i32* %5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %94
%96 = getelementptr inbounds %struct.smokes, %struct.smokes* %95, i32 0, i32 2
%97 = load i32, i32* %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [16 x i8*], [16 x i8*]* %92, i64 0, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 @my_mvaddstr(i32 %80, i32 %85, i8* %100)
br label %102
102: ; preds = %14
%103 = load i32, i32* %5
%104 = add nsw i32 %103, 1
store i32 %104, i32* %5
br label %10
105: ; preds = %10
%106 = load i32, i32* %3
%107 = load i32, i32* %4
%108 = load i32, i32* @add_smoke.sum
%109 = srem i32 %108, 2
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %110
%112 = getelementptr inbounds [16 x i8*], [16 x i8*]* %111, i64 0, i64 0
%113 = load i8*, i8** %112
%114 = call i32 @my_mvaddstr(i32 %106, i32 %107, i8* %113)
%115 = load i32, i32* %3
%116 = load i32, i32* @add_smoke.sum
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %117
%119 = getelementptr inbounds %struct.smokes, %struct.smokes* %118, i32 0, i32 0
store i32 %115, i32* %119
%120 = load i32, i32* %4
%121 = load i32, i32* @add_smoke.sum
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %122
%124 = getelementptr inbounds %struct.smokes, %struct.smokes* %123, i32 0, i32 1
store i32 %120, i32* %124
%125 = load i32, i32* @add_smoke.sum
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %126
%128 = getelementptr inbounds %struct.smokes, %struct.smokes* %127, i32 0, i32 2
store i32 0, i32* %128
%129 = load i32, i32* @add_smoke.sum
%130 = srem i32 %129, 2
%131 = load i32, i32* @add_smoke.sum
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %132
%134 = getelementptr inbounds %struct.smokes, %struct.smokes* %133, i32 0, i32 3
store i32 %130, i32* %134
%135 = load i32, i32* @add_smoke.sum
%136 = add nsw i32 %135, 1
store i32 %136, i32* @add_smoke.sum
br label %137
137: ; preds = %105, %2
ret i32 0
}

LLVM IR (-O2):
%struct.smokes = type { i32, i32, i32, i32 }
@add_smoke.S = internal unnamed_addr global [1000 x %struct.smokes] zeroinitializer
@add_smoke.sum = internal unnamed_addr global i32 0
@add_smoke.Smoke = internal unnamed_addr constant [2 x [16 x i8*]] [[16 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0)], [16 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0)]]
@.str = [6 x i8] c"( )\00"
@.str.1 = [7 x i8] c"( )\00"
@.str.2 = [5 x i8] c"( )\00"
@.str.3 = [4 x i8] c"( )\00"
@.str.4 = [3 x i8] c"()\00"
@.str.5 = [2 x i8] c"O\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [6 x i8] c"(@@@)\00"
@.str.8 = [7 x i8] c"(@@@@)\00"
@.str.9 = [5 x i8] c"(@@)\00"
@.str.10 = [4 x i8] c"(@)\00"
@.str.11 = [3 x i8] c"@@\00"
@.str.12 = [2 x i8] c"@\00"
@reltable.add_smoke = internal unnamed_addr constant [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.15 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.15 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.16 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.16 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.17 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.17 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.add_smoke to i64)) to i32)]
@.str.13 = [6 x i8] c" \00"
@.str.14 = [7 x i8] c" \00"
@.str.15 = [5 x i8] c" \00"
@.str.16 = [4 x i8] c" \00"
@.str.17 = [3 x i8] c" \00"
@add_smoke.dy = internal unnamed_addr constant <{ i32, i32, i32, i32, [12 x i32] }> <{ i32 2, i32 1, i32 1, i32 1, [12 x i32] zeroinitializer }>
@add_smoke.dx = internal unnamed_addr constant [16 x i32] [i32 -2, i32 -1, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3]
define i32 @add_smoke(i32 %0, i32 %1) {
%3 = and i32 %1, 3
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %59
5: ; preds = %2
%6 = load i32, i32* @add_smoke.sum
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %44
8: ; preds = %5, %8
%9 = phi i64 [ %40, %8 ], [ 0, %5 ]
%10 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %9, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %9, i32 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %9, i32 2
%15 = load i32, i32* %14
%16 = sext i32 %15 to i64
%17 = shl i64 %16, 2
%18 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.add_smoke to i8*), i64 %17)
%19 = tail call i32 @my_mvaddstr(i32 %11, i32 %13, i8* %18)
%20 = load i32, i32* %14
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [16 x i32], [16 x i32]* bitcast (<{ i32, i32, i32, i32, [12 x i32] }>* @add_smoke.dy to [16 x i32]*), i64 0, i64 %21
%23 = load i32, i32* %22
%24 = load i32, i32* %10
%25 = sub nsw i32 %24, %23
store i32 %25, i32* %10
%26 = getelementptr inbounds [16 x i32], [16 x i32]* @add_smoke.dx, i64 0, i64 %21
%27 = load i32, i32* %26
%28 = load i32, i32* %12
%29 = add nsw i32 %28, %27
store i32 %29, i32* %12
%30 = icmp slt i32 %20, 15
%31 = zext i1 %30 to i32
%32 = add nsw i32 %20, %31
store i32 %32, i32* %14
%33 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %9, i32 3
%34 = load i32, i32* %33
%35 = sext i32 %34 to i64
%36 = sext i32 %32 to i64
%37 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %35, i64 %36
%38 = load i8*, i8** %37
%39 = tail call i32 @my_mvaddstr(i32 %25, i32 %29, i8* %38)
%40 = add nuw nsw i64 %9, 1
%41 = load i32, i32* @add_smoke.sum
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %40, %42
br i1 %43, label %8, label %44
44: ; preds = %8, %5
%45 = phi i32 [ %6, %5 ], [ %41, %8 ]
%46 = srem i32 %45, 2
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %47, i64 0
%49 = load i8*, i8** %48
%50 = tail call i32 @my_mvaddstr(i32 %0, i32 %1, i8* %49)
%51 = load i32, i32* @add_smoke.sum
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %52, i32 0
store i32 %0, i32* %53
%54 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %52, i32 1
store i32 %1, i32* %54
%55 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %52, i32 2
store i32 0, i32* %55
%56 = srem i32 %51, 2
%57 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %52, i32 3
store i32 %56, i32* %57
%58 = add nsw i32 %51, 1
store i32 %58, i32* @add_smoke.sum
br label %59
59: ; preds = %44, %2
ret i32 0
}