#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 */
struct dhcp_packet {
  int dummy;
};

/* Variables and functions */
unsigned char *free_space(struct dhcp_packet *, unsigned char *, int, int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ option_put_string(struct dhcp_packet *, unsigned char *, int,
                                     char *, int /*<<< orphan*/);
void pxe_misc(struct dhcp_packet *mess, unsigned char *end,
              unsigned char *uuid) {
  unsigned char *p;
  option_put_string(mess, end, 60, "PXEClient", 0);
  if (uuid && (p = free_space(mess, end, 97, 17)))
    memcpy(p, uuid, 17);
}


x86 assembly (clang, -O0):
<pxe_misc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3c,%edx
lea    0xea8(%rip),%rcx
xor    %r8d,%r8d
call   1030 <option_put_string@plt>
cmpq   $0x0,-0x18(%rbp)
je     11a2 <pxe_misc+0x72>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x61,%edx
mov    $0x11,%ecx
call   1040 <free_space@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11a2 <pxe_misc+0x72>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x11,%edx
call   1050 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pxe_misc>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xebb(%rip),%rcx
mov    $0x3c,%edx
xor    %r8d,%r8d
call   1030 <option_put_string@plt>
test   %r14,%r14
je     1186 <pxe_misc+0x56>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x61,%edx
mov    $0x11,%ecx
call   1040 <free_space@plt>
test   %rax,%rax
je     1186 <pxe_misc+0x56>
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x11,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <memcpy@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.dhcp_packet = type { i32 }
@.str = [10 x i8] c"PXEClient\00"
define void @pxe_misc(%struct.dhcp_packet* %0, i8* %1, i8* %2) {
%4 = alloca %struct.dhcp_packet*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store %struct.dhcp_packet* %0, %struct.dhcp_packet** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load %struct.dhcp_packet*, %struct.dhcp_packet** %4
%9 = load i8*, i8** %5
%10 = call i32 @option_put_string(%struct.dhcp_packet* %8, i8* %9, i32 60, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %22
13: ; preds = %3
%14 = load %struct.dhcp_packet*, %struct.dhcp_packet** %4
%15 = load i8*, i8** %5
%16 = call i8* @free_space(%struct.dhcp_packet* %14, i8* %15, i32 97, i32 17)
store i8* %16, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i8*, i8** %7
%20 = load i8*, i8** %6
%21 = call i32 @memcpy(i8* %19, i8* %20, i32 17)
br label %22
22: ; preds = %18, %13, %3
ret void
}

LLVM IR (-O2):
%struct.dhcp_packet = type { i32 }
@.str = [10 x i8] c"PXEClient\00"
define void @pxe_misc(%struct.dhcp_packet* %0, i8* %1, i8* %2) {
%4 = tail call i32 @option_put_string(%struct.dhcp_packet* %0, i8* %1, i32 60, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = icmp eq i8* %2, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i8* @free_space(%struct.dhcp_packet* %0, i8* %1, i32 97, i32 17)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @memcpy(i8* %7, i8* %2, i32 17)
br label %11
11: ; preds = %9, %6, %3
ret void
}