#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char const *, char *);
int get_named_osii_attr(const char *destination, int *instance) {
  int attr;
  if (!strcmp(destination, "boot")) {
    attr = 0;
  } else if (!strcmp(destination, "recovery")) {
    attr = 0x0C;
  } else if (!strcmp(destination, "fastboot")) {
    attr = 0x0E;
  } else if (!strcmp(destination, "droidboot")) {
    attr = 0x0E;
  } else if (!strcmp(destination, "splashscreen")) {
    attr = 0x04;
  } else if (!strcmp(destination, "splashscreen2")) {
    attr = 0x04;
    if (instance != NULL)
      *instance = 2;
  } else if (!strcmp(destination, "splashscreen3")) {
    attr = 0x04;
    if (instance != NULL)
      *instance = 3;
  } else if (!strcmp(destination, "splashscreen4")) {
    attr = 0x04;
    if (instance != NULL)
      *instance = 4;
  } else if (!strcmp(destination, "silentlake")) {
    attr = 8;
  } else if (!strcmp(destination, "ramdump")) {
    attr = 0x16;
  } else {
    fprintf(stderr, "unknown destination %s\n", destination);
    return -1;
  }
  return attr;
}


x86 assembly (clang, -O0):
<get_named_osii_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xedc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1155 <get_named_osii_attr+0x35>
movl   $0x0,-0x1c(%rbp)
jmp    1333 <get_named_osii_attr+0x213>
mov    -0x10(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117a <get_named_osii_attr+0x5a>
movl   $0xc,-0x1c(%rbp)
jmp    132e <get_named_osii_attr+0x20e>
mov    -0x10(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    119f <get_named_osii_attr+0x7f>
movl   $0xe,-0x1c(%rbp)
jmp    1329 <get_named_osii_attr+0x209>
mov    -0x10(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c4 <get_named_osii_attr+0xa4>
movl   $0xe,-0x1c(%rbp)
jmp    1324 <get_named_osii_attr+0x204>
mov    -0x10(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11e9 <get_named_osii_attr+0xc9>
movl   $0x4,-0x1c(%rbp)
jmp    131f <get_named_osii_attr+0x1ff>
mov    -0x10(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1223 <get_named_osii_attr+0x103>
movl   $0x4,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     121e <get_named_osii_attr+0xfe>
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
jmp    131a <get_named_osii_attr+0x1fa>
mov    -0x10(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    125d <get_named_osii_attr+0x13d>
movl   $0x4,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1258 <get_named_osii_attr+0x138>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
jmp    1315 <get_named_osii_attr+0x1f5>
mov    -0x10(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1297 <get_named_osii_attr+0x177>
movl   $0x4,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1292 <get_named_osii_attr+0x172>
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
jmp    1310 <get_named_osii_attr+0x1f0>
mov    -0x10(%rbp),%rdi
lea    0xdb1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12bc <get_named_osii_attr+0x19c>
movl   $0x8,-0x1c(%rbp)
jmp    130b <get_named_osii_attr+0x1eb>
mov    -0x10(%rbp),%rdi
lea    0xd97(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12e1 <get_named_osii_attr+0x1c1>
movl   $0x16,-0x1c(%rbp)
jmp    1306 <get_named_osii_attr+0x1e6>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd71(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1339 <get_named_osii_attr+0x219>
jmp    130b <get_named_osii_attr+0x1eb>
jmp    1310 <get_named_osii_attr+0x1f0>
jmp    1315 <get_named_osii_attr+0x1f5>
jmp    131a <get_named_osii_attr+0x1fa>
jmp    131f <get_named_osii_attr+0x1ff>
jmp    1324 <get_named_osii_attr+0x204>
jmp    1329 <get_named_osii_attr+0x209>
jmp    132e <get_named_osii_attr+0x20e>
jmp    1333 <get_named_osii_attr+0x213>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_named_osii_attr>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xee6(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1222 <get_named_osii_attr+0x102>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1226 <get_named_osii_attr+0x106>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0xe,%ebp
test   %eax,%eax
je     122b <get_named_osii_attr+0x10b>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     122b <get_named_osii_attr+0x10b>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x4,%ebp
test   %eax,%eax
je     122b <get_named_osii_attr+0x10b>
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1232 <get_named_osii_attr+0x112>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1240 <get_named_osii_attr+0x120>
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     124e <get_named_osii_attr+0x12e>
lea    0xe6f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     125c <get_named_osii_attr+0x13c>
lea    0xe67(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1263 <get_named_osii_attr+0x143>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    122b <get_named_osii_attr+0x10b>
xor    %ebp,%ebp
jmp    122b <get_named_osii_attr+0x10b>
mov    $0xc,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
test   %r14,%r14
je     122b <get_named_osii_attr+0x10b>
movl   $0x2,(%r14)
jmp    122b <get_named_osii_attr+0x10b>
test   %r14,%r14
je     122b <get_named_osii_attr+0x10b>
movl   $0x3,(%r14)
jmp    122b <get_named_osii_attr+0x10b>
test   %r14,%r14
je     122b <get_named_osii_attr+0x10b>
movl   $0x4,(%r14)
jmp    122b <get_named_osii_attr+0x10b>
mov    $0x8,%ebp
jmp    122b <get_named_osii_attr+0x10b>
mov    $0x16,%ebp
jmp    122b <get_named_osii_attr+0x10b>

LLVM IR (-O0):
@.str = [5 x i8] c"boot\00"
@.str.1 = [9 x i8] c"recovery\00"
@.str.2 = [9 x i8] c"fastboot\00"
@.str.3 = [10 x i8] c"droidboot\00"
@.str.4 = [13 x i8] c"splashscreen\00"
@.str.5 = [14 x i8] c"splashscreen2\00"
@.str.6 = [14 x i8] c"splashscreen3\00"
@.str.7 = [14 x i8] c"splashscreen4\00"
@.str.8 = [11 x i8] c"silentlake\00"
@.str.9 = [8 x i8] c"ramdump\00"
@stderr = global i32 0
@.str.10 = [24 x i8] c"unknown destination %s\0A\00"
define i32 @get_named_osii_attr(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%7 = load i8*, i8** %4
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 0, i32* %6
br label %84
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i32 12, i32* %6
br label %83
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i32 14, i32* %6
br label %82
21: ; preds = %16
%22 = load i8*, i8** %4
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store i32 14, i32* %6
br label %81
26: ; preds = %21
%27 = load i8*, i8** %4
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %26
store i32 4, i32* %6
br label %80
31: ; preds = %26
%32 = load i8*, i8** %4
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %31
store i32 4, i32* %6
%36 = load i32*, i32** %5
%37 = icmp ne i32* %36, null
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = load i32*, i32** %5
store i32 2, i32* %39
br label %40
40: ; preds = %38, %35
br label %79
41: ; preds = %31
%42 = load i8*, i8** %4
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %51, label %45
45: ; preds = %41
store i32 4, i32* %6
%46 = load i32*, i32** %5
%47 = icmp ne i32* %46, null
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = load i32*, i32** %5
store i32 3, i32* %49
br label %50
50: ; preds = %48, %45
br label %78
51: ; preds = %41
%52 = load i8*, i8** %4
%53 = call i32 @strcmp(i8* %52, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%54 = icmp ne i32 %53, 0
br i1 %54, label %61, label %55
55: ; preds = %51
store i32 4, i32* %6
%56 = load i32*, i32** %5
%57 = icmp ne i32* %56, null
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = load i32*, i32** %5
store i32 4, i32* %59
br label %60
60: ; preds = %58, %55
br label %77
61: ; preds = %51
%62 = load i8*, i8** %4
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %61
store i32 8, i32* %6
br label %76
66: ; preds = %61
%67 = load i8*, i8** %4
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %71, label %70
70: ; preds = %66
store i32 22, i32* %6
br label %75
71: ; preds = %66
%72 = load i32, i32* @stderr
%73 = load i8*, i8** %4
%74 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %73)
store i32 -1, i32* %3
br label %86
75: ; preds = %70
br label %76
76: ; preds = %75, %65
br label %77
77: ; preds = %76, %60
br label %78
78: ; preds = %77, %50
br label %79
79: ; preds = %78, %40
br label %80
80: ; preds = %79, %30
br label %81
81: ; preds = %80, %25
br label %82
82: ; preds = %81, %20
br label %83
83: ; preds = %82, %15
br label %84
84: ; preds = %83, %10
%85 = load i32, i32* %6
store i32 %85, i32* %3
br label %86
86: ; preds = %84, %71
%87 = load i32, i32* %3
ret i32 %87
}

LLVM IR (-O2):
@.str = [5 x i8] c"boot\00"
@.str.1 = [9 x i8] c"recovery\00"
@.str.2 = [9 x i8] c"fastboot\00"
@.str.3 = [10 x i8] c"droidboot\00"
@.str.4 = [13 x i8] c"splashscreen\00"
@.str.5 = [14 x i8] c"splashscreen2\00"
@.str.6 = [14 x i8] c"splashscreen3\00"
@.str.7 = [14 x i8] c"splashscreen4\00"
@.str.8 = [11 x i8] c"silentlake\00"
@.str.9 = [8 x i8] c"ramdump\00"
@stderr = global i32 0
@.str.10 = [24 x i8] c"unknown destination %s\0A\00"
define i32 @get_named_osii_attr(i8* %0, i32* writeonly %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %44, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %44, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %44, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %44, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %44, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = icmp eq i32* %1, null
br i1 %21, label %44, label %22
22: ; preds = %20
store i32 2, i32* %1
br label %44
23: ; preds = %17
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = icmp eq i32* %1, null
br i1 %27, label %44, label %28
28: ; preds = %26
store i32 3, i32* %1
br label %44
29: ; preds = %23
%30 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = icmp eq i32* %1, null
br i1 %33, label %44, label %34
34: ; preds = %32
store i32 4, i32* %1
br label %44
35: ; preds = %29
%36 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
br i1 %37, label %44, label %38
38: ; preds = %35
%39 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = tail call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %0)
br label %44
44: ; preds = %28, %26, %32, %34, %20, %22, %2, %5, %8, %11, %14, %35, %38, %41
%45 = phi i32 [ -1, %41 ], [ 4, %34 ], [ 4, %32 ], [ 4, %28 ], [ 4, %26 ], [ 4, %22 ], [ 4, %20 ], [ 0, %2 ], [ 12, %5 ], [ 14, %8 ], [ 14, %11 ], [ 4, %14 ], [ 8, %35 ], [ 22, %38 ]
ret i32 %45
}