#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*/ calcP();
int /*<<< orphan*/ checkWallAhead();
int get_front_ir_dist(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ set_motors(int, int);
void lookForFront() {
  if (get_front_ir_dist(1) < 30) {
    while (get_front_ir_dist(1) < 30) {
      set_motors(50, -50);
      printf(" FRONT FR%d\n", get_front_ir_dist(1));
      checkWallAhead();
      calcP();
    }
  }
}


x86 assembly (clang, -O0):
<lookForFront>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
cmp    $0x1e,%eax
jge    11be <lookForFront+0x6e>
jmp    116c <lookForFront+0x1c>
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
cmp    $0x1e,%eax
jge    11b9 <lookForFront+0x69>
mov    $0x32,%edi
mov    $0xffffffce,%esi
call   1060 <set_motors@plt>
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
mov    %eax,%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <checkWallAhead@plt>
mov    $0x0,%al
call   1070 <calcP@plt>
jmp    116c <lookForFront+0x1c>
jmp    11be <lookForFront+0x6e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookForFront>:
push   %rbx
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
cmp    $0x1d,%eax
jg     11c0 <lookForFront+0x70>
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
cmp    $0x1d,%eax
jg     11c0 <lookForFront+0x70>
lea    0xe8a(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    $0x32,%edi
mov    $0xffffffce,%esi
call   1060 <set_motors@plt>
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <checkWallAhead@plt>
xor    %eax,%eax
call   1070 <calcP@plt>
mov    $0x1,%edi
call   1050 <get_front_ir_dist@plt>
cmp    $0x1e,%eax
jl     1180 <lookForFront+0x30>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c" FRONT FR%d\0A\00"
define void @lookForFront() {
%1 = call i32 @get_front_ir_dist(i32 1)
%2 = icmp slt i32 %1, 30
br i1 %2, label %3, label %14
3: ; preds = %0
br label %4
4: ; preds = %7, %3
%5 = call i32 @get_front_ir_dist(i32 1)
%6 = icmp slt i32 %5, 30
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = call i32 @set_motors(i32 50, i32 -50)
%9 = call i32 @get_front_ir_dist(i32 1)
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @checkWallAhead()
%12 = call i32 (...) @calcP()
br label %4
13: ; preds = %4
br label %14
14: ; preds = %13, %0
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c" FRONT FR%d\0A\00"
define void @lookForFront() {
%1 = tail call i32 @get_front_ir_dist(i32 1)
%2 = icmp slt i32 %1, 30
br i1 %2, label %3, label %14
3: ; preds = %0
%4 = tail call i32 @get_front_ir_dist(i32 1)
%5 = icmp slt i32 %4, 30
br i1 %5, label %6, label %14
6: ; preds = %3, %6
%7 = tail call i32 @set_motors(i32 50, i32 -50)
%8 = tail call i32 @get_front_ir_dist(i32 1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @checkWallAhead()
%11 = tail call i32 (...) @calcP()
%12 = tail call i32 @get_front_ir_dist(i32 1)
%13 = icmp slt i32 %12, 30
br i1 %13, label %6, label %14
14: ; preds = %6, %3, %0
ret void
}