#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*/ ReversePix(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void ReverseIt() {
  int i;
  char buf[1024];
  for (i = 0; i < 8; i++) {
    (void)sprintf(buf, "%d.Color", i);
    ReversePix(buf);
  }
  ReversePix("Foreground");
  ReversePix("Border");
  ReversePix("ZeroColor");
  ReversePix("Background");
}


x86 assembly (clang, -O0):
<ReverseIt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    116c <ReverseIt+0x4c>
lea    -0x410(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeb3(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <ReversePix@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <ReverseIt+0x12>
lea    0xe96(%rip),%rdi
call   1030 <ReversePix@plt>
lea    0xe95(%rip),%rdi
call   1030 <ReversePix@plt>
lea    0xe90(%rip),%rdi
call   1030 <ReversePix@plt>
lea    0xe8e(%rip),%rdi
call   1030 <ReversePix@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseIt>:
push   %r14
push   %rbx
sub    $0x408,%rsp
lea    0xecf(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <ReversePix@plt>
lea    0xe11(%rip),%rdi
call   1030 <ReversePix@plt>
lea    0xe10(%rip),%rdi
call   1030 <ReversePix@plt>
lea    0xe0b(%rip),%rdi
call   1030 <ReversePix@plt>
lea    0xe09(%rip),%rdi
call   1030 <ReversePix@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d.Color\00"
@.str.1 = [11 x i8] c"Foreground\00"
@.str.2 = [7 x i8] c"Border\00"
@.str.3 = [10 x i8] c"ZeroColor\00"
@.str.4 = [11 x i8] c"Background\00"
define void @ReverseIt() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 8
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* %1
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = call i32 @ReversePix(i8* %10)
br label %12
12: ; preds = %6
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %3
15: ; preds = %3
%16 = call i32 @ReversePix(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @ReversePix(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @ReversePix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @ReversePix(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d.Color\00"
@.str.1 = [11 x i8] c"Foreground\00"
@.str.2 = [7 x i8] c"Border\00"
@.str.3 = [10 x i8] c"ZeroColor\00"
@.str.4 = [11 x i8] c"Background\00"
define void @ReverseIt() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = call i32 @ReversePix(i8* %2)
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = call i32 @ReversePix(i8* %2)
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = call i32 @ReversePix(i8* %2)
%9 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = call i32 @ReversePix(i8* %2)
%11 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4)
%12 = call i32 @ReversePix(i8* %2)
%13 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5)
%14 = call i32 @ReversePix(i8* %2)
%15 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 6)
%16 = call i32 @ReversePix(i8* %2)
%17 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 7)
%18 = call i32 @ReversePix(i8* %2)
%19 = call i32 @ReversePix(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @ReversePix(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @ReversePix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @ReversePix(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
ret void
}