#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 */
unsigned char LopAdj_OFILM(unsigned char);
int /*<<< orphan*/ LopIni_OFILM(unsigned char);
int /*<<< orphan*/ MesFil_OFILM(int);
int /*<<< orphan*/ SrvCon_OFILM(int, int);
int /*<<< orphan*/ WitTim_Ofilm(int);
unsigned char LopGan_OFILM(unsigned char UcDirSel_OFILM) {
  unsigned char UcLpAdjSts_OFILM;
  MesFil_OFILM(1);
  SrvCon_OFILM(0x00, 0x01);
  SrvCon_OFILM(0x01, 0x01);
  WitTim_Ofilm(300);
  LopIni_OFILM(UcDirSel_OFILM);
  UcLpAdjSts_OFILM = LopAdj_OFILM(UcDirSel_OFILM);
  SrvCon_OFILM(0x00, 0x00);
  SrvCon_OFILM(0x01, 0x00);
  if (!UcLpAdjSts_OFILM) {
    return (0x02);
  } else {
    if (!UcDirSel_OFILM) {
      return (0x12);
    } else {
      return (0x22);
    }
  }
}


x86 assembly (clang, -O0):
<LopGan_OFILM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    $0x1,%edi
call   1070 <MesFil_OFILM@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <SrvCon_OFILM@plt>
mov    $0x12c,%edi
call   1040 <WitTim_Ofilm@plt>
movzbl -0x2(%rbp),%edi
call   1030 <LopIni_OFILM@plt>
movzbl -0x2(%rbp),%edi
call   1050 <LopAdj_OFILM@plt>
mov    %al,-0x3(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1060 <SrvCon_OFILM@plt>
cmpb   $0x0,-0x3(%rbp)
jne    11c7 <LopGan_OFILM+0x77>
movb   $0x2,-0x1(%rbp)
jmp    11de <LopGan_OFILM+0x8e>
cmpb   $0x0,-0x2(%rbp)
jne    11da <LopGan_OFILM+0x8a>
movb   $0x12,-0x1(%rbp)
jmp    11de <LopGan_OFILM+0x8e>
movb   $0x22,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LopGan_OFILM>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1,%edi
call   1070 <MesFil_OFILM@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x12c,%edi
call   1040 <WitTim_Ofilm@plt>
mov    %ebx,%edi
call   1030 <LopIni_OFILM@plt>
mov    %ebx,%edi
call   1050 <LopAdj_OFILM@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1060 <SrvCon_OFILM@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1060 <SrvCon_OFILM@plt>
test   %ebx,%ebx
setne  %al
shl    $0x4,%al
add    $0x12,%al
test   %bpl,%bpl
movzbl %al,%ecx
mov    $0x2,%eax
cmovne %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @LopGan_OFILM(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
%5 = call i32 @MesFil_OFILM(i32 1)
%6 = call i32 @SrvCon_OFILM(i32 0, i32 1)
%7 = call i32 @SrvCon_OFILM(i32 1, i32 1)
%8 = call i32 @WitTim_Ofilm(i32 300)
%9 = load i8, i8* %3
%10 = call i32 @LopIni_OFILM(i8 zeroext %9)
%11 = load i8, i8* %3
%12 = call zeroext i8 @LopAdj_OFILM(i8 zeroext %11)
store i8 %12, i8* %4
%13 = call i32 @SrvCon_OFILM(i32 0, i32 0)
%14 = call i32 @SrvCon_OFILM(i32 1, i32 0)
%15 = load i8, i8* %4
%16 = icmp ne i8 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %1
store i8 2, i8* %2
br label %23
18: ; preds = %1
%19 = load i8, i8* %3
%20 = icmp ne i8 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %18
store i8 18, i8* %2
br label %23
22: ; preds = %18
store i8 34, i8* %2
br label %23
23: ; preds = %22, %21, %17
%24 = load i8, i8* %2
ret i8 %24
}

LLVM IR (-O2):
define zeroext i8 @LopGan_OFILM(i8 zeroext %0) {
%2 = tail call i32 @MesFil_OFILM(i32 1)
%3 = tail call i32 @SrvCon_OFILM(i32 0, i32 1)
%4 = tail call i32 @SrvCon_OFILM(i32 1, i32 1)
%5 = tail call i32 @WitTim_Ofilm(i32 300)
%6 = tail call i32 @LopIni_OFILM(i8 zeroext %0)
%7 = tail call zeroext i8 @LopAdj_OFILM(i8 zeroext %0)
%8 = tail call i32 @SrvCon_OFILM(i32 0, i32 0)
%9 = tail call i32 @SrvCon_OFILM(i32 1, i32 0)
%10 = icmp eq i8 %7, 0
%11 = icmp eq i8 %0, 0
%12 = select i1 %11, i8 18, i8 34
%13 = select i1 %10, i8 2, i8 %12
ret i8 %13
}