#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 /*<<< orphan*/ puts(char *);
void printFlag(int width) {
  int height = 3 * width / 20;
  char *colors[] = {"\x1B[30m", "\x1B[31m", "\x1B[33m"};
  for (int c = 0; c < 3; c++) {
    for (int y = 0; y < height; y++) {
      for (int x = 0; x < width; x++) {
        printf("%s#", colors[c]);
      }
      printf("\n");
    }
  }
  puts("\x1B[0m");
}


x86 assembly (clang, -O0):
<printFlag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3,-0x4(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    0x2cbf(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cbc(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cb9(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    11e6 <printFlag+0xc6>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d3 <printFlag+0xb3>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b7 <printFlag+0x97>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1186 <printFlag+0x66>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1173 <printFlag+0x53>
jmp    11d8 <printFlag+0xb8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1162 <printFlag+0x42>
lea    0xe2b(%rip),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFlag>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
lea    (%r14,%r14,2),%eax
cmp    $0x14,%eax
jl     1264 <printFlag+0x134>
mov    %eax,0x4(%rsp)
cltq
imul   $0x66666667,%rax,%r12
mov    %r12,%rax
shr    $0x3f,%rax
sar    $0x23,%r12
add    %eax,%r12d
lea    0xea5(%rip),%r15
lea    0xe8c(%rip),%rbx
xor    %ebp,%ebp
jmp    1192 <printFlag+0x62>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r12d,%ebp
je     11b5 <printFlag+0x85>
mov    %r14d,%r13d
test   %r14d,%r14d
jle    1180 <printFlag+0x50>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%r13d
jne    11a0 <printFlag+0x70>
jmp    1180 <printFlag+0x50>
cmpl   $0x14,0x4(%rsp)
jl     1264 <printFlag+0x134>
lea    0xe4b(%rip),%r15
lea    0xe38(%rip),%rbx
xor    %r13d,%r13d
jmp    11f3 <printFlag+0xc3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    %r12d,%r13d
je     1214 <printFlag+0xe4>
test   %r14d,%r14d
jle    11e0 <printFlag+0xb0>
mov    %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1200 <printFlag+0xd0>
jmp    11e0 <printFlag+0xb0>
cmpl   $0x14,0x4(%rsp)
jl     1264 <printFlag+0x134>
lea    0xdf0(%rip),%r15
lea    0xde3(%rip),%rbx
xor    %r13d,%r13d
jmp    1243 <printFlag+0x113>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    %r12d,%r13d
je     1264 <printFlag+0x134>
test   %r14d,%r14d
jle    1230 <printFlag+0x100>
mov    %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1250 <printFlag+0x120>
jmp    1230 <printFlag+0x100>
lea    0xdab(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[30m\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [6 x i8] c"\1B[33m\00"
@__const.printFlag.colors = [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [4 x i8] c"%s#\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [5 x i8] c"\1B[0m\00"
define void @printFlag(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i8*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 3, %8
%10 = sdiv i32 %9, 20
store i32 %10, i32* %3
%11 = bitcast [3 x i8*]* %4 to i8*
store i32 0, i32* %5
br label %12
12: ; preds = %40, %1
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %43
15: ; preds = %12
store i32 0, i32* %6
br label %16
16: ; preds = %36, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %39
20: ; preds = %16
store i32 0, i32* %7
br label %21
21: ; preds = %31, %20
%22 = load i32, i32* %7
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %21
34: ; preds = %21
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %16
39: ; preds = %16
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %12
43: ; preds = %12
%44 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[30m\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [6 x i8] c"\1B[33m\00"
@.str.3 = [4 x i8] c"%s#\00"
@.str.5 = [5 x i8] c"\1B[0m\00"
define void @printFlag(i32 %0) {
%2 = mul nsw i32 %0, 3
%3 = sdiv i32 %2, 20
%4 = icmp sgt i32 %2, 19
%5 = icmp sgt i32 %0, 0
br i1 %4, label %6, label %32
6: ; preds = %1, %34
%7 = phi i32 [ %36, %34 ], [ 0, %1 ]
br i1 %5, label %38, label %34
8: ; preds = %34
br i1 %4, label %9, label %32
9: ; preds = %8, %16
%10 = phi i32 [ %18, %16 ], [ 0, %8 ]
br i1 %5, label %11, label %16
11: ; preds = %9, %11
%12 = phi i32 [ %14, %11 ], [ 0, %9 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %16, label %11
16: ; preds = %11, %9
%17 = tail call i32 @putchar(i32 10)
%18 = add nuw nsw i32 %10, 1
%19 = icmp eq i32 %18, %3
br i1 %19, label %20, label %9
20: ; preds = %16
br i1 %4, label %21, label %32
21: ; preds = %20, %28
%22 = phi i32 [ %30, %28 ], [ 0, %20 ]
br i1 %5, label %23, label %28
23: ; preds = %21, %23
%24 = phi i32 [ %26, %23 ], [ 0, %21 ]
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%26 = add nuw nsw i32 %24, 1
%27 = icmp eq i32 %26, %0
br i1 %27, label %28, label %23
28: ; preds = %23, %21
%29 = tail call i32 @putchar(i32 10)
%30 = add nuw nsw i32 %22, 1
%31 = icmp eq i32 %30, %3
br i1 %31, label %32, label %21
32: ; preds = %28, %1, %8, %20
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret void
34: ; preds = %38, %6
%35 = tail call i32 @putchar(i32 10)
%36 = add nuw nsw i32 %7, 1
%37 = icmp eq i32 %36, %3
br i1 %37, label %8, label %6
38: ; preds = %6, %38
%39 = phi i32 [ %41, %38 ], [ 0, %6 ]
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%41 = add nuw nsw i32 %39, 1
%42 = icmp eq i32 %41, %0
br i1 %42, label %34, label %38
}