#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 abs(int);
int /*<<< orphan*/ calcP();
int /*<<< orphan*/ checkWallAhead();
int get_front_ir_dist(int /*<<< orphan*/);
int get_side_ir_dist(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ set_motors(int, int);
void adjustSide() {
  if (abs(get_front_ir_dist(0) - 25) > 5 && abs(get_side_ir_dist(0) - 25) > 5) {
    if (get_front_ir_dist(0) - 25 < 0 && get_side_ir_dist(0) - 25 < 0) {
      while (abs(get_front_ir_dist(0) - 25) > 5 &&
             abs(get_side_ir_dist(0) - 25) > 5) {
        set_motors(50, 30);
        printf(" SIDE OUT %d %d\n", get_side_ir_dist(0), get_front_ir_dist(0));
        checkWallAhead();
        calcP();
      }
    }
    if (get_front_ir_dist(0) - 25 > 0 && get_side_ir_dist(0) - 25 > 0) {
      while (abs(get_front_ir_dist(0) - 25) > 5 &&
             abs(get_side_ir_dist(0) - 25) > 5) {
        set_motors(30, 50);
        printf(" SIDE IN %d %d\n", get_side_ir_dist(0), get_front_ir_dist(0));
        checkWallAhead();
        calcP();
      }
    }
  }
}


x86 assembly (clang, -O0):
<adjustSide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
mov    %eax,%edi
sub    $0x19,%edi
call   1030 <abs@plt>
cmp    $0x5,%eax
jle    132f <adjustSide+0x1bf>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
mov    %eax,%edi
sub    $0x19,%edi
call   1030 <abs@plt>
cmp    $0x5,%eax
jle    132f <adjustSide+0x1bf>
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
sub    $0x19,%eax
cmp    $0x0,%eax
jge    126b <adjustSide+0xfb>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
sub    $0x19,%eax
cmp    $0x0,%eax
jge    126b <adjustSide+0xfb>
jmp    11d7 <adjustSide+0x67>
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
mov    %eax,%edi
sub    $0x19,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
mov    %al,-0x1(%rbp)
jle    1212 <adjustSide+0xa2>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
mov    %eax,%edi
sub    $0x19,%edi
call   1030 <abs@plt>
cmp    $0x5,%eax
setg   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
test   $0x1,%al
jne    1222 <adjustSide+0xb2>
jmp    1266 <adjustSide+0xf6>
mov    $0x32,%edi
mov    $0x1e,%esi
call   1080 <set_motors@plt>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xdb2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <checkWallAhead@plt>
mov    $0x0,%al
call   1090 <calcP@plt>
jmp    11d7 <adjustSide+0x67>
jmp    126b <adjustSide+0xfb>
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
sub    $0x19,%eax
cmp    $0x0,%eax
jle    132a <adjustSide+0x1ba>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
sub    $0x19,%eax
cmp    $0x0,%eax
jle    132a <adjustSide+0x1ba>
jmp    1296 <adjustSide+0x126>
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
mov    %eax,%edi
sub    $0x19,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
mov    %al,-0x9(%rbp)
jle    12d1 <adjustSide+0x161>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
mov    %eax,%edi
sub    $0x19,%edi
call   1030 <abs@plt>
cmp    $0x5,%eax
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    12e1 <adjustSide+0x171>
jmp    1325 <adjustSide+0x1b5>
mov    $0x1e,%edi
mov    $0x32,%esi
call   1080 <set_motors@plt>
xor    %edi,%edi
call   1050 <get_side_ir_dist@plt>
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
call   1070 <get_front_ir_dist@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xd04(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <checkWallAhead@plt>
mov    $0x0,%al
call   1090 <calcP@plt>
jmp    1296 <adjustSide+0x126>
jmp    132a <adjustSide+0x1ba>
jmp    132f <adjustSide+0x1bf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjustSide>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x6,%edx
jl     12fd <adjustSide+0x19d>
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x6,%edx
jl     12fd <adjustSide+0x19d>
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
cmp    $0x18,%eax
jg     124d <adjustSide+0xed>
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
cmp    $0x18,%eax
jg     124d <adjustSide+0xed>
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x6,%edx
jl     124d <adjustSide+0xed>
lea    0xe20(%rip),%rbx
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x6,%edx
jl     124d <adjustSide+0xed>
mov    $0x32,%edi
mov    $0x1e,%esi
call   1070 <set_motors@plt>
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <checkWallAhead@plt>
xor    %eax,%eax
call   1080 <calcP@plt>
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x5,%edx
jg     11e0 <adjustSide+0x80>
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
cmp    $0x1a,%eax
jl     12fd <adjustSide+0x19d>
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
cmp    $0x1a,%eax
jl     12fd <adjustSide+0x19d>
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x6,%edx
jl     12fd <adjustSide+0x19d>
lea    0xd83(%rip),%rbx
xchg   %ax,%ax
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x6,%edx
jl     12fd <adjustSide+0x19d>
mov    $0x1e,%edi
mov    $0x32,%esi
call   1070 <set_motors@plt>
xor    %edi,%edi
call   1040 <get_side_ir_dist@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <checkWallAhead@plt>
xor    %eax,%eax
call   1080 <calcP@plt>
xor    %edi,%edi
call   1060 <get_front_ir_dist@plt>
lea    -0x19(%rax),%ecx
lea    -0x19(%rax),%edx
neg    %edx
cmp    $0x19,%eax
cmovge %ecx,%edx
cmp    $0x5,%edx
jg     1290 <adjustSide+0x130>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c" SIDE OUT %d %d\0A\00"
@.str.1 = [16 x i8] c" SIDE IN %d %d\0A\00"
define void @adjustSide() {
%1 = call i32 @get_front_ir_dist(i32 0)
%2 = sub nsw i32 %1, 25
%3 = call i32 @abs(i32 %2)
%4 = icmp sgt i32 %3, 5
br i1 %4, label %5, label %69
5: ; preds = %0
%6 = call i32 @get_side_ir_dist(i32 0)
%7 = sub nsw i32 %6, 25
%8 = call i32 @abs(i32 %7)
%9 = icmp sgt i32 %8, 5
br i1 %9, label %10, label %69
10: ; preds = %5
%11 = call i32 @get_front_ir_dist(i32 0)
%12 = sub nsw i32 %11, 25
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = call i32 @get_side_ir_dist(i32 0)
%16 = sub nsw i32 %15, 25
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %39
18: ; preds = %14
br label %19
19: ; preds = %31, %18
%20 = call i32 @get_front_ir_dist(i32 0)
%21 = sub nsw i32 %20, 25
%22 = call i32 @abs(i32 %21)
%23 = icmp sgt i32 %22, 5
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = call i32 @get_side_ir_dist(i32 0)
%26 = sub nsw i32 %25, 25
%27 = call i32 @abs(i32 %26)
%28 = icmp sgt i32 %27, 5
br label %29
29: ; preds = %24, %19
%30 = phi i1 [ false, %19 ], [ %28, %24 ]
br i1 %30, label %31, label %38
31: ; preds = %29
%32 = call i32 @set_motors(i32 50, i32 30)
%33 = call i32 @get_side_ir_dist(i32 0)
%34 = call i32 @get_front_ir_dist(i32 0)
%35 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34)
%36 = call i32 (...) @checkWallAhead()
%37 = call i32 (...) @calcP()
br label %19
38: ; preds = %29
br label %39
39: ; preds = %38, %14, %10
%40 = call i32 @get_front_ir_dist(i32 0)
%41 = sub nsw i32 %40, 25
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %68
43: ; preds = %39
%44 = call i32 @get_side_ir_dist(i32 0)
%45 = sub nsw i32 %44, 25
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %68
47: ; preds = %43
br label %48
48: ; preds = %60, %47
%49 = call i32 @get_front_ir_dist(i32 0)
%50 = sub nsw i32 %49, 25
%51 = call i32 @abs(i32 %50)
%52 = icmp sgt i32 %51, 5
br i1 %52, label %53, label %58
53: ; preds = %48
%54 = call i32 @get_side_ir_dist(i32 0)
%55 = sub nsw i32 %54, 25
%56 = call i32 @abs(i32 %55)
%57 = icmp sgt i32 %56, 5
br label %58
58: ; preds = %53, %48
%59 = phi i1 [ false, %48 ], [ %57, %53 ]
br i1 %59, label %60, label %67
60: ; preds = %58
%61 = call i32 @set_motors(i32 30, i32 50)
%62 = call i32 @get_side_ir_dist(i32 0)
%63 = call i32 @get_front_ir_dist(i32 0)
%64 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %62, i32 %63)
%65 = call i32 (...) @checkWallAhead()
%66 = call i32 (...) @calcP()
br label %48
67: ; preds = %58
br label %68
68: ; preds = %67, %43, %39
br label %69
69: ; preds = %68, %5, %0
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c" SIDE OUT %d %d\0A\00"
@.str.1 = [16 x i8] c" SIDE IN %d %d\0A\00"
define void @adjustSide() {
%1 = tail call i32 @get_front_ir_dist(i32 0)
%2 = add nsw i32 %1, -25
%3 = icmp slt i32 %1, 25
%4 = sub i32 25, %1
%5 = select i1 %3, i32 %4, i32 %2
%6 = icmp sgt i32 %5, 5
br i1 %6, label %7, label %80
7: ; preds = %0
%8 = tail call i32 @get_side_ir_dist(i32 0)
%9 = add nsw i32 %8, -25
%10 = icmp slt i32 %8, 25
%11 = sub i32 25, %8
%12 = select i1 %10, i32 %11, i32 %9
%13 = icmp sgt i32 %12, 5
br i1 %13, label %14, label %80
14: ; preds = %7
%15 = tail call i32 @get_front_ir_dist(i32 0)
%16 = icmp slt i32 %15, 25
br i1 %16, label %17, label %47
17: ; preds = %14
%18 = tail call i32 @get_side_ir_dist(i32 0)
%19 = icmp slt i32 %18, 25
br i1 %19, label %20, label %47
20: ; preds = %17
%21 = tail call i32 @get_front_ir_dist(i32 0)
%22 = add nsw i32 %21, -25
%23 = icmp slt i32 %21, 25
%24 = sub i32 25, %21
%25 = select i1 %23, i32 %24, i32 %22
%26 = icmp sgt i32 %25, 5
br i1 %26, label %27, label %47
27: ; preds = %20, %34
%28 = tail call i32 @get_side_ir_dist(i32 0)
%29 = add nsw i32 %28, -25
%30 = icmp slt i32 %28, 25
%31 = sub i32 25, %28
%32 = select i1 %30, i32 %31, i32 %29
%33 = icmp sgt i32 %32, 5
br i1 %33, label %34, label %47
34: ; preds = %27
%35 = tail call i32 @set_motors(i32 50, i32 30)
%36 = tail call i32 @get_side_ir_dist(i32 0)
%37 = tail call i32 @get_front_ir_dist(i32 0)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %37)
%39 = tail call i32 (...) @checkWallAhead()
%40 = tail call i32 (...) @calcP()
%41 = tail call i32 @get_front_ir_dist(i32 0)
%42 = add nsw i32 %41, -25
%43 = icmp slt i32 %41, 25
%44 = sub i32 25, %41
%45 = select i1 %43, i32 %44, i32 %42
%46 = icmp sgt i32 %45, 5
br i1 %46, label %27, label %47
47: ; preds = %34, %27, %20, %17, %14
%48 = tail call i32 @get_front_ir_dist(i32 0)
%49 = icmp sgt i32 %48, 25
br i1 %49, label %50, label %80
50: ; preds = %47
%51 = tail call i32 @get_side_ir_dist(i32 0)
%52 = icmp sgt i32 %51, 25
br i1 %52, label %53, label %80
53: ; preds = %50
%54 = tail call i32 @get_front_ir_dist(i32 0)
%55 = add nsw i32 %54, -25
%56 = icmp slt i32 %54, 25
%57 = sub i32 25, %54
%58 = select i1 %56, i32 %57, i32 %55
%59 = icmp sgt i32 %58, 5
br i1 %59, label %60, label %80
60: ; preds = %53, %67
%61 = tail call i32 @get_side_ir_dist(i32 0)
%62 = add nsw i32 %61, -25
%63 = icmp slt i32 %61, 25
%64 = sub i32 25, %61
%65 = select i1 %63, i32 %64, i32 %62
%66 = icmp sgt i32 %65, 5
br i1 %66, label %67, label %80
67: ; preds = %60
%68 = tail call i32 @set_motors(i32 30, i32 50)
%69 = tail call i32 @get_side_ir_dist(i32 0)
%70 = tail call i32 @get_front_ir_dist(i32 0)
%71 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %69, i32 %70)
%72 = tail call i32 (...) @checkWallAhead()
%73 = tail call i32 (...) @calcP()
%74 = tail call i32 @get_front_ir_dist(i32 0)
%75 = add nsw i32 %74, -25
%76 = icmp slt i32 %74, 25
%77 = sub i32 25, %74
%78 = select i1 %76, i32 %77, i32 %75
%79 = icmp sgt i32 %78, 5
br i1 %79, label %60, label %80
80: ; preds = %60, %67, %53, %47, %50, %7, %0
ret void
}