#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 rc_send_servo_pulse_us(int, int);
int rc_send_servo_pulse_us_all(int us) {
  int i, ret_ch;
  int ret = 0;
  for (i = 1; i <= 8; i++) {
    ret_ch = rc_send_servo_pulse_us(i, us);
    if (ret_ch == -2)
      return -2;
    else if (ret_ch == -1)
      ret = -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<rc_send_servo_pulse_us_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jg     1180 <rc_send_servo_pulse_us_all+0x70>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <rc_send_servo_pulse_us@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xfffffffe,-0x10(%rbp)
jne    1157 <rc_send_servo_pulse_us_all+0x47>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1186 <rc_send_servo_pulse_us_all+0x76>
cmpl   $0xffffffff,-0x10(%rbp)
jne    1168 <rc_send_servo_pulse_us_all+0x58>
movl   $0xffffffff,-0x14(%rbp)
jmp    116d <rc_send_servo_pulse_us_all+0x5d>
jmp    1172 <rc_send_servo_pulse_us_all+0x62>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <rc_send_servo_pulse_us_all+0x19>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc_send_servo_pulse_us_all>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x1,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
jne    1136 <rc_send_servo_pulse_us_all+0x26>
mov    $0xffffffff,%ebx
mov    $0x2,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    1155 <rc_send_servo_pulse_us_all+0x45>
mov    $0xffffffff,%ebx
mov    $0x3,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    1174 <rc_send_servo_pulse_us_all+0x64>
mov    $0xffffffff,%ebx
mov    $0x4,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    118f <rc_send_servo_pulse_us_all+0x7f>
mov    $0xffffffff,%ebx
mov    $0x5,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    11aa <rc_send_servo_pulse_us_all+0x9a>
mov    $0xffffffff,%ebx
mov    $0x6,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    11c5 <rc_send_servo_pulse_us_all+0xb5>
mov    $0xffffffff,%ebx
mov    $0x7,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    11e0 <rc_send_servo_pulse_us_all+0xd0>
mov    $0xffffffff,%ebx
mov    $0x8,%edi
mov    %ebp,%esi
call   1030 <rc_send_servo_pulse_us@plt>
cmp    $0xfffffffe,%eax
je     11fd <rc_send_servo_pulse_us_all+0xed>
cmp    $0xffffffff,%eax
jne    11ff <rc_send_servo_pulse_us_all+0xef>
mov    $0xffffffff,%ebx
jmp    11ff <rc_send_servo_pulse_us_all+0xef>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rc_send_servo_pulse_us_all(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %6
store i32 1, i32* %4
br label %7
7: ; preds = %23, %1
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 8
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = call i32 @rc_send_servo_pulse_us(i32 %11, i32 %12)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, -2
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 -2, i32* %2
br label %28
17: ; preds = %10
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 -1, i32* %6
br label %21
21: ; preds = %20, %17
br label %22
22: ; preds = %21
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %7
26: ; preds = %7
%27 = load i32, i32* %6
store i32 %27, i32* %2
br label %28
28: ; preds = %26, %16
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @rc_send_servo_pulse_us_all(i32 %0) {
%2 = tail call i32 @rc_send_servo_pulse_us(i32 1, i32 %0)
switch i32 %2, label %4 [
i32 -2, label %34
i32 -1, label %3
]
3: ; preds = %1
br label %4
4: ; preds = %1, %3
%5 = phi i32 [ -1, %3 ], [ 0, %1 ]
%6 = tail call i32 @rc_send_servo_pulse_us(i32 2, i32 %0)
switch i32 %6, label %8 [
i32 -2, label %34
i32 -1, label %7
]
7: ; preds = %4
br label %8
8: ; preds = %7, %4
%9 = phi i32 [ -1, %7 ], [ %5, %4 ]
%10 = tail call i32 @rc_send_servo_pulse_us(i32 3, i32 %0)
switch i32 %10, label %12 [
i32 -2, label %34
i32 -1, label %11
]
11: ; preds = %8
br label %12
12: ; preds = %11, %8
%13 = phi i32 [ -1, %11 ], [ %9, %8 ]
%14 = tail call i32 @rc_send_servo_pulse_us(i32 4, i32 %0)
switch i32 %14, label %16 [
i32 -2, label %34
i32 -1, label %15
]
15: ; preds = %12
br label %16
16: ; preds = %15, %12
%17 = phi i32 [ -1, %15 ], [ %13, %12 ]
%18 = tail call i32 @rc_send_servo_pulse_us(i32 5, i32 %0)
switch i32 %18, label %20 [
i32 -2, label %34
i32 -1, label %19
]
19: ; preds = %16
br label %20
20: ; preds = %19, %16
%21 = phi i32 [ -1, %19 ], [ %17, %16 ]
%22 = tail call i32 @rc_send_servo_pulse_us(i32 6, i32 %0)
switch i32 %22, label %24 [
i32 -2, label %34
i32 -1, label %23
]
23: ; preds = %20
br label %24
24: ; preds = %23, %20
%25 = phi i32 [ -1, %23 ], [ %21, %20 ]
%26 = tail call i32 @rc_send_servo_pulse_us(i32 7, i32 %0)
switch i32 %26, label %28 [
i32 -2, label %34
i32 -1, label %27
]
27: ; preds = %24
br label %28
28: ; preds = %27, %24
%29 = phi i32 [ -1, %27 ], [ %25, %24 ]
%30 = tail call i32 @rc_send_servo_pulse_us(i32 8, i32 %0)
switch i32 %30, label %32 [
i32 -2, label %34
i32 -1, label %31
]
31: ; preds = %28
br label %32
32: ; preds = %31, %28
%33 = phi i32 [ -1, %31 ], [ %29, %28 ]
br label %34
34: ; preds = %32, %28, %24, %20, %16, %12, %8, %4, %1
%35 = phi i32 [ %2, %1 ], [ %6, %4 ], [ %10, %8 ], [ %14, %12 ], [ %18, %16 ], [ %22, %20 ], [ %26, %24 ], [ %30, %28 ], [ %33, %32 ]
ret i32 %35
}