#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*/ printf(char *, ...);
void dump_fru_field(const char *description, size_t offset,
                    unsigned char *field) {
  if (field) {
    printf("%s\t: ", description);
    if ((field[0] & 0x3F)) {
      if (((field[0] >> 6) & 0x3) == 3 || offset) {
        printf("%s\n", &field[offset + 1]);
      } else {
        printf("Non-ASCII\n");
      }
    } else
      printf("Empty Field\n");
  }
}


x86 assembly (clang, -O0):
<dump_fru_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11bd <dump_fru_field+0xad>
mov    -0x8(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
and    $0x3f,%eax
cmp    $0x0,%eax
je     11aa <dump_fru_field+0x9a>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
sar    $0x6,%eax
and    $0x3,%eax
cmp    $0x3,%eax
je     1175 <dump_fru_field+0x65>
cmpq   $0x0,-0x10(%rbp)
je     1197 <dump_fru_field+0x87>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
add    $0x1,%rax
add    %rax,%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <dump_fru_field+0x95>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b8 <dump_fru_field+0xa8>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <dump_fru_field+0xad>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_fru_field>:
push   %r14
push   %rbx
push   %rax
test   %rdx,%rdx
je     115f <dump_fru_field+0x3f>
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%rbx),%eax
test   $0x3f,%al
je     1167 <dump_fru_field+0x47>
test   %r14,%r14
jne    1170 <dump_fru_field+0x50>
and    $0xffffffc0,%eax
cmp    $0xc0,%eax
je     1170 <dump_fru_field+0x50>
lea    0xeb5(%rip),%rdi
jmp    1178 <dump_fru_field+0x58>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe98(%rip),%rdi
jmp    1178 <dump_fru_field+0x58>
lea    (%r14,%rbx,1),%rdi
add    $0x1,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s\09: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [11 x i8] c"Non-ASCII\0A\00"
@.str.3 = [13 x i8] c"Empty Field\0A\00"
define void @dump_fru_field(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %41
9: ; preds = %3
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 %15, 63
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %38
18: ; preds = %9
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = ashr i32 %22, 6
%24 = and i32 %23, 3
%25 = icmp eq i32 %24, 3
br i1 %25, label %29, label %26
26: ; preds = %18
%27 = load i64, i64* %5
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %26, %18
%30 = load i8*, i8** %6
%31 = load i64, i64* %5
%32 = add i64 %31, 1
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %37
35: ; preds = %26
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %29
br label %40
38: ; preds = %9
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %38, %37
br label %41
41: ; preds = %40, %3
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s\09: \00"
@str = [12 x i8] c"Empty Field\00"
@str.4 = [10 x i8] c"Non-ASCII\00"
define void @dump_fru_field(i8* %0, i64 %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %24, label %5
5: ; preds = %3
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = and i32 %8, 63
%10 = icmp eq i32 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %5
%12 = and i32 %8, 192
%13 = icmp eq i32 %12, 192
%14 = icmp ne i64 %1, 0
%15 = or i1 %14, %13
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = add i64 %1, 1
%18 = getelementptr inbounds i8, i8* %2, i64 %17
%19 = tail call i32 @puts(i8* %18)
br label %24
20: ; preds = %11
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, i64 0, i64 0))
br label %24
22: ; preds = %5
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %22, %20, %16, %3
ret void
}