#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 COLS;
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 < -COLS) {
    return 0;
  }
  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,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    %ecx,%ecx
mov    0x2ebe(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
jge    1140 <add_smoke+0x30>
movl   $0x0,-0x4(%rbp)
jmp    1397 <add_smoke+0x287>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1390 <add_smoke+0x280>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    0x6f5c(%rip),%eax
jge    12dd <add_smoke+0x1cd>
movslq -0x10(%rbp),%rcx
lea    0x30cb(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%edi
movslq -0x10(%rbp),%rcx
lea    0x30b7(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
movslq -0x10(%rbp),%rcx
lea    0x30a2(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
lea    0x2f80(%rip),%rax
mov    (%rax,%rcx,8),%rdx
call   1030 <my_mvaddstr@plt>
movslq -0x10(%rbp),%rcx
lea    0x307c(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
lea    0x2fda(%rip),%rax
mov    (%rax,%rcx,4),%edx
movslq -0x10(%rbp),%rcx
lea    0x305c(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
movslq -0x10(%rbp),%rcx
lea    0x3044(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
lea    0x2fe2(%rip),%rax
mov    (%rax,%rcx,4),%ecx
movslq -0x10(%rbp),%rdx
lea    0x3024(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
add    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
movslq -0x10(%rbp),%rcx
lea    0x300c(%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    0x2fea(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
add    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
movslq -0x10(%rbp),%rcx
lea    0x2fd2(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%edi
movslq -0x10(%rbp),%rcx
lea    0x2fbe(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%esi
movslq -0x10(%rbp),%rcx
lea    0x2fa9(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq 0xc(%rax),%rcx
lea    0x2d87(%rip),%rax
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rdx
lea    0x2f85(%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    115b <add_smoke+0x4b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x6dd7(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2d35(%rip),%rax
shl    $0x7,%rcx
add    %rcx,%rax
mov    (%rax),%rdx
call   1030 <my_mvaddstr@plt>
mov    -0x8(%rbp),%ecx
movslq 0x6dac(%rip),%rdx
lea    0x2f25(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
movslq 0x6d92(%rip),%rdx
lea    0x2f0b(%rip),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
movslq 0x6d7a(%rip),%rcx
lea    0x2ef3(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movl   $0x0,0x8(%rax)
mov    0x6d5f(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq 0x6d50(%rip),%rcx
lea    0x2ec9(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    %edx,0xc(%rax)
mov    0x6d39(%rip),%eax
add    $0x1,%eax
mov    %eax,0x6d30(%rip)
movl   $0x0,-0x4(%rbp)
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    1251 <add_smoke+0x141>
mov    0x2eb3(%rip),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
cmp    %ebx,%ecx
jg     1251 <add_smoke+0x141>
mov    %edi,%ebp
mov    0x6d7f(%rip),%eax
test   %eax,%eax
jle    11ef <add_smoke+0xdf>
mov    %ebp,(%rsp)
mov    %ebx,0x4(%rsp)
lea    0x2ee9(%rip),%rbp
xor    %ebx,%ebx
lea    0xee0(%rip),%r12
lea    0xf19(%rip),%r13
lea    0xf52(%rip),%r14
lea    0x2b9b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
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 0x6ce1(%rip),%rax
add    $0x10,%rbp
cmp    %rax,%rbx
jl     1180 <add_smoke+0x70>
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    0x2b08(%rip),%rcx
mov    (%rax,%rcx,1),%rdx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <my_mvaddstr@plt>
movslq 0x6ca4(%rip),%rax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
mov    %eax,%edx
lea    0x1(%rax),%esi
shl    $0x4,%rax
lea    0x2e0d(%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,0x6c6f(%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]
@COLS = global i32 0
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 = load i32, i32* @COLS
%9 = sub nsw i32 0, %8
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %145
12: ; preds = %2
%13 = load i32, i32* %5
%14 = srem i32 %13, 4
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %144
16: ; preds = %12
store i32 0, i32* %6
br label %17
17: ; preds = %109, %16
%18 = load i32, i32* %6
%19 = load i32, i32* @add_smoke.sum
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %112
21: ; preds = %17
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %23
%25 = getelementptr inbounds %struct.smokes, %struct.smokes* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %28
%30 = getelementptr inbounds %struct.smokes, %struct.smokes* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %33
%35 = getelementptr inbounds %struct.smokes, %struct.smokes* %34, i32 0, i32 2
%36 = load i32, i32* %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [16 x i8*], [16 x i8*]* @add_smoke.Eraser, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @my_mvaddstr(i32 %26, i32 %31, i8* %39)
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %42
%44 = getelementptr inbounds %struct.smokes, %struct.smokes* %43, i32 0, i32 2
%45 = load i32, i32* %44
%46 = sext i32 %45 to i64
%47 = 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 %46
%48 = load i32, i32* %47
%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 0
%53 = load i32, i32* %52
%54 = sub nsw i32 %53, %48
store i32 %54, i32* %52
%55 = load i32, i32* %6
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %56
%58 = getelementptr inbounds %struct.smokes, %struct.smokes* %57, i32 0, i32 2
%59 = load i32, i32* %58
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [16 x i32], [16 x i32]* @add_smoke.dx, i64 0, i64 %60
%62 = load i32, i32* %61
%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 1
%67 = load i32, i32* %66
%68 = add nsw i32 %67, %62
store i32 %68, i32* %66
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %70
%72 = getelementptr inbounds %struct.smokes, %struct.smokes* %71, i32 0, i32 2
%73 = load i32, i32* %72
%74 = icmp slt i32 %73, 15
%75 = zext i1 %74 to i64
%76 = select i1 %74, i32 1, i32 0
%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 2
%81 = load i32, i32* %80
%82 = add nsw i32 %81, %76
store i32 %82, i32* %80
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %84
%86 = getelementptr inbounds %struct.smokes, %struct.smokes* %85, i32 0, i32 0
%87 = load i32, i32* %86
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %89
%91 = getelementptr inbounds %struct.smokes, %struct.smokes* %90, i32 0, i32 1
%92 = load i32, i32* %91
%93 = load i32, i32* %6
%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 3
%97 = load i32, i32* %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %98
%100 = load i32, i32* %6
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %101
%103 = getelementptr inbounds %struct.smokes, %struct.smokes* %102, i32 0, i32 2
%104 = load i32, i32* %103
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [16 x i8*], [16 x i8*]* %99, i64 0, i64 %105
%107 = load i8*, i8** %106
%108 = call i32 @my_mvaddstr(i32 %87, i32 %92, i8* %107)
br label %109
109: ; preds = %21
%110 = load i32, i32* %6
%111 = add nsw i32 %110, 1
store i32 %111, i32* %6
br label %17
112: ; preds = %17
%113 = load i32, i32* %4
%114 = load i32, i32* %5
%115 = load i32, i32* @add_smoke.sum
%116 = srem i32 %115, 2
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [2 x [16 x i8*]], [2 x [16 x i8*]]* @add_smoke.Smoke, i64 0, i64 %117
%119 = getelementptr inbounds [16 x i8*], [16 x i8*]* %118, i64 0, i64 0
%120 = load i8*, i8** %119
%121 = call i32 @my_mvaddstr(i32 %113, i32 %114, i8* %120)
%122 = load i32, i32* %4
%123 = load i32, i32* @add_smoke.sum
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %124
%126 = getelementptr inbounds %struct.smokes, %struct.smokes* %125, i32 0, i32 0
store i32 %122, i32* %126
%127 = load i32, i32* %5
%128 = load i32, i32* @add_smoke.sum
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %129
%131 = getelementptr inbounds %struct.smokes, %struct.smokes* %130, i32 0, i32 1
store i32 %127, i32* %131
%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 2
store i32 0, i32* %135
%136 = load i32, i32* @add_smoke.sum
%137 = srem i32 %136, 2
%138 = load i32, i32* @add_smoke.sum
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [1000 x %struct.smokes], [1000 x %struct.smokes]* @add_smoke.S, i64 0, i64 %139
%141 = getelementptr inbounds %struct.smokes, %struct.smokes* %140, i32 0, i32 3
store i32 %137, i32* %141
%142 = load i32, i32* @add_smoke.sum
%143 = add nsw i32 %142, 1
store i32 %143, i32* @add_smoke.sum
br label %144
144: ; preds = %112, %12
store i32 0, i32* %3
br label %145
145: ; preds = %144, %11
%146 = load i32, i32* %3
ret i32 %146
}

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