#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++;
  }
}


x86 assembly (clang, -O0):
<add_smoke>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    136e <add_smoke+0x25e>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    0x6f7e(%rip),%eax
jge    12bb <add_smoke+0x1ab>
movslq -0x10(%rbp),%rcx
lea    0x30ed(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%edi
movslq -0x10(%rbp),%rcx
lea    0x30d9(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
movslq -0x10(%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 -0x10(%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 -0x10(%rbp),%rcx
lea    0x307e(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
movslq -0x10(%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 -0x10(%rbp),%rdx
lea    0x3046(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
add    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
movslq -0x10(%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 -0x10(%rbp),%rdx
lea    0x300c(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
add    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
movslq -0x10(%rbp),%rcx
lea    0x2ff4(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%edi
movslq -0x10(%rbp),%rcx
lea    0x2fe0(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
movslq -0x10(%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 -0x10(%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    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <add_smoke+0x29>
mov    -0x8(%rbp),%edi
mov    -0xc(%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    -0x8(%rbp),%ecx
movslq 0x6dce(%rip),%rdx
lea    0x2f47(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0xc(%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)
mov    -0x4(%rbp),%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)
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
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = srem i32 %7, 4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %138
10: ; preds = %2
store i32 0, i32* %6
br label %11
11: ; preds = %103, %10
%12 = load i32, i32* %6
%13 = load i32, i32* @add_smoke.sum
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %106
15: ; preds = %11
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %17
%19 = getelementptr inbounds %struct.smokes, %struct.smokes* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %22
%24 = getelementptr inbounds %struct.smokes, %struct.smokes* %23, i32 0, i32 1
%25 = load i32, i32* %24
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %27
%29 = getelementptr inbounds %struct.smokes, %struct.smokes* %28, i32 0, i32 2
%30 = load i32, i32* %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [16 x i8*], [16 x i8*]* @add_smoke.Eraser, i64 0, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @my_mvaddstr(i32 %20, i32 %25, i8* %33)
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %36
%38 = getelementptr inbounds %struct.smokes, %struct.smokes* %37, i32 0, i32 2
%39 = load i32, i32* %38
%40 = sext i32 %39 to i64
%41 = 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 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %44
%46 = getelementptr inbounds %struct.smokes, %struct.smokes* %45, i32 0, i32 0
%47 = load i32, i32* %46
%48 = sub nsw i32 %47, %42
store i32 %48, i32* %46
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %50
%52 = getelementptr inbounds %struct.smokes, %struct.smokes* %51, i32 0, i32 2
%53 = load i32, i32* %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [16 x i32], [16 x i32]* @add_smoke.dx, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = load i32, i32* %6
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %58
%60 = getelementptr inbounds %struct.smokes, %struct.smokes* %59, i32 0, i32 1
%61 = load i32, i32* %60
%62 = add nsw i32 %61, %56
store i32 %62, i32* %60
%63 = load i32, i32* %6
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %64
%66 = getelementptr inbounds %struct.smokes, %struct.smokes* %65, i32 0, i32 2
%67 = load i32, i32* %66
%68 = icmp slt i32 %67, 15
%69 = zext i1 %68 to i64
%70 = select i1 %68, i32 1, i32 0
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %72
%74 = getelementptr inbounds %struct.smokes, %struct.smokes* %73, i32 0, i32 2
%75 = load i32, i32* %74
%76 = add nsw i32 %75, %70
store i32 %76, i32* %74
%77 = load i32, i32* %6
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %78
%80 = getelementptr inbounds %struct.smokes, %struct.smokes* %79, i32 0, i32 0
%81 = load i32, i32* %80
%82 = load i32, i32* %6
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %83
%85 = getelementptr inbounds %struct.smokes, %struct.smokes* %84, i32 0, i32 1
%86 = load i32, i32* %85
%87 = load i32, i32* %6
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %88
%90 = getelementptr inbounds %struct.smokes, %struct.smokes* %89, i32 0, i32 3
%91 = load i32, i32* %90
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %92
%94 = load i32, i32* %6
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %95
%97 = getelementptr inbounds %struct.smokes, %struct.smokes* %96, i32 0, i32 2
%98 = load i32, i32* %97
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [16 x i8*], [16 x i8*]* %93, i64 0, i64 %99
%101 = load i8*, i8** %100
%102 = call i32 @my_mvaddstr(i32 %81, i32 %86, i8* %101)
br label %103
103: ; preds = %15
%104 = load i32, i32* %6
%105 = add nsw i32 %104, 1
store i32 %105, i32* %6
br label %11
106: ; preds = %11
%107 = load i32, i32* %4
%108 = load i32, i32* %5
%109 = load i32, i32* @add_smoke.sum
%110 = srem i32 %109, 2
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %111
%113 = getelementptr inbounds [16 x i8*], [16 x i8*]* %112, i64 0, i64 0
%114 = load i8*, i8** %113
%115 = call i32 @my_mvaddstr(i32 %107, i32 %108, i8* %114)
%116 = load i32, i32* %4
%117 = load i32, i32* @add_smoke.sum
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %118
%120 = getelementptr inbounds %struct.smokes, %struct.smokes* %119, i32 0, i32 0
store i32 %116, i32* %120
%121 = load i32, i32* %5
%122 = load i32, i32* @add_smoke.sum
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %123
%125 = getelementptr inbounds %struct.smokes, %struct.smokes* %124, i32 0, i32 1
store i32 %121, i32* %125
%126 = load i32, i32* @add_smoke.sum
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %127
%129 = getelementptr inbounds %struct.smokes, %struct.smokes* %128, i32 0, i32 2
store i32 0, i32* %129
%130 = load i32, i32* @add_smoke.sum
%131 = srem i32 %130, 2
%132 = load i32, i32* @add_smoke.sum
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %133
%135 = getelementptr inbounds %struct.smokes, %struct.smokes* %134, i32 0, i32 3
store i32 %131, i32* %135
%136 = load i32, i32* @add_smoke.sum
%137 = add nsw i32 %136, 1
store i32 %137, i32* @add_smoke.sum
br label %138
138: ; preds = %106, %2
%139 = load i32, i32* %3
ret i32 %139
}

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