#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*/ draw_diamond_part(char *, char *, int, int);
void draw(int r, int c, int s) {
  char backslash[s][s];
  char slash[s][s];
  for (int i = 0; i < s; ++i) {
    for (int j = 0; j < s; ++j) {
      backslash[i][j] = '.';
      slash[i][j] = '.';
    }
    backslash[i][i] = '\\';
    slash[i][s - i - 1] = '/';
  }
  for (int i = 0; i < r; ++i) {
    draw_diamond_part(*slash, *backslash, s, c);
    draw_diamond_part(*backslash, *slash, s, c);
  }
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x68(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
imul   %rdx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    %rcx,%rsi
imul   %rsi,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x50(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1239 <draw+0x129>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ed <draw+0xdd>
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%rdi
movslq -0x3c(%rbp),%rsi
imul   %rdi,%rsi
add    %rsi,%rcx
movslq -0x40(%rbp),%rsi
movb   $0x2e,(%rcx,%rsi,1)
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    119d <draw+0x8d>
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%rdi
movslq -0x3c(%rbp),%rsi
imul   %rdi,%rsi
add    %rsi,%rcx
movslq -0x3c(%rbp),%rsi
movb   $0x5c,(%rcx,%rsi,1)
movslq -0x3c(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
mov    -0xc(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118a <draw+0x7a>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1280 <draw+0x170>
mov    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1030 <draw_diamond_part@plt>
mov    -0x60(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1030 <draw_diamond_part@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1240 <draw+0x130>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
mov    %edx,%ecx
mov    %rcx,%rax
imul   %rcx,%rax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
test   %edx,%edx
jle    1314 <draw+0x1f4>
mov    %ebx,-0x5c(%rbp)
mov    %r15d,-0x60(%rbp)
cmp    $0x1,%r14d
mov    %r14,-0x70(%rbp)
mov    %r12,-0x58(%rbp)
mov    %r13,-0x68(%rbp)
mov    %rcx,-0x40(%rbp)
jne    1188 <draw+0x68>
xor    %edx,%edx
jmp    12a5 <draw+0x185>
mov    %ecx,%eax
and    $0xfffffffe,%eax
mov    %rax,-0x88(%rbp)
lea    (%r12,%rcx,1),%rax
mov    %rax,-0x30(%rbp)
lea    (%rcx,%rcx,1),%rax
mov    %rax,-0x80(%rbp)
lea    0x2(%rcx,%rcx,1),%rax
mov    %rax,-0x78(%rbp)
lea    0x0(%r13,%rcx,1),%rax
mov    %rax,-0x38(%rbp)
lea    -0x2(%r14),%r12d
lea    -0x1(%r14),%r13d
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %edx,%edx
mov    -0x40(%rbp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rdx,-0x50(%rbp)
movslq %r12d,%r12
mov    -0x38(%rbp),%rax
add    %r12,%rax
mov    %rax,-0x98(%rbp)
movslq %r13d,%r13
mov    -0x68(%rbp),%rax
lea    (%rax,%r13,1),%rcx
mov    %rcx,-0x48(%rbp)
add    %r14,%rax
mov    %rax,-0x90(%rbp)
mov    -0x58(%rbp),%rax
lea    (%rax,%r14,1),%rdi
mov    $0x2e,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    -0x90(%rbp),%rdi
mov    $0x2e,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    -0x58(%rbp),%rax
movb   $0x5c,(%rax,%r15,1)
mov    -0x48(%rbp),%rax
movb   $0x2f,(%r14,%rax,1)
mov    -0x38(%rbp),%rax
add    %r14,%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
lea    (%rax,%r14,1),%rdi
mov    $0x2e,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    -0x48(%rbp),%rdi
mov    $0x2e,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    -0x50(%rbp),%rdx
mov    -0x30(%rbp),%rax
movb   $0x5c,0x1(%rax,%r15,1)
mov    -0x98(%rbp),%rax
movb   $0x2f,(%r14,%rax,1)
add    $0x2,%rdx
add    -0x78(%rbp),%r15
add    -0x80(%rbp),%r14
add    $0xfffffffe,%r12d
add    $0xfffffffe,%r13d
cmp    %rdx,-0x88(%rbp)
jne    11d0 <draw+0xb0>
mov    -0x40(%rbp),%rax
test   $0x1,%al
mov    -0x70(%rbp),%r14
mov    -0x60(%rbp),%r15d
mov    -0x58(%rbp),%r12
mov    -0x68(%rbp),%r13
mov    -0x5c(%rbp),%ebx
je     1314 <draw+0x1f4>
mov    %rdx,%rdi
imul   %rax,%rdi
lea    (%rdi,%r13,1),%rcx
mov    %rcx,-0x30(%rbp)
add    %r12,%rdi
mov    %rdi,-0x38(%rbp)
mov    $0x2e,%esi
mov    %rdx,-0x50(%rbp)
mov    %rax,%rdx
call   1030 <memset@plt>
mov    -0x30(%rbp),%rdi
mov    $0x2e,%esi
mov    -0x40(%rbp),%rdx
call   1030 <memset@plt>
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
not    %eax
add    %r14d,%eax
cltq
mov    -0x30(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
test   %ebx,%ebx
jle    1347 <draw+0x227>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1040 <draw_diamond_part@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1040 <draw_diamond_part@plt>
add    $0xffffffff,%ebx
jne    1320 <draw+0x200>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @draw(i32 %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = mul nuw i64 %4, %4
%6 = alloca i8, i64 %5
%7 = alloca i8, i64 %5
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %27
9: ; preds = %3
%10 = and i64 %4, 1
%11 = icmp eq i32 %2, 1
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = and i64 %4, 4294967294
br label %29
14: ; preds = %29, %9
%15 = phi i64 [ 0, %9 ], [ %51, %29 ]
%16 = icmp eq i64 %10, 0
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = mul nuw nsw i64 %15, %4
%19 = getelementptr i8, i8* %7, i64 %18
%20 = getelementptr i8, i8* %6, i64 %18
%21 = getelementptr inbounds i8, i8* %20, i64 %15
store i8 92, i8* %21
%22 = trunc i64 %15 to i32
%23 = xor i32 %22, -1
%24 = add i32 %23, %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %19, i64 %25
store i8 47, i8* %26
br label %27
27: ; preds = %17, %14, %3
%28 = icmp sgt i32 %0, 0
br i1 %28, label %55, label %54
29: ; preds = %29, %12
%30 = phi i64 [ 0, %12 ], [ %51, %29 ]
%31 = phi i64 [ 0, %12 ], [ %52, %29 ]
%32 = mul nuw nsw i64 %30, %4
%33 = getelementptr i8, i8* %7, i64 %32
%34 = getelementptr i8, i8* %6, i64 %32
%35 = getelementptr inbounds i8, i8* %34, i64 %30
store i8 92, i8* %35
%36 = trunc i64 %30 to i32
%37 = xor i32 %36, -1
%38 = add i32 %37, %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %33, i64 %39
store i8 47, i8* %40
%41 = or i64 %30, 1
%42 = mul nuw nsw i64 %41, %4
%43 = getelementptr i8, i8* %7, i64 %42
%44 = getelementptr i8, i8* %6, i64 %42
%45 = getelementptr inbounds i8, i8* %44, i64 %41
store i8 92, i8* %45
%46 = trunc i64 %41 to i32
%47 = xor i32 %46, -1
%48 = add i32 %47, %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %43, i64 %49
store i8 47, i8* %50
%51 = add nuw nsw i64 %30, 2
%52 = add i64 %31, 2
%53 = icmp eq i64 %52, %13
br i1 %53, label %14, label %29
54: ; preds = %55, %27
ret void
55: ; preds = %27, %55
%56 = phi i32 [ %59, %55 ], [ 0, %27 ]
%57 = call i32 @draw_diamond_part(i8* %7, i8* %6, i32 %2, i32 %1)
%58 = call i32 @draw_diamond_part(i8* %6, i8* %7, i32 %2, i32 %1)
%59 = add nuw nsw i32 %56, 1
%60 = icmp eq i32 %59, %0
br i1 %60, label %54, label %55
}