#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*/ can_change_color();
int /*<<< orphan*/ init_color(int, int, int, int);
int /*<<< orphan*/ start_color();
int register_colors(void) {
  if (!can_change_color()) {
    return 0;
  }
  start_color();
  int colors = 16;
  for (int r = (1000 % 5); r <= 1000; r += (1000 / 5)) {
    for (int g = (1000 % 5); g <= 1000; g += (1000 / 5)) {
      for (int b = (1000 % 5); b <= 1000; b += (1000 / 5)) {
        init_color(colors, r, g, b);
        colors++;
      }
    }
  }
  for (int i = 0; i <= 1000; i += (1000 / 23)) {
    init_color(colors, i, i, i);
    colors++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<register_colors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <can_change_color@plt>
cmp    $0x0,%eax
jne    1154 <register_colors+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1235 <register_colors+0x105>
mov    $0x0,%al
call   1040 <start_color@plt>
movl   $0x10,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jg     11f2 <register_colors+0xc2>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jg     11dd <register_colors+0xad>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jg     11c8 <register_colors+0x98>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <init_color@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0x14(%rbp)
jmp    1191 <register_colors+0x61>
jmp    11cd <register_colors+0x9d>
mov    -0x10(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0x10(%rbp)
jmp    117d <register_colors+0x4d>
jmp    11e2 <register_colors+0xb2>
mov    -0xc(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <register_colors+0x39>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jg     122e <register_colors+0xfe>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <init_color@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2b,%eax
mov    %eax,-0x18(%rbp)
jmp    11f9 <register_colors+0xc9>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<register_colors>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <can_change_color@plt>
test   %eax,%eax
je     1242 <register_colors+0x112>
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <start_color@plt>
mov    $0x10,%r15d
cs nopw 0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1030 <init_color@plt>
lea    0x1(%r15),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0xc8,%ecx
call   1030 <init_color@plt>
lea    0x2(%r15),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0x190,%ecx
call   1030 <init_color@plt>
lea    0x3(%r15),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0x258,%ecx
call   1030 <init_color@plt>
lea    0x4(%r15),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0x320,%ecx
call   1030 <init_color@plt>
lea    0x5(%r15),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0x3e8,%ecx
call   1030 <init_color@plt>
add    $0x6,%r15d
lea    0xc8(%rbx),%eax
cmp    $0x321,%ebx
mov    %eax,%ebx
jb     1170 <register_colors+0x40>
lea    0xc8(%r14),%eax
cmp    $0x321,%r14d
mov    %eax,%r14d
jb     1160 <register_colors+0x30>
mov    $0xffffffd5,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x2b,%ebx
mov    %r15d,%edi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %ebx,%ecx
call   1030 <init_color@plt>
add    $0x1,%r15d
cmp    $0x3be,%ebx
jb     1220 <register_colors+0xf0>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @register_colors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (...) @can_change_color()
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %0
store i32 0, i32* %1
br label %58
10: ; preds = %0
%11 = call i32 (...) @start_color()
store i32 16, i32* %2
store i32 0, i32* %3
br label %12
12: ; preds = %39, %10
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 1000
br i1 %14, label %15, label %42
15: ; preds = %12
store i32 0, i32* %4
br label %16
16: ; preds = %35, %15
%17 = load i32, i32* %4
%18 = icmp sle i32 %17, 1000
br i1 %18, label %19, label %38
19: ; preds = %16
store i32 0, i32* %5
br label %20
20: ; preds = %31, %19
%21 = load i32, i32* %5
%22 = icmp sle i32 %21, 1000
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 @init_color(i32 %24, i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %31
31: ; preds = %23
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 200
store i32 %33, i32* %5
br label %20
34: ; preds = %20
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 200
store i32 %37, i32* %4
br label %16
38: ; preds = %16
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 200
store i32 %41, i32* %3
br label %12
42: ; preds = %12
store i32 0, i32* %6
br label %43
43: ; preds = %54, %42
%44 = load i32, i32* %6
%45 = icmp sle i32 %44, 1000
br i1 %45, label %46, label %57
46: ; preds = %43
%47 = load i32, i32* %2
%48 = load i32, i32* %6
%49 = load i32, i32* %6
%50 = load i32, i32* %6
%51 = call i32 @init_color(i32 %47, i32 %48, i32 %49, i32 %50)
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %54
54: ; preds = %46
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 43
store i32 %56, i32* %6
br label %43
57: ; preds = %43
store i32 1, i32* %1
br label %58
58: ; preds = %57, %9
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
define i32 @register_colors() {
%1 = tail call i32 (...) @can_change_color()
%2 = icmp eq i32 %1, 0
br i1 %2, label %35, label %3
3: ; preds = %0
%4 = tail call i32 (...) @start_color()
br label %5
5: ; preds = %3, %25
%6 = phi i32 [ 0, %3 ], [ %26, %25 ]
%7 = phi i32 [ 16, %3 ], [ %22, %25 ]
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ 0, %5 ], [ %23, %8 ]
%10 = phi i32 [ %7, %5 ], [ %22, %8 ]
%11 = tail call i32 @init_color(i32 %10, i32 %6, i32 %9, i32 0)
%12 = add i32 %10, 1
%13 = tail call i32 @init_color(i32 %12, i32 %6, i32 %9, i32 200)
%14 = add i32 %10, 2
%15 = tail call i32 @init_color(i32 %14, i32 %6, i32 %9, i32 400)
%16 = add i32 %10, 3
%17 = tail call i32 @init_color(i32 %16, i32 %6, i32 %9, i32 600)
%18 = add i32 %10, 4
%19 = tail call i32 @init_color(i32 %18, i32 %6, i32 %9, i32 800)
%20 = add i32 %10, 5
%21 = tail call i32 @init_color(i32 %20, i32 %6, i32 %9, i32 1000)
%22 = add i32 %10, 6
%23 = add nuw nsw i32 %9, 200
%24 = icmp ult i32 %9, 801
br i1 %24, label %8, label %25
25: ; preds = %8
%26 = add nuw nsw i32 %6, 200
%27 = icmp ult i32 %6, 801
br i1 %27, label %5, label %28
28: ; preds = %25, %28
%29 = phi i32 [ %33, %28 ], [ 0, %25 ]
%30 = phi i32 [ %32, %28 ], [ %22, %25 ]
%31 = tail call i32 @init_color(i32 %30, i32 %29, i32 %29, i32 %29)
%32 = add nsw i32 %30, 1
%33 = add nuw nsw i32 %29, 43
%34 = icmp ult i32 %29, 958
br i1 %34, label %28, label %35
35: ; preds = %28, %0
%36 = phi i32 [ 0, %0 ], [ 1, %28 ]
ret i32 %36
}