#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*/ strcmp(char *, char *);
char *ipv4_optdata(unsigned char number, char *optdata) {
  switch (number) {
  case 20:
    if (strcmp(optdata, "0000") == 0)
      return ("Router shall examine packet");
    return ("Reserved");
  }
  return ("UNKNOWN");
}


x86 assembly (clang, -O0):
<ipv4_optdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x9(%rbp),%al
sub    $0x14,%al
jne    116b <ipv4_optdata+0x5b>
jmp    1132 <ipv4_optdata+0x22>
mov    -0x18(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115b <ipv4_optdata+0x4b>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1176 <ipv4_optdata+0x66>
lea    0xebf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1176 <ipv4_optdata+0x66>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv4_optdata>:
cmp    $0x14,%dil
jne    1142 <ipv4_optdata+0x32>
push   %rax
lea    0xee2(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
lea    0xed3(%rip),%rcx
lea    0xee8(%rip),%rax
cmove  %rcx,%rax
add    $0x8,%rsp
ret
lea    0xee1(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"0000\00"
@.str.1 = [28 x i8] c"Router shall examine packet\00"
@.str.2 = [9 x i8] c"Reserved\00"
@.str.3 = [8 x i8] c"UNKNOWN\00"
define i8* @ipv4_optdata(i8 zeroext %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
store i8 %0, i8* %4
store i8* %1, i8** %5
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
switch i32 %7, label %14 [
i32 20, label %8
]
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %15
13: ; preds = %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %15
14: ; preds = %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %15
15: ; preds = %14, %13, %12
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [5 x i8] c"0000\00"
@.str.1 = [28 x i8] c"Router shall examine packet\00"
@.str.2 = [9 x i8] c"Reserved\00"
@.str.3 = [8 x i8] c"UNKNOWN\00"
define i8* @ipv4_optdata(i8 zeroext %0, i8* nocapture %1) {
%3 = icmp eq i8 %0, 20
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0)
br label %8
8: ; preds = %2, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %2 ]
ret i8* %9
}