#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 adcspi_get_output(int /*<<< orphan*/, int);
int /*<<< orphan*/ recharger_act(int, int, int);
void recharger_act_avoid(int x, int y, int theta) {
  int i;
  int baseX, baseY, baseTheta;
  char hasAvoid = 0;
  baseX = x;
  baseY = y;
  baseTheta = theta;
  x = y = theta = 0;
  if (adcspi_get_output(0, 0) > (230 * 4)) {
    x += (-20 + 5);
    y += 0;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 1) > (230 * 4)) {
    x += (-20 + 5);
    y += (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 2) > (230 * 4)) {
    x += 0;
    y += (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 3) > (230 * 4)) {
    x += 0;
    y += (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 4) > (230 * 4)) {
    x += 0;
    y -= (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 5) > (230 * 4)) {
    x += 0;
    y -= (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 6) > (230 * 4)) {
    x += (-20 + 5);
    y -= (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 7) > (230 * 4)) {
    theta += (4);
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 8) > (230 * 4)) {
    theta += (4);
    hasAvoid = 1;
  }
  if (adcspi_get_output(0, 9) > (230 * 4)) {
    x -= (-20 + 5) / 2;
    y -= (-20 + 5) / 2;
    hasAvoid = 1;
  }
  if (!hasAvoid) {
    x = baseX;
    y = baseY;
    theta = baseTheta;
  }
  recharger_act(x, y, theta);
}


x86 assembly (clang, -O0):
<recharger_act_avoid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movb   $0x0,-0x1d(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    1186 <recharger_act_avoid+0x66>
mov    -0x4(%rbp),%eax
add    $0xfffffff1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    11b3 <recharger_act_avoid+0x93>
mov    -0x4(%rbp),%eax
add    $0xfffffff1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x2,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    11e0 <recharger_act_avoid+0xc0>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x3,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    120d <recharger_act_avoid+0xed>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x4,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    123a <recharger_act_avoid+0x11a>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x5,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    1267 <recharger_act_avoid+0x147>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x6,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    1294 <recharger_act_avoid+0x174>
mov    -0x4(%rbp),%eax
add    $0xfffffff1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x7,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    12b8 <recharger_act_avoid+0x198>
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    12dc <recharger_act_avoid+0x1bc>
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
movb   $0x1,-0x1d(%rbp)
xor    %edi,%edi
mov    $0x9,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x398,%eax
jle    1309 <recharger_act_avoid+0x1e9>
mov    -0x4(%rbp),%eax
sub    $0xfffffff9,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xfffffff9,%eax
mov    %eax,-0x8(%rbp)
movb   $0x1,-0x1d(%rbp)
cmpb   $0x0,-0x1d(%rbp)
jne    1325 <recharger_act_avoid+0x205>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <recharger_act@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recharger_act_avoid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,0x10(%rsp)
mov    %edi,0x14(%rsp)
xor    %r14d,%r14d
xor    %edi,%edi
xor    %esi,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x399,%eax
setge  0x7(%rsp)
mov    $0xfffffff1,%ebp
cmovl  %r14d,%ebp
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <adcspi_get_output@plt>
lea    -0xf(%rbp),%ecx
cmp    $0x399,%eax
setge  0x6(%rsp)
mov    $0xfffffff9,%ebx
cmovl  %r14d,%ebx
cmovl  %ebp,%ecx
mov    %rcx,%r14
xor    %edi,%edi
mov    $0x2,%esi
call   1040 <adcspi_get_output@plt>
lea    -0x7(%rbx),%ebp
cmp    $0x399,%eax
setge  %r12b
cmovl  %ebx,%ebp
xor    %edi,%edi
mov    $0x3,%esi
call   1040 <adcspi_get_output@plt>
lea    -0x7(%rbp),%ebx
cmp    $0x399,%eax
setge  0x5(%rsp)
cmovl  %ebp,%ebx
xor    %edi,%edi
mov    $0x4,%esi
call   1040 <adcspi_get_output@plt>
lea    0x7(%rbx),%ebp
cmp    $0x399,%eax
setge  0x4(%rsp)
cmovl  %ebx,%ebp
xor    %edi,%edi
mov    $0x5,%esi
call   1040 <adcspi_get_output@plt>
lea    0x7(%rbp),%ebx
cmp    $0x399,%eax
setge  %r15b
cmovl  %ebp,%ebx
xor    %edi,%edi
mov    $0x6,%esi
call   1040 <adcspi_get_output@plt>
mov    %r14,%rcx
lea    -0xf(%r14),%r13d
lea    0x7(%rbx),%r14d
cmp    $0x399,%eax
setge  0x3(%rsp)
cmovl  %ebx,%r14d
cmovl  %ecx,%r13d
xor    %edi,%edi
mov    $0x7,%esi
call   1040 <adcspi_get_output@plt>
xor    %ebp,%ebp
cmp    $0x399,%eax
setge  %bpl
lea    0x0(,%rbp,4),%eax
mov    %eax,0x8(%rsp)
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <adcspi_get_output@plt>
cmp    $0x399,%eax
setge  0x2(%rsp)
lea    0x4(,%rbp,4),%ebx
cmovl  0x8(%rsp),%ebx
xor    %edi,%edi
mov    $0x9,%esi
call   1040 <adcspi_get_output@plt>
lea    0x7(%r13),%edi
lea    0x7(%r14),%esi
cmp    $0x399,%eax
setge  %al
cmovl  %r14d,%esi
cmovl  %r13d,%edi
or     0x2(%rsp),%al
or     0x3(%rsp),%bpl
or     %al,%bpl
or     0x4(%rsp),%r15b
or     0x5(%rsp),%r15b
or     %bpl,%r15b
or     0x6(%rsp),%r12b
or     0x7(%rsp),%r12b
or     %r15b,%r12b
test   $0x1,%r12b
mov    0xc(%rsp),%edx
cmovne %ebx,%edx
cmove  0x10(%rsp),%esi
cmove  0x14(%rsp),%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <recharger_act@plt>

LLVM IR (-O0):
define void @recharger_act_avoid(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i8 0, i8* %11
%12 = load i32, i32* %4
store i32 %12, i32* %8
%13 = load i32, i32* %5
store i32 %13, i32* %9
%14 = load i32, i32* %6
store i32 %14, i32* %10
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
%15 = call i32 @adcspi_get_output(i32 0, i32 0)
%16 = icmp sgt i32 %15, 920
br i1 %16, label %17, label %22
17: ; preds = %3
%18 = load i32, i32* %4
%19 = add nsw i32 %18, -15
store i32 %19, i32* %4
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 0
store i32 %21, i32* %5
store i8 1, i8* %11
br label %22
22: ; preds = %17, %3
%23 = call i32 @adcspi_get_output(i32 0, i32 1)
%24 = icmp sgt i32 %23, 920
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i32, i32* %4
%27 = add nsw i32 %26, -15
store i32 %27, i32* %4
%28 = load i32, i32* %5
%29 = add nsw i32 %28, -7
store i32 %29, i32* %5
store i8 1, i8* %11
br label %30
30: ; preds = %25, %22
%31 = call i32 @adcspi_get_output(i32 0, i32 2)
%32 = icmp sgt i32 %31, 920
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 0
store i32 %35, i32* %4
%36 = load i32, i32* %5
%37 = add nsw i32 %36, -7
store i32 %37, i32* %5
store i8 1, i8* %11
br label %38
38: ; preds = %33, %30
%39 = call i32 @adcspi_get_output(i32 0, i32 3)
%40 = icmp sgt i32 %39, 920
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 0
store i32 %43, i32* %4
%44 = load i32, i32* %5
%45 = add nsw i32 %44, -7
store i32 %45, i32* %5
store i8 1, i8* %11
br label %46
46: ; preds = %41, %38
%47 = call i32 @adcspi_get_output(i32 0, i32 4)
%48 = icmp sgt i32 %47, 920
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 0
store i32 %51, i32* %4
%52 = load i32, i32* %5
%53 = sub nsw i32 %52, -7
store i32 %53, i32* %5
store i8 1, i8* %11
br label %54
54: ; preds = %49, %46
%55 = call i32 @adcspi_get_output(i32 0, i32 5)
%56 = icmp sgt i32 %55, 920
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 0
store i32 %59, i32* %4
%60 = load i32, i32* %5
%61 = sub nsw i32 %60, -7
store i32 %61, i32* %5
store i8 1, i8* %11
br label %62
62: ; preds = %57, %54
%63 = call i32 @adcspi_get_output(i32 0, i32 6)
%64 = icmp sgt i32 %63, 920
br i1 %64, label %65, label %70
65: ; preds = %62
%66 = load i32, i32* %4
%67 = add nsw i32 %66, -15
store i32 %67, i32* %4
%68 = load i32, i32* %5
%69 = sub nsw i32 %68, -7
store i32 %69, i32* %5
store i8 1, i8* %11
br label %70
70: ; preds = %65, %62
%71 = call i32 @adcspi_get_output(i32 0, i32 7)
%72 = icmp sgt i32 %71, 920
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 4
store i32 %75, i32* %6
store i8 1, i8* %11
br label %76
76: ; preds = %73, %70
%77 = call i32 @adcspi_get_output(i32 0, i32 8)
%78 = icmp sgt i32 %77, 920
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = load i32, i32* %6
%81 = add nsw i32 %80, 4
store i32 %81, i32* %6
store i8 1, i8* %11
br label %82
82: ; preds = %79, %76
%83 = call i32 @adcspi_get_output(i32 0, i32 9)
%84 = icmp sgt i32 %83, 920
br i1 %84, label %85, label %90
85: ; preds = %82
%86 = load i32, i32* %4
%87 = sub nsw i32 %86, -7
store i32 %87, i32* %4
%88 = load i32, i32* %5
%89 = sub nsw i32 %88, -7
store i32 %89, i32* %5
store i8 1, i8* %11
br label %90
90: ; preds = %85, %82
%91 = load i8, i8* %11
%92 = icmp ne i8 %91, 0
br i1 %92, label %97, label %93
93: ; preds = %90
%94 = load i32, i32* %8
store i32 %94, i32* %4
%95 = load i32, i32* %9
store i32 %95, i32* %5
%96 = load i32, i32* %10
store i32 %96, i32* %6
br label %97
97: ; preds = %93, %90
%98 = load i32, i32* %4
%99 = load i32, i32* %5
%100 = load i32, i32* %6
%101 = call i32 @recharger_act(i32 %98, i32 %99, i32 %100)
ret void
}

LLVM IR (-O2):
define void @recharger_act_avoid(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @adcspi_get_output(i32 0, i32 0)
%5 = icmp sgt i32 %4, 920
%6 = select i1 %5, i32 -15, i32 0
%7 = tail call i32 @adcspi_get_output(i32 0, i32 1)
%8 = icmp sgt i32 %7, 920
%9 = add nsw i32 %6, -15
%10 = select i1 %8, i32 -7, i32 0
%11 = select i1 %8, i32 %9, i32 %6
%12 = tail call i32 @adcspi_get_output(i32 0, i32 2)
%13 = icmp sgt i32 %12, 920
%14 = add nsw i32 %10, -7
%15 = select i1 %13, i32 %14, i32 %10
%16 = tail call i32 @adcspi_get_output(i32 0, i32 3)
%17 = icmp sgt i32 %16, 920
%18 = add nsw i32 %15, -7
%19 = select i1 %17, i32 %18, i32 %15
%20 = tail call i32 @adcspi_get_output(i32 0, i32 4)
%21 = icmp sgt i32 %20, 920
%22 = add nsw i32 %19, 7
%23 = select i1 %21, i32 %22, i32 %19
%24 = tail call i32 @adcspi_get_output(i32 0, i32 5)
%25 = icmp sgt i32 %24, 920
%26 = add nsw i32 %23, 7
%27 = select i1 %25, i32 %26, i32 %23
%28 = tail call i32 @adcspi_get_output(i32 0, i32 6)
%29 = icmp sgt i32 %28, 920
%30 = add nsw i32 %11, -15
%31 = add nsw i32 %27, 7
%32 = select i1 %29, i32 %31, i32 %27
%33 = select i1 %29, i32 %30, i32 %11
%34 = tail call i32 @adcspi_get_output(i32 0, i32 7)
%35 = icmp sgt i32 %34, 920
%36 = select i1 %35, i32 4, i32 0
%37 = tail call i32 @adcspi_get_output(i32 0, i32 8)
%38 = icmp sgt i32 %37, 920
%39 = add nuw nsw i32 %36, 4
%40 = select i1 %38, i32 %39, i32 %36
%41 = tail call i32 @adcspi_get_output(i32 0, i32 9)
%42 = icmp sgt i32 %41, 920
%43 = add nuw nsw i32 %33, 7
%44 = add nsw i32 %32, 7
%45 = select i1 %42, i32 %44, i32 %32
%46 = select i1 %42, i32 %43, i32 %33
%47 = select i1 %42, i1 true, i1 %38
%48 = select i1 %47, i1 true, i1 %35
%49 = select i1 %48, i1 true, i1 %29
%50 = select i1 %49, i1 true, i1 %25
%51 = select i1 %50, i1 true, i1 %21
%52 = select i1 %51, i1 true, i1 %17
%53 = select i1 %52, i1 true, i1 %13
%54 = select i1 %53, i1 true, i1 %8
%55 = select i1 %54, i1 true, i1 %5
%56 = select i1 %55, i32 %40, i32 %2
%57 = select i1 %55, i32 %45, i32 %1
%58 = select i1 %55, i32 %46, i32 %0
%59 = tail call i32 @recharger_act(i32 %58, i32 %57, i32 %56)
ret void
}