#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*/ print_cell(int);
int /*<<< orphan*/ printf(char *);
void print_world(int **world, int width, int height) {
  int x, y;
  for (x = 1; x < width - 1; x++) {
    printf("==");
  }
  printf("===\n");
  for (y = 1; y < height - 1; y++) {
    printf("=");
    for (x = 1; x < width - 1; x++) {
      printf(" ");
      print_cell(world[x][y]);
    }
    printf(" ");
    printf("=\n=");
    if (y != height - 1 - 1) {
      for (x = 1; x < width - 1; x++) {
        printf("  ");
      }
      printf(" ");
      printf("=\n");
    }
  }
  for (x = 1; x < width - 1; x++) {
    printf("==");
  }
  printf("==\n");
}


x86 assembly (clang, -O0):
<print_world>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1164 <print_world+0x44>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_world+0x19>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1267 <print_world+0x147>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11de <print_world+0xbe>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <print_cell@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119b <print_world+0x7b>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1254 <print_world+0x134>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    123c <print_world+0x11c>
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1211 <print_world+0xf1>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
lea    0xdb6(%rip),%rdi
call   1030 <printf@plt>
jmp    1259 <print_world+0x139>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1177 <print_world+0x57>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1299 <print_world+0x179>
lea    0xd7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    126e <print_world+0x14e>
lea    0xd64(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_world>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%rbx
cmp    $0x3,%esi
jl     117d <print_world+0x3d>
lea    -0x2(%r15),%ebp
lea    0xea1(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <print_world+0x30>
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x3,%r12d
jl     1272 <print_world+0x132>
lea    -0x1(%r15),%eax
lea    -0x1(%r12),%ecx
mov    %rcx,0x8(%rsp)
add    $0xfffffffe,%r12d
mov    %r12,0x10(%rsp)
mov    %eax,%r12d
lea    -0x2(%r15),%eax
mov    %eax,0x4(%rsp)
mov    $0x1,%r14d
lea    0xe42(%rip),%r13
jmp    11f5 <print_world+0xb5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe21(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r14
cmp    0x8(%rsp),%r14
je     1272 <print_world+0x132>
mov    $0x3d,%edi
call   1030 <putchar@plt>
cmp    $0x3,%r15d
jl     1230 <print_world+0xf0>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    (%rbx,%rbp,8),%rax
mov    (%rax,%r14,4),%edi
call   1060 <print_cell@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1210 <print_world+0xd0>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xdbf(%rip),%rdi
call   1050 <printf@plt>
cmp    0x10(%rsp),%r14
je     11e6 <print_world+0xa6>
cmp    $0x3,%r15d
jl     11d0 <print_world+0x90>
mov    0x4(%rsp),%ebp
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1260 <print_world+0x120>
jmp    11d0 <print_world+0x90>
cmp    $0x3,%r15d
jl     129e <print_world+0x15e>
add    $0xfffffffe,%r15d
lea    0xd85(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%r15d
jne    1290 <print_world+0x150>
lea    0xd63(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"==\00"
@.str.1 = [5 x i8] c"===\0A\00"
@.str.2 = [2 x i8] c"=\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [4 x i8] c"=\0A=\00"
@.str.5 = [3 x i8] c" \00"
@.str.6 = [3 x i8] c"=\0A\00"
@.str.7 = [4 x i8] c"==\0A\00"
define void @print_world(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 1, i32* %7
br label %9
9: ; preds = %16, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
br label %9
19: ; preds = %9
%20 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %8
br label %21
21: ; preds = %71, %19
%22 = load i32, i32* %8
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %74
26: ; preds = %21
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %7
br label %28
28: ; preds = %45, %26
%29 = load i32, i32* %7
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %48
33: ; preds = %28
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32**, i32*** %4
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32*, i32** %35, i64 %37
%39 = load i32*, i32** %38
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
%44 = call i32 @print_cell(i32 %43)
br label %45
45: ; preds = %33
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %28
48: ; preds = %28
%49 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* %8
%52 = load i32, i32* %6
%53 = sub nsw i32 %52, 1
%54 = sub nsw i32 %53, 1
%55 = icmp ne i32 %51, %54
br i1 %55, label %56, label %70
56: ; preds = %48
store i32 1, i32* %7
br label %57
57: ; preds = %64, %56
%58 = load i32, i32* %7
%59 = load i32, i32* %5
%60 = sub nsw i32 %59, 1
%61 = icmp slt i32 %58, %60
br i1 %61, label %62, label %67
62: ; preds = %57
%63 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %64
64: ; preds = %62
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
store i32 %66, i32* %7
br label %57
67: ; preds = %57
%68 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %70
70: ; preds = %67, %48
br label %71
71: ; preds = %70
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 1
store i32 %73, i32* %8
br label %21
74: ; preds = %21
store i32 1, i32* %7
br label %75
75: ; preds = %82, %74
%76 = load i32, i32* %7
%77 = load i32, i32* %5
%78 = sub nsw i32 %77, 1
%79 = icmp slt i32 %76, %78
br i1 %79, label %80, label %85
80: ; preds = %75
%81 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %82
82: ; preds = %80
%83 = load i32, i32* %7
%84 = add nsw i32 %83, 1
store i32 %84, i32* %7
br label %75
85: ; preds = %75
%86 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.4 = [4 x i8] c"=\0A=\00"
@.str.5 = [3 x i8] c" \00"
@str = [4 x i8] c"===\00"
@str.8 = [3 x i8] c"==\00"
@str.9 = [2 x i8] c"=\00"
define void @print_world(i32** nocapture %0, i32 %1, i32 %2) {
%4 = add i32 %1, -1
%5 = icmp sgt i32 %1, 2
br i1 %5, label %6, label %11
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 1, %3 ]
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %4
br i1 %10, label %11, label %6
11: ; preds = %6, %3
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%13 = icmp sgt i32 %2, 2
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = add nsw i32 %2, -1
%16 = add nsw i32 %2, -2
%17 = zext i32 %16 to i64
%18 = zext i32 %15 to i64
%19 = zext i32 %4 to i64
br label %21
20: ; preds = %47, %11
br i1 %5, label %50, label %55
21: ; preds = %14, %47
%22 = phi i64 [ 1, %14 ], [ %48, %47 ]
%23 = tail call i32 @putchar(i32 61)
br i1 %5, label %24, label %34
24: ; preds = %21, %24
%25 = phi i64 [ %32, %24 ], [ 1, %21 ]
%26 = tail call i32 @putchar(i32 32)
%27 = getelementptr inbounds i32*, i32** %0, i64 %25
%28 = load i32*, i32** %27
%29 = getelementptr inbounds i32, i32* %28, i64 %22
%30 = load i32, i32* %29
%31 = tail call i32 @print_cell(i32 %30)
%32 = add nuw nsw i64 %25, 1
%33 = icmp eq i64 %32, %19
br i1 %33, label %34, label %24
34: ; preds = %24, %21
%35 = tail call i32 @putchar(i32 32)
%36 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %22, %17
br i1 %37, label %47, label %38
38: ; preds = %34
br i1 %5, label %39, label %44
39: ; preds = %38, %39
%40 = phi i32 [ %42, %39 ], [ 1, %38 ]
%41 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%42 = add nuw nsw i32 %40, 1
%43 = icmp eq i32 %42, %4
br i1 %43, label %44, label %39
44: ; preds = %39, %38
%45 = tail call i32 @putchar(i32 32)
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %47
47: ; preds = %34, %44
%48 = add nuw nsw i64 %22, 1
%49 = icmp eq i64 %48, %18
br i1 %49, label %20, label %21
50: ; preds = %20, %50
%51 = phi i32 [ %53, %50 ], [ 1, %20 ]
%52 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
%53 = add nuw nsw i32 %51, 1
%54 = icmp eq i32 %53, %4
br i1 %54, label %55, label %50
55: ; preds = %50, %20
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
ret void
}