#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*/ closeJetduino();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ jet_sleep(int);
int openJetduino();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = 0;
  int j = 0;
  int pin = 4;
  if (openJetduino() == -1)
    exit(1);
  for (j = 0; j < 2000; j++) {
    for (i = 0; i < 255; i++) {
      printf("%d\n", i);
      analogWrite(pin, i);
      jet_sleep(50);
    }
  }
  closeJetduino();
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    $0x0,%al
call   1040 <openJetduino@plt>
cmp    $0xffffffff,%eax
jne    119e <main+0x3e>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x7d0,-0xc(%rbp)
jge    120b <main+0xab>
movl   $0x0,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jge    11f8 <main+0x98>
mov    -0x8(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <analogWrite@plt>
mov    $0x32,%edi
call   1080 <jet_sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b9 <main+0x59>
jmp    11fd <main+0x9d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a5 <main+0x45>
mov    $0x0,%al
call   1060 <closeJetduino@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <openJetduino@plt>
cmp    $0xffffffff,%eax
je     11d9 <main+0x79>
lea    0xe86(%rip),%rbx
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    $0x4,%edi
mov    %ebp,%esi
call   1050 <analogWrite@plt>
mov    $0x32,%edi
call   1080 <jet_sleep@plt>
add    $0x1,%ebp
cmp    $0xff,%ebp
jne    1190 <main+0x30>
add    $0x1,%r14d
cmp    $0x7d0,%r14d
jne    1180 <main+0x20>
xor    %eax,%eax
call   1060 <closeJetduino@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 4, i32* %4
%5 = call i32 (...) @openJetduino()
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
store i32 0, i32* %3
br label %10
10: ; preds = %28, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 2000
br i1 %12, label %13, label %31
13: ; preds = %10
store i32 0, i32* %2
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 255
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %4
%21 = load i32, i32* %2
%22 = call i32 @analogWrite(i32 %20, i32 %21)
%23 = call i32 @jet_sleep(i32 50)
br label %24
24: ; preds = %17
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %14
27: ; preds = %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %10
31: ; preds = %10
%32 = call i32 (...) @closeJetduino()
ret i32 1
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @openJetduino()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %0, %14
%6 = phi i32 [ %15, %14 ], [ 0, %0 ]
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ 0, %5 ], [ %12, %7 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @analogWrite(i32 4, i32 %8)
%11 = tail call i32 @jet_sleep(i32 50)
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, 255
br i1 %13, label %14, label %7
14: ; preds = %7
%15 = add nuw nsw i32 %6, 1
%16 = icmp eq i32 %15, 2000
br i1 %16, label %17, label %5
17: ; preds = %14
%18 = tail call i32 (...) @closeJetduino()
ret i32 1
}