#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 *, ...);
void draw_diamond_part(char *array1, char *array2, int s, int c) {
  for (int m = 0; m < s; ++m) {
    for (int j = 0; j < c; ++j) {
      for (int n = 0; n < s; ++n) {
        printf("%c", *(array1 + m * s + n));
      }
      for (int n = 0; n < s; ++n) {
        printf("%c", *(array2 + m * s + n));
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<draw_diamond_part>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120b <draw_diamond_part+0xfb>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ef <draw_diamond_part+0xdf>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1194 <draw_diamond_part+0x84>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1153 <draw_diamond_part+0x43>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11dc <draw_diamond_part+0xcc>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119b <draw_diamond_part+0x8b>
jmp    11e1 <draw_diamond_part+0xd1>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1140 <draw_diamond_part+0x30>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <draw_diamond_part+0x1d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_diamond_part>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
test   %edx,%edx
jle    11c0 <draw_diamond_part+0xb0>
mov    %rsi,%r15
mov    %rdi,%r14
mov    %edx,%ebx
xor    %eax,%eax
jmp    115e <draw_diamond_part+0x4e>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%rax
add    $0x1,%rax
add    %rbx,%r14
add    %rbx,%r15
cmp    %rbx,%rax
je     11c0 <draw_diamond_part+0xb0>
mov    %rax,0x10(%rsp)
cmpl   $0x0,0xc(%rsp)
jle    1140 <draw_diamond_part+0x30>
xor    %r13d,%r13d
nopl   (%rax)
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r14,%r12,1),%edi
call   1030 <putchar@plt>
add    $0x1,%r12
cmp    %r12,%rbx
jne    1180 <draw_diamond_part+0x70>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%r15,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11a0 <draw_diamond_part+0x90>
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
jne    1170 <draw_diamond_part+0x60>
jmp    1140 <draw_diamond_part+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @draw_diamond_part(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %16
6: ; preds = %4
%7 = icmp sgt i32 %3, 0
%8 = zext i32 %2 to i64
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %6, %19
%11 = phi i64 [ 0, %6 ], [ %21, %19 ]
br i1 %7, label %12, label %19
12: ; preds = %10
%13 = mul nsw i64 %11, %8
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = getelementptr inbounds i8, i8* %1, i64 %13
br label %17
16: ; preds = %19, %4
ret void
17: ; preds = %31, %12
%18 = phi i32 [ 0, %12 ], [ %32, %31 ]
br label %23
19: ; preds = %31, %10
%20 = tail call i32 @putchar(i32 10)
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %16, label %10
23: ; preds = %17, %23
%24 = phi i64 [ 0, %17 ], [ %29, %23 ]
%25 = getelementptr inbounds i8, i8* %14, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i32 @putchar(i32 %27)
%29 = add nuw nsw i64 %24, 1
%30 = icmp eq i64 %29, %9
br i1 %30, label %34, label %23
31: ; preds = %34
%32 = add nuw nsw i32 %18, 1
%33 = icmp eq i32 %32, %3
br i1 %33, label %19, label %17
34: ; preds = %23, %34
%35 = phi i64 [ %40, %34 ], [ 0, %23 ]
%36 = getelementptr inbounds i8, i8* %15, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = tail call i32 @putchar(i32 %38)
%40 = add nuw nsw i64 %35, 1
%41 = icmp eq i64 %40, %9
br i1 %41, label %31, label %34
}