#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*/ pins;

/* Variables and functions */
int /*<<< orphan*/ GPIO_Write(int, int);
scalar_t__ setGPIO_Out(int);
int main() {
  int pins[3] = {28, 17, 24};
  int i;
  int c;
  int j;
  for (i = 0; i < (sizeof(pins) / sizeof(int)); i++)
    if (setGPIO_Out(pins[i]))
      return -1;
  for (i = 0; i < 100; i++) {
    GPIO_Write(28, (i + 0) % 3);
    GPIO_Write(17, (i + 1) % 3);
    GPIO_Write(24, (i + 2) % 3);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x3,%rax
jae    118e <main+0x6e>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%edi
call   1040 <setGPIO_Out@plt>
cmp    $0x0,%rax
je     117b <main+0x5b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1202 <main+0xe2>
jmp    1180 <main+0x60>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <main+0x2a>
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11fb <main+0xdb>
mov    -0x14(%rbp),%eax
add    $0x0,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x1c,%edi
call   1030 <GPIO_Write@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x11,%edi
call   1030 <GPIO_Write@plt>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x18,%edi
call   1030 <GPIO_Write@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1195 <main+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1c,%edi
call   1040 <setGPIO_Out@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
jne    11f4 <main+0xd4>
mov    $0x11,%edi
call   1040 <setGPIO_Out@plt>
test   %rax,%rax
jne    11f4 <main+0xd4>
mov    $0x18,%edi
call   1040 <setGPIO_Out@plt>
test   %rax,%rax
jne    11f4 <main+0xd4>
mov    $0x64,%r15d
mov    $0x1,%ebp
mov    $0x2,%ebx
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %ebp,%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %ebp,%r12d
sub    %eax,%r12d
mov    %ebx,%eax
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %ebx,%r13d
sub    %eax,%r13d
mov    %r14d,%eax
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %r14d,%esi
sub    %eax,%esi
mov    $0x1c,%edi
call   1030 <GPIO_Write@plt>
add    $0x1,%r14d
mov    $0x11,%edi
mov    %r12d,%esi
call   1030 <GPIO_Write@plt>
mov    $0x18,%edi
mov    %r13d,%esi
call   1030 <GPIO_Write@plt>
add    $0x1,%ebp
add    $0x1,%ebx
add    $0xffffffff,%r15d
jne    1180 <main+0x60>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.pins = [3 x i32] [i32 28, i32 17, i32 24]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [3 x i32]* %2 to i8*
store i32 0, i32* %3
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 3
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i64 @setGPIO_Out(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 -1, i32* %1
br label %44
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %7
23: ; preds = %7
store i32 0, i32* %3
br label %24
24: ; preds = %40, %23
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 100
br i1 %26, label %27, label %43
27: ; preds = %24
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 0
%30 = srem i32 %29, 3
%31 = call i32 @GPIO_Write(i32 28, i32 %30)
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
%34 = srem i32 %33, 3
%35 = call i32 @GPIO_Write(i32 17, i32 %34)
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 2
%38 = srem i32 %37, 3
%39 = call i32 @GPIO_Write(i32 24, i32 %38)
br label %40
40: ; preds = %27
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %24
43: ; preds = %24
store i32 0, i32* %1
br label %44
44: ; preds = %43, %18
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @setGPIO_Out(i32 28)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %25
3: ; preds = %0
%4 = tail call i64 @setGPIO_Out(i32 17)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %25
6: ; preds = %3
%7 = tail call i64 @setGPIO_Out(i32 24)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %6, %9
%10 = phi i32 [ %15, %9 ], [ 0, %6 ]
%11 = trunc i32 %10 to i8
%12 = urem i8 %11, 3
%13 = zext i8 %12 to i32
%14 = tail call i32 @GPIO_Write(i32 28, i32 %13)
%15 = add nuw nsw i32 %10, 1
%16 = trunc i32 %15 to i8
%17 = urem i8 %16, 3
%18 = zext i8 %17 to i32
%19 = tail call i32 @GPIO_Write(i32 17, i32 %18)
%20 = add i8 %11, 2
%21 = urem i8 %20, 3
%22 = zext i8 %21 to i32
%23 = tail call i32 @GPIO_Write(i32 24, i32 %22)
%24 = icmp eq i32 %15, 100
br i1 %24, label %25, label %9
25: ; preds = %9, %0, %3, %6
%26 = phi i32 [ -1, %6 ], [ -1, %3 ], [ -1, %0 ], [ 0, %9 ]
ret i32 %26
}