#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*/ printf(char *, ...);
int strlen(char *);
void debug_print_W2(int *W, int m_r, int w_len, char *a, char *b) {
  int r, w, n_c, c;
  n_c = strlen(a) + 1;
  printf("  ");
  for (c = 0; c < (w_len / 2); c++) {
    printf("   ");
  }
  for (c = 0; c < n_c; c++) {
    if (c == 0) {
      printf("  -");
    } else {
      printf("  %c", a[c - 1]);
    }
  }
  printf("\n");
  for (r = 0; r < m_r; r++) {
    if (r == 0) {
      printf(" -");
    } else {
      printf(" %c", b[r - 1]);
    }
    for (c = 0; c < r; c++) {
      printf("   ");
    }
    for (w = 0; w < w_len; w++) {
      printf(" %2d", W[r * w_len + w]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<debug_print_W2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    1198 <debug_print_W2+0x78>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115e <debug_print_W2+0x3e>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11fa <debug_print_W2+0xda>
cmpl   $0x0,-0x30(%rbp)
jne    11c8 <debug_print_W2+0xa8>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e7 <debug_print_W2+0xc7>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ec <debug_print_W2+0xcc>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    119f <debug_print_W2+0x7f>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12e5 <debug_print_W2+0x1c5>
cmpl   $0x0,-0x24(%rbp)
jne    1238 <debug_print_W2+0x118>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1257 <debug_print_W2+0x137>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1286 <debug_print_W2+0x166>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    125e <debug_print_W2+0x13e>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12c9 <debug_print_W2+0x1a9>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    128d <debug_print_W2+0x16d>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    120f <debug_print_W2+0xef>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_print_W2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x8(%rsp)
mov    %rcx,%r13
mov    %edx,%ebp
mov    %esi,%r12d
mov    %rdi,%rbx
mov    %rcx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,0x4(%rsp)
cmp    $0x2,%ebp
jl     119f <debug_print_W2+0x6f>
mov    0x4(%rsp),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
lea    0xe7c(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1190 <debug_print_W2+0x60>
test   %r14d,%r14d
js     11e9 <debug_print_W2+0xb9>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
je     11e9 <debug_print_W2+0xb9>
add    $0x1,%r14d
add    $0xffffffffffffffff,%r14
lea    0xe42(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl 0x0(%r13,%rbp,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11d0 <debug_print_W2+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
jle    12dc <debug_print_W2+0x1ac>
mov    0x4(%rsp),%eax
movslq %eax,%rcx
mov    %r12d,%edx
mov    %rdx,0x10(%rsp)
mov    %eax,%r12d
shl    $0x2,%rcx
mov    %rcx,0x18(%rsp)
lea    0xdef(%rip),%r13
lea    0xddb(%rip),%r15
xor    %ebp,%ebp
jmp    1253 <debug_print_W2+0x123>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x20(%rsp),%rbp
add    $0x1,%rbp
add    0x18(%rsp),%rbx
cmp    0x10(%rsp),%rbp
je     12dc <debug_print_W2+0x1ac>
test   %rbp,%rbp
mov    %rbp,0x20(%rsp)
je     12a0 <debug_print_W2+0x170>
mov    0x8(%rsp),%rax
movsbl -0x1(%rbp,%rax,1),%esi
lea    0xd9b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbp
jne    1280 <debug_print_W2+0x150>
cmpl   $0x0,0x4(%rsp)
jg     12b9 <debug_print_W2+0x189>
jmp    1230 <debug_print_W2+0x100>
nopl   0x0(%rax)
lea    0xd5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1230 <debug_print_W2+0x100>
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    (%rbx,%r14,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r12
jne    12c0 <debug_print_W2+0x190>
jmp    1230 <debug_print_W2+0x100>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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