#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*/ _dhcp_get_option(unsigned char const *, int, int,
                                    unsigned int, unsigned char const **,
                                    unsigned int *, unsigned int *);
scalar_t__ memcmp(unsigned char const *, char *, int);
void dhcp_get_option(const unsigned char *px, unsigned length,
                     unsigned option_tag, const unsigned char **r_option,
                     unsigned *r_option_length) {
  unsigned overload = 0;
  unsigned offset = 0;
  *r_option = px;
  *r_option_length = 0;
  offset = 28 + 16 + 64 + 128;
  if (offset + 4 > length)
    return;
  if (memcmp(px + offset, "\x63\x82\x53\x63", 4) != 0)
    return;
  offset += 4;
  _dhcp_get_option(px, length, offset, option_tag, r_option, r_option_length,
                   &overload);
  if (overload & 1)
    _dhcp_get_option(px, 28 + 16 + 64 + 128, 28 + 16 + 64, option_tag, r_option,
                     r_option_length, 0);
  if (overload & 2)
    _dhcp_get_option(px, 28 + 16 + 64, 28 + 16, option_tag, r_option,
                     r_option_length, 0);
}


x86 assembly (clang, -O0):
<dhcp_get_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0xec,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x4,%eax
cmp    -0xc(%rbp),%eax
jbe    1178 <dhcp_get_option+0x58>
jmp    123b <dhcp_get_option+0x11b>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%eax
add    %rax,%rdi
lea    0xe77(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
je     11a2 <dhcp_get_option+0x82>
jmp    123b <dhcp_get_option+0x11b>
mov    -0x28(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    -0x24(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <_dhcp_get_option@plt>
mov    -0x24(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1204 <dhcp_get_option+0xe4>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    $0xec,%esi
mov    $0x6c,%edx
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1040 <_dhcp_get_option@plt>
mov    -0x24(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     123b <dhcp_get_option+0x11b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    $0x6c,%esi
mov    $0x2c,%edx
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1040 <_dhcp_get_option@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dhcp_get_option>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    %rdi,(%rcx)
movl   $0x0,(%r8)
cmp    $0xf0,%esi
jb     11ec <dhcp_get_option+0xcc>
mov    %r8,%r14
mov    %rcx,%r12
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
add    $0xec,%rdi
lea    0xe9a(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jne    11ec <dhcp_get_option+0xcc>
lea    0xc(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    $0xf0,%edx
mov    %r15d,%ecx
mov    %r12,%r8
mov    %r14,%r9
call   1040 <_dhcp_get_option@plt>
mov    0xc(%rsp),%eax
test   $0x1,%al
je     11c5 <dhcp_get_option+0xa5>
movq   $0x0,(%rsp)
mov    %rbp,%rdi
mov    $0xec,%esi
mov    $0x6c,%edx
mov    %r15d,%ecx
mov    %r12,%r8
mov    %r14,%r9
call   1040 <_dhcp_get_option@plt>
mov    0xc(%rsp),%eax
test   $0x2,%al
je     11ec <dhcp_get_option+0xcc>
movq   $0x0,(%rsp)
mov    %rbp,%rdi
mov    $0x6c,%esi
mov    $0x2c,%edx
mov    %r15d,%ecx
mov    %r12,%r8
mov    %r14,%r9
call   1040 <_dhcp_get_option@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"c\82Sc\00"
define void @dhcp_get_option(i8* %0, i32 %1, i32 %2, i8** %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i32* %4, i32** %10
store i32 0, i32* %11
store i32 0, i32* %12
%13 = load i8*, i8** %6
%14 = load i8**, i8*** %9
store i8* %13, i8** %14
%15 = load i32*, i32** %10
store i32 0, i32* %15
store i32 236, i32* %12
%16 = load i32, i32* %12
%17 = add i32 %16, 4
%18 = load i32, i32* %7
%19 = icmp ugt i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %5
br label %58
21: ; preds = %5
%22 = load i8*, i8** %6
%23 = load i32, i32* %12
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = call i64 @memcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %21
br label %58
29: ; preds = %21
%30 = load i32, i32* %12
%31 = add i32 %30, 4
store i32 %31, i32* %12
%32 = load i8*, i8** %6
%33 = load i32, i32* %7
%34 = load i32, i32* %12
%35 = load i32, i32* %8
%36 = load i8**, i8*** %9
%37 = load i32*, i32** %10
%38 = call i32 @_dhcp_get_option(i8* %32, i32 %33, i32 %34, i32 %35, i8** %36, i32* %37, i32* %11)
%39 = load i32, i32* %11
%40 = and i32 %39, 1
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %29
%43 = load i8*, i8** %6
%44 = load i32, i32* %8
%45 = load i8**, i8*** %9
%46 = load i32*, i32** %10
%47 = call i32 @_dhcp_get_option(i8* %43, i32 236, i32 108, i32 %44, i8** %45, i32* %46, i32* null)
br label %48
48: ; preds = %42, %29
%49 = load i32, i32* %11
%50 = and i32 %49, 2
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = load i8*, i8** %6
%54 = load i32, i32* %8
%55 = load i8**, i8*** %9
%56 = load i32*, i32** %10
%57 = call i32 @_dhcp_get_option(i8* %53, i32 108, i32 44, i32 %54, i8** %55, i32* %56, i32* null)
br label %58
58: ; preds = %20, %28, %52, %48
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"c\82Sc\00"
define void @dhcp_get_option(i8* %0, i32 %1, i32 %2, i8** %3, i32* %4) {
%6 = alloca i32
%7 = bitcast i32* %6 to i8*
store i32 0, i32* %6
store i8* %0, i8** %3
store i32 0, i32* %4
%8 = icmp ult i32 %1, 240
br i1 %8, label %27, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 236
%11 = tail call i64 @memcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = call i32 @_dhcp_get_option(i8* %0, i32 %1, i32 240, i32 %2, i8** %3, i32* %4, i32* %6)
%15 = load i32, i32* %6
%16 = and i32 %15, 1
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %13
%19 = call i32 @_dhcp_get_option(i8* %0, i32 236, i32 108, i32 %2, i8** %3, i32* %4, i32* null)
%20 = load i32, i32* %6
br label %21
21: ; preds = %18, %13
%22 = phi i32 [ %20, %18 ], [ %15, %13 ]
%23 = and i32 %22, 2
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = call i32 @_dhcp_get_option(i8* %0, i32 108, i32 44, i32 %2, i8** %3, i32* %4, i32* null)
br label %27
27: ; preds = %21, %25, %9, %5
ret void
}