#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*/ camera_update();
int get_object_area(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ get_object_count(int /*<<< orphan*/);
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ printf(char *, int);
int identColor() {
  int area, i;
  camera_update();
  msleep(150);
  for (i = 0; i <= 2; i++) {
    if (get_object_count(0) > 0) {
      area = get_object_area(0, 0);
      printf("Area reading:%d\n", area);
      return area;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<identColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <camera_update@plt>
mov    $0x96,%edi
call   1040 <msleep@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     11c4 <identColor+0x74>
xor    %edi,%edi
call   1060 <get_object_count@plt>
cmp    $0x0,%rax
jle    11b1 <identColor+0x61>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <get_object_area@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <identColor+0x7b>
jmp    11b6 <identColor+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <identColor+0x20>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identColor>:
push   %rbx
xor    %eax,%eax
call   1030 <camera_update@plt>
mov    $0x96,%edi
call   1040 <msleep@plt>
xor    %edi,%edi
call   1060 <get_object_count@plt>
test   %rax,%rax
jg     1186 <identColor+0x36>
xor    %edi,%edi
call   1060 <get_object_count@plt>
test   %rax,%rax
jg     1186 <identColor+0x36>
xor    %edi,%edi
call   1060 <get_object_count@plt>
test   %rax,%rax
jle    11a3 <identColor+0x53>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <get_object_area@plt>
mov    %eax,%ebx
lea    0xe68(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    $0xffffffff,%ebx
jmp    119f <identColor+0x4f>

LLVM IR (-O0):
@.str = [17 x i8] c"Area reading:%d\0A\00"
define i32 @identColor() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @camera_update()
%5 = call i32 @msleep(i32 150)
store i32 0, i32* %3
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 2
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = call i64 @get_object_count(i32 0)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i32 @get_object_area(i32 0, i32 0)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %2
store i32 %16, i32* %1
br label %22
17: ; preds = %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %6
21: ; preds = %6
store i32 -1, i32* %1
br label %22
22: ; preds = %21, %12
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [17 x i8] c"Area reading:%d\0A\00"
define i32 @identColor() {
%1 = tail call i32 (...) @camera_update()
%2 = tail call i32 @msleep(i32 150)
%3 = tail call i64 @get_object_count(i32 0)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %0
%6 = tail call i64 @get_object_count(i32 0)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i64 @get_object_count(i32 0)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8, %5, %0
%12 = tail call i32 @get_object_area(i32 0, i32 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %8, %11
%15 = phi i32 [ %12, %11 ], [ -1, %8 ]
ret i32 %15
}