#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*/ enterElevator(int);
int getDestination(int);
int isPersonOnFloor(int, int);
int /*<<< orphan*/ pressInLiftFloorButton(int);
int /*<<< orphan*/ removePersonFromFloor(int, int);
int /*<<< orphan*/ resetCallOnFloor(int);
void processWaitingOnFloor(int floorID) {
  int tmp;
  int tmp___0;
  int tmp___1;
  int tmp___2;
  int tmp___3;
  int tmp___4;
  int tmp___5;
  int tmp___6;
  int tmp___7;
  int tmp___8;
  int tmp___9;
  int tmp___10;
  {
    { tmp___0 = isPersonOnFloor(0, floorID); }
    if (tmp___0) {
      {
        removePersonFromFloor(0, floorID);
        tmp = getDestination(0);
        pressInLiftFloorButton(tmp);
        enterElevator(0);
      }
    } else {
    }
    { tmp___2 = isPersonOnFloor(1, floorID); }
    if (tmp___2) {
      {
        removePersonFromFloor(1, floorID);
        tmp___1 = getDestination(1);
        pressInLiftFloorButton(tmp___1);
        enterElevator(1);
      }
    } else {
    }
    { tmp___4 = isPersonOnFloor(2, floorID); }
    if (tmp___4) {
      {
        removePersonFromFloor(2, floorID);
        tmp___3 = getDestination(2);
        pressInLiftFloorButton(tmp___3);
        enterElevator(2);
      }
    } else {
    }
    { tmp___6 = isPersonOnFloor(3, floorID); }
    if (tmp___6) {
      {
        removePersonFromFloor(3, floorID);
        tmp___5 = getDestination(3);
        pressInLiftFloorButton(tmp___5);
        enterElevator(3);
      }
    } else {
    }
    { tmp___8 = isPersonOnFloor(4, floorID); }
    if (tmp___8) {
      {
        removePersonFromFloor(4, floorID);
        tmp___7 = getDestination(4);
        pressInLiftFloorButton(tmp___7);
        enterElevator(4);
      }
    } else {
    }
    { tmp___10 = isPersonOnFloor(5, floorID); }
    if (tmp___10) {
      {
        removePersonFromFloor(5, floorID);
        tmp___9 = getDestination(5);
        pressInLiftFloorButton(tmp___9);
        enterElevator(5);
      }
    } else {
    }
    { resetCallOnFloor(floorID); }
    return;
  }
}


x86 assembly (clang, -O0):
<processWaitingOnFloor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1040 <isPersonOnFloor@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11aa <processWaitingOnFloor+0x4a>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1080 <removePersonFromFloor@plt>
xor    %edi,%edi
call   1060 <getDestination@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <pressInLiftFloorButton@plt>
xor    %edi,%edi
call   1050 <enterElevator@plt>
jmp    11af <processWaitingOnFloor+0x4f>
jmp    11af <processWaitingOnFloor+0x4f>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1040 <isPersonOnFloor@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11fa <processWaitingOnFloor+0x9a>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1080 <removePersonFromFloor@plt>
mov    $0x1,%edi
call   1060 <getDestination@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x1,%edi
call   1050 <enterElevator@plt>
jmp    11ff <processWaitingOnFloor+0x9f>
jmp    11ff <processWaitingOnFloor+0x9f>
mov    -0x4(%rbp),%esi
mov    $0x2,%edi
call   1040 <isPersonOnFloor@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     124a <processWaitingOnFloor+0xea>
mov    -0x4(%rbp),%esi
mov    $0x2,%edi
call   1080 <removePersonFromFloor@plt>
mov    $0x2,%edi
call   1060 <getDestination@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x2,%edi
call   1050 <enterElevator@plt>
jmp    124f <processWaitingOnFloor+0xef>
jmp    124f <processWaitingOnFloor+0xef>
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
call   1040 <isPersonOnFloor@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     129a <processWaitingOnFloor+0x13a>
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
call   1080 <removePersonFromFloor@plt>
mov    $0x3,%edi
call   1060 <getDestination@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x3,%edi
call   1050 <enterElevator@plt>
jmp    129f <processWaitingOnFloor+0x13f>
jmp    129f <processWaitingOnFloor+0x13f>
mov    -0x4(%rbp),%esi
mov    $0x4,%edi
call   1040 <isPersonOnFloor@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     12ea <processWaitingOnFloor+0x18a>
mov    -0x4(%rbp),%esi
mov    $0x4,%edi
call   1080 <removePersonFromFloor@plt>
mov    $0x4,%edi
call   1060 <getDestination@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x4,%edi
call   1050 <enterElevator@plt>
jmp    12ef <processWaitingOnFloor+0x18f>
jmp    12ef <processWaitingOnFloor+0x18f>
mov    -0x4(%rbp),%esi
mov    $0x5,%edi
call   1040 <isPersonOnFloor@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     133a <processWaitingOnFloor+0x1da>
mov    -0x4(%rbp),%esi
mov    $0x5,%edi
call   1080 <removePersonFromFloor@plt>
mov    $0x5,%edi
call   1060 <getDestination@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x5,%edi
call   1050 <enterElevator@plt>
jmp    133f <processWaitingOnFloor+0x1df>
jmp    133f <processWaitingOnFloor+0x1df>
mov    -0x4(%rbp),%edi
call   1070 <resetCallOnFloor@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processWaitingOnFloor>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
mov    %ebx,%esi
call   1040 <isPersonOnFloor@plt>
test   %eax,%eax
je     118e <processWaitingOnFloor+0x2e>
xor    %edi,%edi
mov    %ebx,%esi
call   1080 <removePersonFromFloor@plt>
xor    %edi,%edi
call   1060 <getDestination@plt>
mov    %eax,%edi
call   1030 <pressInLiftFloorButton@plt>
xor    %edi,%edi
call   1050 <enterElevator@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <isPersonOnFloor@plt>
test   %eax,%eax
je     11c5 <processWaitingOnFloor+0x65>
mov    $0x1,%edi
mov    %ebx,%esi
call   1080 <removePersonFromFloor@plt>
mov    $0x1,%edi
call   1060 <getDestination@plt>
mov    %eax,%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x1,%edi
call   1050 <enterElevator@plt>
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <isPersonOnFloor@plt>
test   %eax,%eax
je     11fc <processWaitingOnFloor+0x9c>
mov    $0x2,%edi
mov    %ebx,%esi
call   1080 <removePersonFromFloor@plt>
mov    $0x2,%edi
call   1060 <getDestination@plt>
mov    %eax,%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x2,%edi
call   1050 <enterElevator@plt>
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <isPersonOnFloor@plt>
test   %eax,%eax
je     1233 <processWaitingOnFloor+0xd3>
mov    $0x3,%edi
mov    %ebx,%esi
call   1080 <removePersonFromFloor@plt>
mov    $0x3,%edi
call   1060 <getDestination@plt>
mov    %eax,%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x3,%edi
call   1050 <enterElevator@plt>
mov    $0x4,%edi
mov    %ebx,%esi
call   1040 <isPersonOnFloor@plt>
test   %eax,%eax
je     126a <processWaitingOnFloor+0x10a>
mov    $0x4,%edi
mov    %ebx,%esi
call   1080 <removePersonFromFloor@plt>
mov    $0x4,%edi
call   1060 <getDestination@plt>
mov    %eax,%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x4,%edi
call   1050 <enterElevator@plt>
mov    $0x5,%edi
mov    %ebx,%esi
call   1040 <isPersonOnFloor@plt>
test   %eax,%eax
je     12a1 <processWaitingOnFloor+0x141>
mov    $0x5,%edi
mov    %ebx,%esi
call   1080 <removePersonFromFloor@plt>
mov    $0x5,%edi
call   1060 <getDestination@plt>
mov    %eax,%edi
call   1030 <pressInLiftFloorButton@plt>
mov    $0x5,%edi
call   1050 <enterElevator@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1070 <resetCallOnFloor@plt>

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

LLVM IR (-O2):
define void @processWaitingOnFloor(i32 %0) {
%2 = tail call i32 @isPersonOnFloor(i32 0, i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @removePersonFromFloor(i32 0, i32 %0)
%6 = tail call i32 @getDestination(i32 0)
%7 = tail call i32 @pressInLiftFloorButton(i32 %6)
%8 = tail call i32 @enterElevator(i32 0)
br label %9
9: ; preds = %1, %4
%10 = tail call i32 @isPersonOnFloor(i32 1, i32 %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = tail call i32 @removePersonFromFloor(i32 1, i32 %0)
%14 = tail call i32 @getDestination(i32 1)
%15 = tail call i32 @pressInLiftFloorButton(i32 %14)
%16 = tail call i32 @enterElevator(i32 1)
br label %17
17: ; preds = %9, %12
%18 = tail call i32 @isPersonOnFloor(i32 2, i32 %0)
%19 = icmp eq i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %17
%21 = tail call i32 @removePersonFromFloor(i32 2, i32 %0)
%22 = tail call i32 @getDestination(i32 2)
%23 = tail call i32 @pressInLiftFloorButton(i32 %22)
%24 = tail call i32 @enterElevator(i32 2)
br label %25
25: ; preds = %17, %20
%26 = tail call i32 @isPersonOnFloor(i32 3, i32 %0)
%27 = icmp eq i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %25
%29 = tail call i32 @removePersonFromFloor(i32 3, i32 %0)
%30 = tail call i32 @getDestination(i32 3)
%31 = tail call i32 @pressInLiftFloorButton(i32 %30)
%32 = tail call i32 @enterElevator(i32 3)
br label %33
33: ; preds = %25, %28
%34 = tail call i32 @isPersonOnFloor(i32 4, i32 %0)
%35 = icmp eq i32 %34, 0
br i1 %35, label %41, label %36
36: ; preds = %33
%37 = tail call i32 @removePersonFromFloor(i32 4, i32 %0)
%38 = tail call i32 @getDestination(i32 4)
%39 = tail call i32 @pressInLiftFloorButton(i32 %38)
%40 = tail call i32 @enterElevator(i32 4)
br label %41
41: ; preds = %33, %36
%42 = tail call i32 @isPersonOnFloor(i32 5, i32 %0)
%43 = icmp eq i32 %42, 0
br i1 %43, label %49, label %44
44: ; preds = %41
%45 = tail call i32 @removePersonFromFloor(i32 5, i32 %0)
%46 = tail call i32 @getDestination(i32 5)
%47 = tail call i32 @pressInLiftFloorButton(i32 %46)
%48 = tail call i32 @enterElevator(i32 5)
br label %49
49: ; preds = %41, %44
%50 = tail call i32 @resetCallOnFloor(i32 %0)
ret void
}