#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, char *, char *,
                           char *);
int /*<<< orphan*/ printf(char *, int);
void main() {
  enum { red, yellow, blue, white, black } i, j, k;
  FILE *fp;
  char *color[5] = {"red", "yellow", "blue", "white", "black"};
  int n = 0;
  fp = fopen("abc.txt", "w");
  for (i = red; i <= black; i++)
    for (j = red; j <= black; j++)
      for (k = red; k <= black; k++)
        if (i != j && i != k && j != k) {
          fprintf(fp, "%d:%s-%s-%s\n", n + 1, color[i], color[j], color[k]);
          n++;
        }
  printf("%d", n);
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xe91(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe8a(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe86(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe80(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe7b(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
lea    0xe6f(%rip),%rdi
lea    0xe55(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
ja     1284 <main+0x134>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
ja     1271 <main+0x121>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
ja     125e <main+0x10e>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     124b <main+0xfb>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     124b <main+0xfb>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     124b <main+0xfb>
mov    -0x18(%rbp),%rdi
mov    -0x44(%rbp),%edx
add    $0x1,%edx
mov    -0x4(%rbp),%eax
mov    -0x40(%rbp,%rax,8),%rcx
mov    -0x8(%rbp),%eax
mov    -0x40(%rbp,%rax,8),%r8
mov    -0xc(%rbp),%eax
mov    -0x40(%rbp,%rax,8),%r9
lea    0xde7(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1250 <main+0x100>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e6 <main+0x96>
jmp    1263 <main+0x113>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d5 <main+0x85>
jmp    1276 <main+0x126>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <main+0x74>
mov    -0x44(%rbp),%esi
lea    0xda3(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rax
mov    %rax,(%rsp)
lea    0xea4(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xe9f(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe98(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe92(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe8c(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbp
xor    %r12d,%r12d
lea    0xe7b(%rip),%r15
xor    %r13d,%r13d
xor    %r14d,%r14d
jmp    11d2 <main+0x92>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
add    $0x8,%r12
cmp    $0x5,%r13
je     12f3 <main+0x1b3>
xor    %ebx,%ebx
jmp    11ea <main+0xaa>
cs nopw 0x0(%rax,%rax,1)
add    $0x8,%rbx
cmp    $0x28,%rbx
je     11c0 <main+0x80>
cmp    %rbx,%r12
je     121a <main+0xda>
test   %r13,%r13
je     121a <main+0xda>
test   %rbx,%rbx
je     121a <main+0xda>
add    $0x1,%r14d
mov    (%rsp,%r13,8),%rcx
mov    (%rsp,%rbx,1),%r8
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
lea    0xdeb(%rip),%r9
call   1050 <fprintf@plt>
cmp    %rbx,%r12
je     124c <main+0x10c>
cmp    $0x1,%r13
je     124c <main+0x10c>
cmp    $0x8,%rbx
je     124c <main+0x10c>
add    $0x1,%r14d
mov    (%rsp,%r13,8),%rcx
mov    (%rsp,%rbx,1),%r8
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
lea    0xdbd(%rip),%r9
call   1050 <fprintf@plt>
cmp    %rbx,%r12
je     127e <main+0x13e>
cmp    $0x2,%r13
je     127e <main+0x13e>
cmp    $0x10,%rbx
je     127e <main+0x13e>
add    $0x1,%r14d
mov    (%rsp,%r13,8),%rcx
mov    (%rsp,%rbx,1),%r8
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
lea    0xd92(%rip),%r9
call   1050 <fprintf@plt>
cmp    %rbx,%r12
je     12b0 <main+0x170>
cmp    $0x3,%r13
je     12b0 <main+0x170>
cmp    $0x18,%rbx
je     12b0 <main+0x170>
add    $0x1,%r14d
mov    (%rsp,%r13,8),%rcx
mov    (%rsp,%rbx,1),%r8
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
lea    0xd65(%rip),%r9
call   1050 <fprintf@plt>
cmp    %rbx,%r12
je     11e0 <main+0xa0>
cmp    $0x4,%r13
je     11e0 <main+0xa0>
cmp    $0x20,%rbx
je     11e0 <main+0xa0>
add    $0x1,%r14d
mov    (%rsp,%r13,8),%rcx
mov    (%rsp,%rbx,1),%r8
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
lea    0xd2d(%rip),%r9
call   1050 <fprintf@plt>
jmp    11e0 <main+0xa0>
lea    0xd37(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
mov    %rbp,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"red\00"
@.str.1 = [7 x i8] c"yellow\00"
@.str.2 = [5 x i8] c"blue\00"
@.str.3 = [6 x i8] c"white\00"
@.str.4 = [6 x i8] c"black\00"
@.str.5 = [8 x i8] c"abc.txt\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [13 x i8] c"%d:%s-%s-%s\0A\00"
@.str.8 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [5 x i8*]
%2 = bitcast [5 x i8*]* %1 to i8*
%3 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %7
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %9
9: ; preds = %0, %75
%10 = phi i64 [ 0, %0 ], [ %76, %75 ]
%11 = phi i32 [ 0, %0 ], [ %72, %75 ]
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %10
%13 = icmp eq i64 %10, 0
%14 = icmp eq i64 %10, 1
%15 = icmp eq i64 %10, 2
%16 = icmp eq i64 %10, 3
%17 = icmp eq i64 %10, 4
br label %18
18: ; preds = %9, %71
%19 = phi i64 [ 0, %9 ], [ %73, %71 ]
%20 = phi i32 [ %11, %9 ], [ %72, %71 ]
%21 = icmp eq i64 %10, %19
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %19
%23 = or i1 %21, %13
%24 = icmp eq i64 %19, 0
%25 = or i1 %23, %24
br i1 %25, label %31, label %26
26: ; preds = %18
%27 = add nsw i32 %20, 1
%28 = load i8*, i8** %12
%29 = load i8*, i8** %22
%30 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %27, i8* %28, i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %18, %26
%32 = phi i32 [ %27, %26 ], [ %20, %18 ]
%33 = or i1 %21, %14
%34 = icmp eq i64 %19, 1
%35 = or i1 %33, %34
br i1 %35, label %41, label %36
36: ; preds = %31
%37 = add nsw i32 %32, 1
%38 = load i8*, i8** %12
%39 = load i8*, i8** %22
%40 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %37, i8* %38, i8* %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %36, %31
%42 = phi i32 [ %37, %36 ], [ %32, %31 ]
%43 = or i1 %21, %15
%44 = icmp eq i64 %19, 2
%45 = or i1 %43, %44
br i1 %45, label %51, label %46
46: ; preds = %41
%47 = add nsw i32 %42, 1
%48 = load i8*, i8** %12
%49 = load i8*, i8** %22
%50 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %47, i8* %48, i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %46, %41
%52 = phi i32 [ %47, %46 ], [ %42, %41 ]
%53 = or i1 %21, %16
%54 = icmp eq i64 %19, 3
%55 = or i1 %53, %54
br i1 %55, label %61, label %56
56: ; preds = %51
%57 = add nsw i32 %52, 1
%58 = load i8*, i8** %12
%59 = load i8*, i8** %22
%60 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %57, i8* %58, i8* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %56, %51
%62 = phi i32 [ %57, %56 ], [ %52, %51 ]
%63 = or i1 %21, %17
%64 = icmp eq i64 %19, 4
%65 = or i1 %63, %64
br i1 %65, label %71, label %66
66: ; preds = %61
%67 = add nsw i32 %62, 1
%68 = load i8*, i8** %12
%69 = load i8*, i8** %22
%70 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %67, i8* %68, i8* %69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %71
71: ; preds = %66, %61
%72 = phi i32 [ %67, %66 ], [ %62, %61 ]
%73 = add nuw nsw i64 %19, 1
%74 = icmp eq i64 %73, 5
br i1 %74, label %75, label %18
75: ; preds = %71
%76 = add nuw nsw i64 %10, 1
%77 = icmp eq i64 %76, 5
br i1 %77, label %78, label %9
78: ; preds = %75
%79 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %72)
%80 = tail call i32 @fclose(i32* %8)
ret void
}