#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 dumpActiveLed(int /*<<< orphan*/ *, int, int, int, int, int, int);
int dumpDisabledLed(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ outputConfHeader(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
void outputConfGenerate(FILE *fp, int areasX, int areasY) {
  int i, ledCount = 0, baseArea = 0;
  fprintf(fp, "# Top Row running left to right\n");
  outputConfHeader(fp);
  ledCount = dumpDisabledLed(fp, 0, ledCount);
  ledCount =
      dumpActiveLed(fp, 0, ((73) + (0) - (0)), ledCount, baseArea, 1, areasX);
  ledCount = dumpDisabledLed(fp, -0, ledCount);
  fprintf(fp, "# Right Column running top to bottom\n");
  outputConfHeader(fp);
  baseArea += areasX;
  ledCount = dumpDisabledLed(fp, 0, ledCount);
  ledCount =
      dumpActiveLed(fp, 0, ((41) + (0) - (0)), ledCount, baseArea, 0, areasY);
  ledCount = dumpDisabledLed(fp, -0, ledCount);
  fprintf(fp, "# Bottom Row running right to left\n");
  outputConfHeader(fp);
  baseArea += areasY;
  ledCount = dumpDisabledLed(fp, -0, ledCount);
  ledCount =
      dumpActiveLed(fp, ((73) + (0) - (0)), 0, ledCount, baseArea, 1, areasX);
  ledCount = dumpDisabledLed(fp, 0, ledCount);
  fprintf(fp, "# Left Column running bottom to top\n");
  outputConfHeader(fp);
  baseArea += areasX;
  ledCount = dumpDisabledLed(fp, -0, ledCount);
  ledCount =
      dumpActiveLed(fp, ((41) + (0) - (0)), 0, ledCount, baseArea, 0, areasY);
  ledCount = dumpDisabledLed(fp, 0, ledCount);
  printf("%d leds written to output, filled to 512\n", ledCount);
  fprintf(fp, "# Remaining LEDs are disabled\n");
  outputConfHeader(fp);
  ledCount = dumpDisabledLed(fp, 512 - ledCount, ledCount);
}


x86 assembly (clang, -O0):
<outputConfGenerate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <outputConfHeader@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0xc(%rbp),%eax
xor    %esi,%esi
mov    $0x49,%edx
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1030 <dumpActiveLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe45(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <outputConfHeader@plt>
mov    -0xc(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x10(%rbp),%eax
xor    %r9d,%r9d
mov    $0x29,%edx
mov    %r9d,%esi
mov    %eax,(%rsp)
call   1030 <dumpActiveLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe03(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <outputConfHeader@plt>
mov    -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0xc(%rbp),%eax
mov    $0x49,%esi
xor    %edx,%edx
mov    $0x1,%r9d
mov    %eax,(%rsp)
call   1030 <dumpActiveLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <outputConfHeader@plt>
mov    -0xc(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x10(%rbp),%eax
mov    $0x29,%esi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %eax,(%rsp)
call   1030 <dumpActiveLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xd7b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <outputConfHeader@plt>
mov    -0x8(%rbp),%rdi
mov    $0x200,%esi
sub    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <dumpDisabledLed@plt>
mov    %eax,-0x18(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputConfGenerate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0xe94(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <outputConfHeader@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <dumpDisabledLed@plt>
mov    %r15d,(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x49,%edx
mov    %eax,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
call   1030 <dumpActiveLed@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <dumpDisabledLed@plt>
mov    %eax,%ebp
lea    0xe5c(%rip),%rdi
mov    $0x25,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <outputConfHeader@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1070 <dumpDisabledLed@plt>
mov    %r14d,(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x29,%edx
mov    %eax,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <dumpActiveLed@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <dumpDisabledLed@plt>
mov    %eax,%r12d
lea    0xe2b(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <outputConfHeader@plt>
lea    (%r14,%r15,1),%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1070 <dumpDisabledLed@plt>
mov    %r15d,(%rsp)
mov    %rbx,%rdi
mov    $0x49,%esi
xor    %edx,%edx
mov    %eax,%ecx
mov    %ebp,%r8d
mov    $0x1,%r9d
call   1030 <dumpActiveLed@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <dumpDisabledLed@plt>
mov    %eax,%r12d
lea    0xdf0(%rip),%rdi
mov    $0x24,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <outputConfHeader@plt>
add    %r15d,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1070 <dumpDisabledLed@plt>
mov    %r14d,(%rsp)
mov    %rbx,%rdi
mov    $0x29,%esi
xor    %edx,%edx
mov    %eax,%ecx
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1030 <dumpActiveLed@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <dumpDisabledLed@plt>
mov    %eax,%ebp
lea    0xdbb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xdd7(%rip),%rdi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <outputConfHeader@plt>
mov    $0x200,%esi
sub    %ebp,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <dumpDisabledLed@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"# Top Row running left to right\0A\00"
@.str.1 = [38 x i8] c"# Right Column running top to bottom\0A\00"
@.str.2 = [36 x i8] c"# Bottom Row running right to left\0A\00"
@.str.3 = [37 x i8] c"# Left Column running bottom to top\0A\00"
@.str.4 = [42 x i8] c"%d leds written to output, filled to 512\0A\00"
@.str.5 = [31 x i8] c"# Remaining LEDs are disabled\0A\00"
define void @outputConfGenerate(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
store i32 0, i32* %9
%10 = load i32*, i32** %4
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%12 = load i32*, i32** %4
%13 = call i32 @outputConfHeader(i32* %12)
%14 = load i32*, i32** %4
%15 = load i32, i32* %8
%16 = call i32 @dumpDisabledLed(i32* %14, i32 0, i32 %15)
store i32 %16, i32* %8
%17 = load i32*, i32** %4
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = load i32, i32* %5
%21 = call i32 @dumpActiveLed(i32* %17, i32 0, i32 73, i32 %18, i32 %19, i32 1, i32 %20)
store i32 %21, i32* %8
%22 = load i32*, i32** %4
%23 = load i32, i32* %8
%24 = call i32 @dumpDisabledLed(i32* %22, i32 0, i32 %23)
store i32 %24, i32* %8
%25 = load i32*, i32** %4
%26 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32*, i32** %4
%28 = call i32 @outputConfHeader(i32* %27)
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = add nsw i32 %30, %29
store i32 %31, i32* %9
%32 = load i32*, i32** %4
%33 = load i32, i32* %8
%34 = call i32 @dumpDisabledLed(i32* %32, i32 0, i32 %33)
store i32 %34, i32* %8
%35 = load i32*, i32** %4
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = load i32, i32* %6
%39 = call i32 @dumpActiveLed(i32* %35, i32 0, i32 41, i32 %36, i32 %37, i32 0, i32 %38)
store i32 %39, i32* %8
%40 = load i32*, i32** %4
%41 = load i32, i32* %8
%42 = call i32 @dumpDisabledLed(i32* %40, i32 0, i32 %41)
store i32 %42, i32* %8
%43 = load i32*, i32** %4
%44 = call i32 @fprintf(i32* %43, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32*, i32** %4
%46 = call i32 @outputConfHeader(i32* %45)
%47 = load i32, i32* %6
%48 = load i32, i32* %9
%49 = add nsw i32 %48, %47
store i32 %49, i32* %9
%50 = load i32*, i32** %4
%51 = load i32, i32* %8
%52 = call i32 @dumpDisabledLed(i32* %50, i32 0, i32 %51)
store i32 %52, i32* %8
%53 = load i32*, i32** %4
%54 = load i32, i32* %8
%55 = load i32, i32* %9
%56 = load i32, i32* %5
%57 = call i32 @dumpActiveLed(i32* %53, i32 73, i32 0, i32 %54, i32 %55, i32 1, i32 %56)
store i32 %57, i32* %8
%58 = load i32*, i32** %4
%59 = load i32, i32* %8
%60 = call i32 @dumpDisabledLed(i32* %58, i32 0, i32 %59)
store i32 %60, i32* %8
%61 = load i32*, i32** %4
%62 = call i32 @fprintf(i32* %61, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32*, i32** %4
%64 = call i32 @outputConfHeader(i32* %63)
%65 = load i32, i32* %5
%66 = load i32, i32* %9
%67 = add nsw i32 %66, %65
store i32 %67, i32* %9
%68 = load i32*, i32** %4
%69 = load i32, i32* %8
%70 = call i32 @dumpDisabledLed(i32* %68, i32 0, i32 %69)
store i32 %70, i32* %8
%71 = load i32*, i32** %4
%72 = load i32, i32* %8
%73 = load i32, i32* %9
%74 = load i32, i32* %6
%75 = call i32 @dumpActiveLed(i32* %71, i32 41, i32 0, i32 %72, i32 %73, i32 0, i32 %74)
store i32 %75, i32* %8
%76 = load i32*, i32** %4
%77 = load i32, i32* %8
%78 = call i32 @dumpDisabledLed(i32* %76, i32 0, i32 %77)
store i32 %78, i32* %8
%79 = load i32, i32* %8
%80 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %79)
%81 = load i32*, i32** %4
%82 = call i32 @fprintf(i32* %81, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%83 = load i32*, i32** %4
%84 = call i32 @outputConfHeader(i32* %83)
%85 = load i32*, i32** %4
%86 = load i32, i32* %8
%87 = sub nsw i32 512, %86
%88 = load i32, i32* %8
%89 = call i32 @dumpDisabledLed(i32* %85, i32 %87, i32 %88)
store i32 %89, i32* %8
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"# Top Row running left to right\0A\00"
@.str.1 = [38 x i8] c"# Right Column running top to bottom\0A\00"
@.str.2 = [36 x i8] c"# Bottom Row running right to left\0A\00"
@.str.3 = [37 x i8] c"# Left Column running bottom to top\0A\00"
@.str.4 = [42 x i8] c"%d leds written to output, filled to 512\0A\00"
@.str.5 = [31 x i8] c"# Remaining LEDs are disabled\0A\00"
define void @outputConfGenerate(i32* %0, i32 %1, i32 %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 32, i64 1, i32* %0)
%5 = tail call i32 @outputConfHeader(i32* %0)
%6 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 0)
%7 = tail call i32 @dumpActiveLed(i32* %0, i32 0, i32 73, i32 %6, i32 0, i32 1, i32 %1)
%8 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %7)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i64 37, i64 1, i32* %0)
%10 = tail call i32 @outputConfHeader(i32* %0)
%11 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %8)
%12 = tail call i32 @dumpActiveLed(i32* %0, i32 0, i32 41, i32 %11, i32 %1, i32 0, i32 %2)
%13 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %12)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 35, i64 1, i32* %0)
%15 = tail call i32 @outputConfHeader(i32* %0)
%16 = add nsw i32 %2, %1
%17 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %13)
%18 = tail call i32 @dumpActiveLed(i32* %0, i32 73, i32 0, i32 %17, i32 %16, i32 1, i32 %1)
%19 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %18)
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i64 36, i64 1, i32* %0)
%21 = tail call i32 @outputConfHeader(i32* %0)
%22 = add nsw i32 %16, %1
%23 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %19)
%24 = tail call i32 @dumpActiveLed(i32* %0, i32 41, i32 0, i32 %23, i32 %22, i32 0, i32 %2)
%25 = tail call i32 @dumpDisabledLed(i32* %0, i32 0, i32 %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i64 30, i64 1, i32* %0)
%28 = tail call i32 @outputConfHeader(i32* %0)
%29 = sub nsw i32 512, %25
%30 = tail call i32 @dumpDisabledLed(i32* %0, i32 %29, i32 %25)
ret void
}