#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 rand();
int /*<<< orphan*/ set_cell(int, int, char);
void fill() {
  int i, j;
  char colors[] = "ABCDEFG";
  for (i = 0; i < 25; i++) {
    for (j = 0; j < 25; j++) {
      if ((i == 0) & (j == 25 - 1)) {
        set_cell(i, j, '^');
      } else {
        if ((i == 25 - 1) & (j == 0)) {
          set_cell(i, j, 'v');
        } else {
          int alea = rand() % 7;
          set_cell(i, j, colors[alea]);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x19,-0x4(%rbp)
jge    1218 <fill+0xf8>
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    1205 <fill+0xe5>
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x18,-0x8(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     118e <fill+0x6e>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x5e,%edx
call   1030 <set_cell@plt>
jmp    11f2 <fill+0xd2>
cmpl   $0x18,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0x8(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11c7 <fill+0xa7>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x76,%edx
call   1030 <set_cell@plt>
jmp    11ed <fill+0xcd>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movslq -0x14(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%edx
call   1030 <set_cell@plt>
jmp    11f2 <fill+0xd2>
jmp    11f7 <fill+0xd7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <fill+0x2b>
jmp    120a <fill+0xea>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <fill+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill>:
push   %rbp
push   %r14
push   %rbx
lea    0xed5(%rip),%r14
xor    %ebx,%ebx
jmp    1149 <fill+0x29>
nop
xor    %edi,%edi
mov    $0x18,%esi
mov    $0x5e,%edx
call   1030 <set_cell@plt>
add    $0x1,%ebx
cmp    $0x19,%ebx
je     11b4 <fill+0x94>
xor    %ebp,%ebp
jmp    1194 <fill+0x74>
nopl   (%rax)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movsbl (%rax,%r14,1),%edx
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <set_cell@plt>
add    $0x1,%ebp
cmp    $0x19,%ebp
je     1141 <fill+0x21>
test   %ebx,%ebx
jne    119d <fill+0x7d>
cmp    $0x18,%ebp
je     1130 <fill+0x10>
cmp    $0x18,%ebx
jne    1150 <fill+0x30>
test   %ebp,%ebp
jne    1150 <fill+0x30>
mov    $0x18,%edi
xor    %esi,%esi
mov    $0x76,%edx
jmp    1187 <fill+0x67>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.fill.colors = [8 x i8] c"ABCDEFG\00"
define void @fill() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i8]
%4 = alloca i32
%5 = bitcast [8 x i8]* %3 to i8*
store i32 0, i32* %1
br label %6
6: ; preds = %55, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 25
br i1 %8, label %9, label %58
9: ; preds = %6
store i32 0, i32* %2
br label %10
10: ; preds = %51, %9
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 25
br i1 %12, label %13, label %54
13: ; preds = %10
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 24
%19 = zext i1 %18 to i32
%20 = and i32 %16, %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %13
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 @set_cell(i32 %23, i32 %24, i8 signext 94)
br label %50
26: ; preds = %13
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, 24
%29 = zext i1 %28 to i32
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 0
%32 = zext i1 %31 to i32
%33 = and i32 %29, %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %26
%36 = load i32, i32* %1
%37 = load i32, i32* %2
%38 = call i32 @set_cell(i32 %36, i32 %37, i8 signext 118)
br label %49
39: ; preds = %26
%40 = call i32 (...) @rand()
%41 = srem i32 %40, 7
store i32 %41, i32* %4
%42 = load i32, i32* %1
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = call i32 @set_cell(i32 %42, i32 %43, i8 signext %47)
br label %49
49: ; preds = %39, %35
br label %50
50: ; preds = %49, %22
br label %51
51: ; preds = %50
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %10
54: ; preds = %10
br label %55
55: ; preds = %54
%56 = load i32, i32* %1
%57 = add nsw i32 %56, 1
store i32 %57, i32* %1
br label %6
58: ; preds = %6
ret void
}

LLVM IR (-O2):
@__const.fill.colors = [8 x i8] c"ABCDEFG\00"
define void @fill() {
br label %1
1: ; preds = %0, %26
%2 = phi i32 [ 0, %0 ], [ %27, %26 ]
%3 = icmp eq i32 %2, 0
%4 = icmp eq i32 %2, 24
br label %5
5: ; preds = %1, %23
%6 = phi i32 [ 0, %1 ], [ %24, %23 ]
%7 = icmp eq i32 %6, 24
%8 = and i1 %3, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @set_cell(i32 0, i32 24, i8 signext 94)
br label %26
11: ; preds = %5
%12 = icmp eq i32 %6, 0
%13 = and i1 %4, %12
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @set_cell(i32 24, i32 0, i8 signext 118)
br label %23
16: ; preds = %11
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.fill.colors, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = tail call i32 @set_cell(i32 %2, i32 %6, i8 signext %21)
br label %23
23: ; preds = %16, %14
%24 = add nuw nsw i32 %6, 1
%25 = icmp eq i32 %24, 25
br i1 %25, label %26, label %5
26: ; preds = %23, %9
%27 = add nuw nsw i32 %2, 1
%28 = icmp eq i32 %27, 25
br i1 %28, label %29, label %1
29: ; preds = %26
ret void
}