#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 */
typedef int time_t;
struct timespec {
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int getNormalizedInput(int);
int /*<<< orphan*/ isNear(int, int, int);
int WaitMoveGoal(int a1, int a2, int a3, int a4, int a5, int timeout) {
  int b1, b2, b3, b4, b5;
  long ms;
  time_t oldTime, newTime;
  struct timespec spec;
  b1 = getNormalizedInput(0 + 11);
  b3 = getNormalizedInput(1 + 11);
  b2 = getNormalizedInput(2 + 11);
  b4 = getNormalizedInput(3 + 11);
  b5 = getNormalizedInput(4 + 11);
  clock_gettime(CLOCK_REALTIME, &spec);
  oldTime = spec.tv_sec;
  while (!isNear(a1, b1, 500) || !isNear(a2, b2, 500) || !isNear(a3, b3, 500) ||
         !isNear(a4, b4, 500) || !isNear(a5, b5, 500)) {
    b1 = getNormalizedInput(0 + 11);
    b3 = getNormalizedInput(1 + 11);
    b2 = getNormalizedInput(2 + 11);
    b4 = getNormalizedInput(3 + 11);
    b5 = getNormalizedInput(4 + 11);
    clock_gettime(CLOCK_REALTIME, &spec);
    newTime = spec.tv_sec;
    if ((newTime - oldTime) > 20)
      return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<WaitMoveGoal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    $0xb,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x20(%rbp)
mov    $0xc,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x28(%rbp)
mov    $0xd,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x24(%rbp)
mov    $0xe,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x2c(%rbp)
mov    $0xf,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x30(%rbp)
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x49(%rbp)
je     1240 <WaitMoveGoal+0x110>
mov    -0xc(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x49(%rbp)
je     1240 <WaitMoveGoal+0x110>
mov    -0x10(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x49(%rbp)
je     1240 <WaitMoveGoal+0x110>
mov    -0x14(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x49(%rbp)
je     1240 <WaitMoveGoal+0x110>
mov    -0x18(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    1250 <WaitMoveGoal+0x120>
jmp    12c9 <WaitMoveGoal+0x199>
mov    $0xb,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x20(%rbp)
mov    $0xc,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x28(%rbp)
mov    $0xd,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x24(%rbp)
mov    $0xe,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x2c(%rbp)
mov    $0xf,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,-0x30(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
sub    -0x3c(%rbp),%eax
cmp    $0x14,%eax
jle    12c4 <WaitMoveGoal+0x194>
movl   $0x0,-0x4(%rbp)
jmp    12d0 <WaitMoveGoal+0x1a0>
jmp    11a5 <WaitMoveGoal+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WaitMoveGoal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %edx,0xc(%rsp)
mov    %esi,0x10(%rsp)
mov    %edi,0x14(%rsp)
mov    $0xb,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r15d
mov    $0xc,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r14d
mov    $0xd,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%ebp
mov    $0xe,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r12d
mov    $0xf,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r13d
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%ebx
jmp    120b <WaitMoveGoal+0xdb>
nopl   0x0(%rax)
mov    $0xb,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r15d
mov    $0xc,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r14d
mov    $0xd,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%ebp
mov    $0xe,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r12d
mov    $0xf,%edi
call   1040 <getNormalizedInput@plt>
mov    %eax,%r13d
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%eax
sub    %ebx,%eax
cmp    $0x15,%eax
jge    1283 <WaitMoveGoal+0x153>
mov    0x14(%rsp),%edi
mov    %r15d,%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
test   %eax,%eax
je     11b0 <WaitMoveGoal+0x80>
mov    0x10(%rsp),%edi
mov    %ebp,%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
test   %eax,%eax
je     11b0 <WaitMoveGoal+0x80>
mov    0xc(%rsp),%edi
mov    %r14d,%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
test   %eax,%eax
je     11b0 <WaitMoveGoal+0x80>
mov    0x8(%rsp),%edi
mov    %r12d,%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
test   %eax,%eax
je     11b0 <WaitMoveGoal+0x80>
mov    0x4(%rsp),%edi
mov    %r13d,%esi
mov    $0x1f4,%edx
call   1050 <isNear@plt>
test   %eax,%eax
je     11b0 <WaitMoveGoal+0x80>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @WaitMoveGoal(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i64
%20 = alloca i32
%21 = alloca i32
%22 = alloca %struct.timespec
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%23 = call i32 @getNormalizedInput(i32 11)
store i32 %23, i32* %14
%24 = call i32 @getNormalizedInput(i32 12)
store i32 %24, i32* %16
%25 = call i32 @getNormalizedInput(i32 13)
store i32 %25, i32* %15
%26 = call i32 @getNormalizedInput(i32 14)
store i32 %26, i32* %17
%27 = call i32 @getNormalizedInput(i32 15)
store i32 %27, i32* %18
%28 = load i32, i32* @CLOCK_REALTIME
%29 = call i32 @clock_gettime(i32 %28, %struct.timespec* %22)
%30 = getelementptr inbounds %struct.timespec, %struct.timespec* %22, i32 0, i32 0
%31 = load i32, i32* %30
store i32 %31, i32* %20
br label %32
32: ; preds = %75, %6
%33 = load i32, i32* %8
%34 = load i32, i32* %14
%35 = call i32 @isNear(i32 %33, i32 %34, i32 500)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %58
37: ; preds = %32
%38 = load i32, i32* %9
%39 = load i32, i32* %15
%40 = call i32 @isNear(i32 %38, i32 %39, i32 500)
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %58
42: ; preds = %37
%43 = load i32, i32* %10
%44 = load i32, i32* %16
%45 = call i32 @isNear(i32 %43, i32 %44, i32 500)
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %58
47: ; preds = %42
%48 = load i32, i32* %11
%49 = load i32, i32* %17
%50 = call i32 @isNear(i32 %48, i32 %49, i32 500)
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %47
%53 = load i32, i32* %12
%54 = load i32, i32* %18
%55 = call i32 @isNear(i32 %53, i32 %54, i32 500)
%56 = icmp ne i32 %55, 0
%57 = xor i1 %56, true
br label %58
58: ; preds = %52, %47, %42, %37, %32
%59 = phi i1 [ true, %47 ], [ true, %42 ], [ true, %37 ], [ true, %32 ], [ %57, %52 ]
br i1 %59, label %60, label %76
60: ; preds = %58
%61 = call i32 @getNormalizedInput(i32 11)
store i32 %61, i32* %14
%62 = call i32 @getNormalizedInput(i32 12)
store i32 %62, i32* %16
%63 = call i32 @getNormalizedInput(i32 13)
store i32 %63, i32* %15
%64 = call i32 @getNormalizedInput(i32 14)
store i32 %64, i32* %17
%65 = call i32 @getNormalizedInput(i32 15)
store i32 %65, i32* %18
%66 = load i32, i32* @CLOCK_REALTIME
%67 = call i32 @clock_gettime(i32 %66, %struct.timespec* %22)
%68 = getelementptr inbounds %struct.timespec, %struct.timespec* %22, i32 0, i32 0
%69 = load i32, i32* %68
store i32 %69, i32* %21
%70 = load i32, i32* %21
%71 = load i32, i32* %20
%72 = sub nsw i32 %70, %71
%73 = icmp sgt i32 %72, 20
br i1 %73, label %74, label %75
74: ; preds = %60
store i32 0, i32* %7
br label %77
75: ; preds = %60
br label %32
76: ; preds = %58
store i32 0, i32* %7
br label %77
77: ; preds = %76, %74
%78 = load i32, i32* %7
ret i32 %78
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @WaitMoveGoal(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca %struct.timespec
%8 = bitcast %struct.timespec* %7 to i8*
%9 = tail call i32 @getNormalizedInput(i32 11)
%10 = tail call i32 @getNormalizedInput(i32 12)
%11 = tail call i32 @getNormalizedInput(i32 13)
%12 = tail call i32 @getNormalizedInput(i32 14)
%13 = tail call i32 @getNormalizedInput(i32 15)
%14 = load i32, i32* @CLOCK_REALTIME
%15 = call i32 @clock_gettime(i32 %14, %struct.timespec* %7)
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i64 0, i32 0
%17 = load i32, i32* %16
br label %18
18: ; preds = %38, %6
%19 = phi i32 [ %10, %6 ], [ %40, %38 ]
%20 = phi i32 [ %12, %6 ], [ %42, %38 ]
%21 = phi i32 [ %13, %6 ], [ %43, %38 ]
%22 = phi i32 [ %11, %6 ], [ %41, %38 ]
%23 = phi i32 [ %9, %6 ], [ %39, %38 ]
%24 = call i32 @isNear(i32 %0, i32 %23, i32 500)
%25 = icmp eq i32 %24, 0
br i1 %25, label %38, label %26
26: ; preds = %18
%27 = call i32 @isNear(i32 %1, i32 %22, i32 500)
%28 = icmp eq i32 %27, 0
br i1 %28, label %38, label %29
29: ; preds = %26
%30 = call i32 @isNear(i32 %2, i32 %19, i32 500)
%31 = icmp eq i32 %30, 0
br i1 %31, label %38, label %32
32: ; preds = %29
%33 = call i32 @isNear(i32 %3, i32 %20, i32 500)
%34 = icmp eq i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = call i32 @isNear(i32 %4, i32 %21, i32 500)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %49
38: ; preds = %18, %26, %29, %32, %35
%39 = call i32 @getNormalizedInput(i32 11)
%40 = call i32 @getNormalizedInput(i32 12)
%41 = call i32 @getNormalizedInput(i32 13)
%42 = call i32 @getNormalizedInput(i32 14)
%43 = call i32 @getNormalizedInput(i32 15)
%44 = load i32, i32* @CLOCK_REALTIME
%45 = call i32 @clock_gettime(i32 %44, %struct.timespec* %7)
%46 = load i32, i32* %16
%47 = sub nsw i32 %46, %17
%48 = icmp sgt i32 %47, 20
br i1 %48, label %49, label %18
49: ; preds = %35, %38
ret i32 0
}