#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*/ analogWrite(int, int);
int /*<<< orphan*/ delay(int);
void smooth(int smoothSpeed, int rPin, int gPin, int bPin) {
  int rValue = 255;
  int gValue = 0;
  int bValue = 0;
  for (gValue; gValue < 255; gValue += smoothSpeed) {
    analogWrite(rPin, rValue);
    analogWrite(gPin, gValue);
    analogWrite(bPin, bValue);
    delay(50);
  }
  for (rValue; rValue > 0; rValue -= smoothSpeed) {
    analogWrite(rPin, rValue);
    analogWrite(gPin, gValue);
    analogWrite(bPin, bValue);
    delay(50);
  }
  for (bValue; bValue < 255; bValue += smoothSpeed) {
    analogWrite(rPin, rValue);
    analogWrite(gPin, gValue);
    analogWrite(bPin, bValue);
    delay(50);
  }
  for (gValue; gValue > 0; gValue -= smoothSpeed) {
    analogWrite(rPin, rValue);
    analogWrite(gPin, gValue);
    analogWrite(bPin, bValue);
    delay(50);
  }
  for (rValue; rValue < 255; rValue += smoothSpeed) {
    analogWrite(rPin, rValue);
    analogWrite(gPin, gValue);
    analogWrite(bPin, bValue);
    delay(50);
  }
  for (bValue; bValue > 0; bValue -= smoothSpeed) {
    analogWrite(rPin, rValue);
    analogWrite(gPin, gValue);
    analogWrite(bPin, bValue);
    delay(50);
  }
}


x86 assembly (clang, -O0):
<smooth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0xff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xff,-0x18(%rbp)
jge    118f <smooth+0x6f>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <smooth+0x29>
cmpl   $0x0,-0x14(%rbp)
jle    11d4 <smooth+0xb4>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    118f <smooth+0x6f>
cmpl   $0xff,-0x1c(%rbp)
jge    121a <smooth+0xfa>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11d4 <smooth+0xb4>
cmpl   $0x0,-0x18(%rbp)
jle    125f <smooth+0x13f>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    121a <smooth+0xfa>
cmpl   $0xff,-0x14(%rbp)
jge    12a5 <smooth+0x185>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    125f <smooth+0x13f>
cmpl   $0x0,-0x1c(%rbp)
jle    12ea <smooth+0x1ca>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <analogWrite@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a5 <smooth+0x185>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smooth>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%r12d
mov    %edi,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12d,%edi
mov    $0xff,%esi
call   1040 <analogWrite@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <analogWrite@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
add    %r13d,%ebx
cmp    $0xff,%ebx
jl     1140 <smooth+0x20>
mov    $0xff,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebp,%esi
call   1040 <analogWrite@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <analogWrite@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
sub    %r13d,%ebp
test   %ebp,%ebp
jg     1180 <smooth+0x60>
mov    %r14d,0x4(%rsp)
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebp,%esi
call   1040 <analogWrite@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <analogWrite@plt>
mov    0x4(%rsp),%edi
mov    %r14d,%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
add    %r13d,%r14d
cmp    $0xff,%r14d
jl     11c0 <smooth+0xa0>
jmp    122d <smooth+0x10d>
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebp,%esi
call   1040 <analogWrite@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <analogWrite@plt>
mov    0x4(%rsp),%edi
mov    %r14d,%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
sub    %r13d,%ebx
test   %ebx,%ebx
jg     1200 <smooth+0xe0>
cmp    $0xfe,%ebp
jg     12ad <smooth+0x18d>
nopl   0x0(%rax)
mov    %r12d,%edi
mov    %ebp,%esi
call   1040 <analogWrite@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <analogWrite@plt>
mov    0x4(%rsp),%edi
mov    %r14d,%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
add    %r13d,%ebp
cmp    $0xff,%ebp
jl     1240 <smooth+0x120>
jmp    12ad <smooth+0x18d>
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebp,%esi
call   1040 <analogWrite@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <analogWrite@plt>
mov    0x4(%rsp),%edi
mov    %r14d,%esi
call   1040 <analogWrite@plt>
mov    $0x32,%edi
call   1030 <delay@plt>
sub    %r13d,%r14d
test   %r14d,%r14d
jg     1280 <smooth+0x160>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @smooth(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 255, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%12 = load i32, i32* %10
br label %13
13: ; preds = %27, %4
%14 = load i32, i32* %10
%15 = icmp slt i32 %14, 255
br i1 %15, label %16, label %31
16: ; preds = %13
%17 = load i32, i32* %6
%18 = load i32, i32* %9
%19 = call i32 @analogWrite(i32 %17, i32 %18)
%20 = load i32, i32* %7
%21 = load i32, i32* %10
%22 = call i32 @analogWrite(i32 %20, i32 %21)
%23 = load i32, i32* %8
%24 = load i32, i32* %11
%25 = call i32 @analogWrite(i32 %23, i32 %24)
%26 = call i32 @delay(i32 50)
br label %27
27: ; preds = %16
%28 = load i32, i32* %5
%29 = load i32, i32* %10
%30 = add nsw i32 %29, %28
store i32 %30, i32* %10
br label %13
31: ; preds = %13
%32 = load i32, i32* %9
br label %33
33: ; preds = %47, %31
%34 = load i32, i32* %9
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32, i32* %6
%38 = load i32, i32* %9
%39 = call i32 @analogWrite(i32 %37, i32 %38)
%40 = load i32, i32* %7
%41 = load i32, i32* %10
%42 = call i32 @analogWrite(i32 %40, i32 %41)
%43 = load i32, i32* %8
%44 = load i32, i32* %11
%45 = call i32 @analogWrite(i32 %43, i32 %44)
%46 = call i32 @delay(i32 50)
br label %47
47: ; preds = %36
%48 = load i32, i32* %5
%49 = load i32, i32* %9
%50 = sub nsw i32 %49, %48
store i32 %50, i32* %9
br label %33
51: ; preds = %33
%52 = load i32, i32* %11
br label %53
53: ; preds = %67, %51
%54 = load i32, i32* %11
%55 = icmp slt i32 %54, 255
br i1 %55, label %56, label %71
56: ; preds = %53
%57 = load i32, i32* %6
%58 = load i32, i32* %9
%59 = call i32 @analogWrite(i32 %57, i32 %58)
%60 = load i32, i32* %7
%61 = load i32, i32* %10
%62 = call i32 @analogWrite(i32 %60, i32 %61)
%63 = load i32, i32* %8
%64 = load i32, i32* %11
%65 = call i32 @analogWrite(i32 %63, i32 %64)
%66 = call i32 @delay(i32 50)
br label %67
67: ; preds = %56
%68 = load i32, i32* %5
%69 = load i32, i32* %11
%70 = add nsw i32 %69, %68
store i32 %70, i32* %11
br label %53
71: ; preds = %53
%72 = load i32, i32* %10
br label %73
73: ; preds = %87, %71
%74 = load i32, i32* %10
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %91
76: ; preds = %73
%77 = load i32, i32* %6
%78 = load i32, i32* %9
%79 = call i32 @analogWrite(i32 %77, i32 %78)
%80 = load i32, i32* %7
%81 = load i32, i32* %10
%82 = call i32 @analogWrite(i32 %80, i32 %81)
%83 = load i32, i32* %8
%84 = load i32, i32* %11
%85 = call i32 @analogWrite(i32 %83, i32 %84)
%86 = call i32 @delay(i32 50)
br label %87
87: ; preds = %76
%88 = load i32, i32* %5
%89 = load i32, i32* %10
%90 = sub nsw i32 %89, %88
store i32 %90, i32* %10
br label %73
91: ; preds = %73
%92 = load i32, i32* %9
br label %93
93: ; preds = %107, %91
%94 = load i32, i32* %9
%95 = icmp slt i32 %94, 255
br i1 %95, label %96, label %111
96: ; preds = %93
%97 = load i32, i32* %6
%98 = load i32, i32* %9
%99 = call i32 @analogWrite(i32 %97, i32 %98)
%100 = load i32, i32* %7
%101 = load i32, i32* %10
%102 = call i32 @analogWrite(i32 %100, i32 %101)
%103 = load i32, i32* %8
%104 = load i32, i32* %11
%105 = call i32 @analogWrite(i32 %103, i32 %104)
%106 = call i32 @delay(i32 50)
br label %107
107: ; preds = %96
%108 = load i32, i32* %5
%109 = load i32, i32* %9
%110 = add nsw i32 %109, %108
store i32 %110, i32* %9
br label %93
111: ; preds = %93
%112 = load i32, i32* %11
br label %113
113: ; preds = %127, %111
%114 = load i32, i32* %11
%115 = icmp sgt i32 %114, 0
br i1 %115, label %116, label %131
116: ; preds = %113
%117 = load i32, i32* %6
%118 = load i32, i32* %9
%119 = call i32 @analogWrite(i32 %117, i32 %118)
%120 = load i32, i32* %7
%121 = load i32, i32* %10
%122 = call i32 @analogWrite(i32 %120, i32 %121)
%123 = load i32, i32* %8
%124 = load i32, i32* %11
%125 = call i32 @analogWrite(i32 %123, i32 %124)
%126 = call i32 @delay(i32 50)
br label %127
127: ; preds = %116
%128 = load i32, i32* %5
%129 = load i32, i32* %11
%130 = sub nsw i32 %129, %128
store i32 %130, i32* %11
br label %113
131: ; preds = %113
ret void
}

LLVM IR (-O2):
define void @smooth(i32 %0, i32 %1, i32 %2, i32 %3) {
br label %5
5: ; preds = %4, %5
%6 = phi i32 [ 0, %4 ], [ %11, %5 ]
%7 = tail call i32 @analogWrite(i32 %1, i32 255)
%8 = tail call i32 @analogWrite(i32 %2, i32 %6)
%9 = tail call i32 @analogWrite(i32 %3, i32 0)
%10 = tail call i32 @delay(i32 50)
%11 = add nsw i32 %6, %0
%12 = icmp slt i32 %11, 255
br i1 %12, label %5, label %13
13: ; preds = %5, %13
%14 = phi i32 [ %19, %13 ], [ 255, %5 ]
%15 = tail call i32 @analogWrite(i32 %1, i32 %14)
%16 = tail call i32 @analogWrite(i32 %2, i32 %11)
%17 = tail call i32 @analogWrite(i32 %3, i32 0)
%18 = tail call i32 @delay(i32 50)
%19 = sub nsw i32 %14, %0
%20 = icmp sgt i32 %19, 0
br i1 %20, label %13, label %23
21: ; preds = %23
%22 = icmp sgt i32 %11, 0
br i1 %22, label %34, label %31
23: ; preds = %13, %23
%24 = phi i32 [ %29, %23 ], [ 0, %13 ]
%25 = tail call i32 @analogWrite(i32 %1, i32 %19)
%26 = tail call i32 @analogWrite(i32 %2, i32 %11)
%27 = tail call i32 @analogWrite(i32 %3, i32 %24)
%28 = tail call i32 @delay(i32 50)
%29 = add nsw i32 %24, %0
%30 = icmp slt i32 %29, 255
br i1 %30, label %23, label %21
31: ; preds = %34, %21
%32 = phi i32 [ %11, %21 ], [ %40, %34 ]
%33 = icmp slt i32 %19, 255
br i1 %33, label %45, label %42
34: ; preds = %21, %34
%35 = phi i32 [ %40, %34 ], [ %11, %21 ]
%36 = tail call i32 @analogWrite(i32 %1, i32 %19)
%37 = tail call i32 @analogWrite(i32 %2, i32 %35)
%38 = tail call i32 @analogWrite(i32 %3, i32 %29)
%39 = tail call i32 @delay(i32 50)
%40 = sub nsw i32 %35, %0
%41 = icmp sgt i32 %40, 0
br i1 %41, label %34, label %31
42: ; preds = %45, %31
%43 = phi i32 [ %19, %31 ], [ %51, %45 ]
%44 = icmp sgt i32 %29, 0
br i1 %44, label %53, label %61
45: ; preds = %31, %45
%46 = phi i32 [ %51, %45 ], [ %19, %31 ]
%47 = tail call i32 @analogWrite(i32 %1, i32 %46)
%48 = tail call i32 @analogWrite(i32 %2, i32 %32)
%49 = tail call i32 @analogWrite(i32 %3, i32 %29)
%50 = tail call i32 @delay(i32 50)
%51 = add nsw i32 %46, %0
%52 = icmp slt i32 %51, 255
br i1 %52, label %45, label %42
53: ; preds = %42, %53
%54 = phi i32 [ %59, %53 ], [ %29, %42 ]
%55 = tail call i32 @analogWrite(i32 %1, i32 %43)
%56 = tail call i32 @analogWrite(i32 %2, i32 %32)
%57 = tail call i32 @analogWrite(i32 %3, i32 %54)
%58 = tail call i32 @delay(i32 50)
%59 = sub nsw i32 %54, %0
%60 = icmp sgt i32 %59, 0
br i1 %60, label %53, label %61
61: ; preds = %53, %42
ret void
}