#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 direction(int);
int /*<<< orphan*/ printf(char *);
int slabcon(int target, int actual) {
  int dir;
  dir = direction(actual);
  if (dir == -1) {
    if (target <= actual)
      return 0;
    if (target > actual)
      return 1;
    else
      return 0;
  } else if (dir == 1) {
    if (target < actual + 5)
      return 0;
    if (target >= actual - 5)
      return 1;
    else
      return 0;
  } else if (dir == 0) {
    if (target < actual + 5)
      return 0;
    if (target >= actual - 5)
      return 1;
    else
      return 0;
  }
  printf(" ************* slab controller error \n");
  return 2000;
}


x86 assembly (clang, -O0):
<slabcon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <direction@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    117f <slabcon+0x5f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     115b <slabcon+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1173 <slabcon+0x53>
movl   $0x1,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
movl   $0x0,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
cmpl   $0x1,-0x10(%rbp)
jne    11cf <slabcon+0xaf>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x5,%ecx
cmp    %ecx,%eax
jge    11a6 <slabcon+0x86>
movl   $0x0,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x5,%ecx
cmp    %ecx,%eax
jl     11c3 <slabcon+0xa3>
movl   $0x1,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
movl   $0x0,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
cmpl   $0x0,-0x10(%rbp)
jne    121f <slabcon+0xff>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x5,%ecx
cmp    %ecx,%eax
jge    11f6 <slabcon+0xd6>
movl   $0x0,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x5,%ecx
cmp    %ecx,%eax
jl     1213 <slabcon+0xf3>
movl   $0x1,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
movl   $0x0,-0x4(%rbp)
jmp    123c <slabcon+0x11c>
jmp    1224 <slabcon+0x104>
jmp    1229 <slabcon+0x109>
lea    0xdd0(%rip),%rdi
call   1040 <printf@plt>
movl   $0x7d0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slabcon>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
call   1040 <direction@plt>
cmp    $0x1,%eax
je     1145 <slabcon+0x25>
test   %eax,%eax
je     1145 <slabcon+0x25>
cmp    $0xffffffff,%eax
jne    115a <slabcon+0x3a>
xor    %eax,%eax
cmp    %ebx,%ebp
setg   %al
jmp    116b <slabcon+0x4b>
lea    0x5(%rbx),%ecx
xor    %eax,%eax
cmp    %ebp,%ecx
jg     116b <slabcon+0x4b>
add    $0xfffffffb,%ebx
xor    %eax,%eax
cmp    %ebp,%ebx
setle  %al
jmp    116b <slabcon+0x4b>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x7d0,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c" ************* slab controller error \0A\00"
define i32 @slabcon(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = call i32 @direction(i32 %7)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %3
br label %58
16: ; preds = %11
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %3
br label %58
21: ; preds = %16
store i32 0, i32* %3
br label %58
22: ; preds = %2
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %38
25: ; preds = %22
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 5
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 0, i32* %3
br label %58
31: ; preds = %25
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = sub nsw i32 %33, 5
%35 = icmp sge i32 %32, %34
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 1, i32* %3
br label %58
37: ; preds = %31
store i32 0, i32* %3
br label %58
38: ; preds = %22
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %54
41: ; preds = %38
%42 = load i32, i32* %4
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 5
%45 = icmp slt i32 %42, %44
br i1 %45, label %46, label %47
46: ; preds = %41
store i32 0, i32* %3
br label %58
47: ; preds = %41
%48 = load i32, i32* %4
%49 = load i32, i32* %5
%50 = sub nsw i32 %49, 5
%51 = icmp sge i32 %48, %50
br i1 %51, label %52, label %53
52: ; preds = %47
store i32 1, i32* %3
br label %58
53: ; preds = %47
store i32 0, i32* %3
br label %58
54: ; preds = %38
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
%57 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 2000, i32* %3
br label %58
58: ; preds = %56, %53, %52, %46, %37, %36, %30, %21, %20, %15
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@str = [38 x i8] c" ************* slab controller error \00"
define i32 @slabcon(i32 %0, i32 %1) {
%3 = tail call i32 @direction(i32 %1)
switch i32 %3, label %21 [
i32 -1, label %4
i32 1, label %7
i32 0, label %14
]
4: ; preds = %2
%5 = icmp sgt i32 %0, %1
%6 = zext i1 %5 to i32
br label %23
7: ; preds = %2
%8 = add nsw i32 %1, 5
%9 = icmp sgt i32 %8, %0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = add nsw i32 %1, -5
%12 = icmp sle i32 %11, %0
%13 = zext i1 %12 to i32
br label %23
14: ; preds = %2
%15 = add nsw i32 %1, 5
%16 = icmp sgt i32 %15, %0
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = add nsw i32 %1, -5
%19 = icmp sle i32 %18, %0
%20 = zext i1 %19 to i32
br label %23
21: ; preds = %2
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %4, %17, %14, %10, %7, %21
%24 = phi i32 [ 2000, %21 ], [ 0, %7 ], [ %13, %10 ], [ 0, %14 ], [ %20, %17 ], [ %6, %4 ]
ret i32 %24
}