#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*/ print_mk_devcfg0(unsigned int, int);
int /*<<< orphan*/ print_mk_devcfg1(unsigned int, int);
int /*<<< orphan*/ print_mk_devcfg2(unsigned int, int);
int /*<<< orphan*/ print_mk_devcfg3(unsigned int, int);
int /*<<< orphan*/ print_mk_devcp(unsigned int, int);
int /*<<< orphan*/ print_mk_devseq(unsigned int, int);
int /*<<< orphan*/ print_mk_devsign(unsigned int, int);
int /*<<< orphan*/ print_mk_devsn(unsigned int, unsigned int, unsigned int,
                                  unsigned int);
int /*<<< orphan*/ printf(char *);
void print_mk(unsigned cfg0, unsigned cfg1, unsigned cfg2, unsigned cfg3,
              unsigned cfg4, unsigned cfg5, unsigned cfg6, unsigned cfg7,
              unsigned cfg8, unsigned cfg9, unsigned cfg10, unsigned cfg11,
              unsigned cfg12, unsigned cfg13, unsigned cfg14, unsigned cfg15,
              unsigned cfg16, unsigned cfg17) {
  printf("Boot flash 1 bits\n");
  print_mk_devcfg3(cfg0, 0);
  print_mk_devcfg2(cfg1, 0);
  print_mk_devcfg1(cfg2, 0);
  print_mk_devcfg0(cfg3, 0);
  print_mk_devcp(cfg4, 0);
  print_mk_devsign(cfg5, 0);
  print_mk_devseq(cfg6, 0);
  printf("Boot flash 2 bits\n");
  print_mk_devcfg3(cfg7, 1);
  print_mk_devcfg2(cfg8, 1);
  print_mk_devcfg1(cfg9, 1);
  print_mk_devcfg0(cfg10, 1);
  print_mk_devcp(cfg11, 1);
  print_mk_devsign(cfg12, 1);
  print_mk_devseq(cfg13, 1);
  print_mk_devsn(cfg14, cfg15, cfg16, cfg17);
  if ((cfg6 & 0xFFFF) >= (cfg13 & 0xFFFF)) {
    printf(" Boot flash 1 aliased by Lower Boot Alias.\n Boot flash 2 is "
           "aliased by Upper Boot alias\n");
  } else {
    printf(" Boot flash 2 aliased by Lower Boot Alias.\n Boot flash 1 is "
           "aliased by Upper Boot Alias\n");
  }
}


x86 assembly (clang, -O0):
<print_mk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x68(%rbp),%eax
mov    0x60(%rbp),%eax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1070 <print_mk_devcfg3@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1040 <print_mk_devcfg2@plt>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1060 <print_mk_devcfg1@plt>
mov    -0x10(%rbp),%edi
xor    %esi,%esi
call   1030 <print_mk_devcfg0@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   10b0 <print_mk_devcp@plt>
mov    -0x18(%rbp),%edi
xor    %esi,%esi
call   1090 <print_mk_devsign@plt>
mov    0x10(%rbp),%edi
xor    %esi,%esi
call   1080 <print_mk_devseq@plt>
lea    0xdea(%rip),%rdi
call   1050 <printf@plt>
mov    0x18(%rbp),%edi
mov    $0x1,%esi
call   1070 <print_mk_devcfg3@plt>
mov    0x20(%rbp),%edi
mov    $0x1,%esi
call   1040 <print_mk_devcfg2@plt>
mov    0x28(%rbp),%edi
mov    $0x1,%esi
call   1060 <print_mk_devcfg1@plt>
mov    0x30(%rbp),%edi
mov    $0x1,%esi
call   1030 <print_mk_devcfg0@plt>
mov    0x38(%rbp),%edi
mov    $0x1,%esi
call   10b0 <print_mk_devcp@plt>
mov    0x40(%rbp),%edi
mov    $0x1,%esi
call   1090 <print_mk_devsign@plt>
mov    0x48(%rbp),%edi
mov    $0x1,%esi
call   1080 <print_mk_devseq@plt>
mov    0x50(%rbp),%edi
mov    0x58(%rbp),%esi
mov    0x60(%rbp),%edx
mov    0x68(%rbp),%ecx
call   10a0 <print_mk_devsn@plt>
mov    0x10(%rbp),%eax
and    $0xffff,%eax
mov    0x48(%rbp),%ecx
and    $0xffff,%ecx
cmp    %ecx,%eax
jb     12c4 <print_mk+0x134>
lea    0xd6c(%rip),%rdi
call   1050 <printf@plt>
jmp    12d0 <print_mk+0x140>
lea    0xdb4(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8d,%r13d
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%r15d
mov    0xb0(%rsp),%eax
mov    %eax,0x34(%rsp)
mov    0xb8(%rsp),%eax
mov    %eax,0x30(%rsp)
mov    0xc0(%rsp),%eax
mov    %eax,0x2c(%rsp)
mov    0xc8(%rsp),%eax
mov    %eax,0x28(%rsp)
mov    0xa8(%rsp),%eax
mov    %eax,0x24(%rsp)
mov    0xa0(%rsp),%eax
mov    %eax,0x20(%rsp)
mov    0x98(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    0x90(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x88(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x80(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x78(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x70(%rsp),%r12d
lea    0xdce(%rip),%rdi
call   1050 <puts@plt>
mov    %r15d,%edi
xor    %esi,%esi
call   1070 <print_mk_devcfg3@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <print_mk_devcfg2@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <print_mk_devcfg1@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <print_mk_devcfg0@plt>
mov    %r13d,%edi
xor    %esi,%esi
call   10b0 <print_mk_devcp@plt>
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   1090 <print_mk_devsign@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1080 <print_mk_devseq@plt>
lea    0xd8f(%rip),%rdi
call   1050 <puts@plt>
mov    0x8(%rsp),%edi
mov    $0x1,%esi
call   1070 <print_mk_devcfg3@plt>
mov    0x10(%rsp),%edi
mov    $0x1,%esi
call   1040 <print_mk_devcfg2@plt>
mov    0x14(%rsp),%edi
mov    $0x1,%esi
call   1060 <print_mk_devcfg1@plt>
mov    0x18(%rsp),%edi
mov    $0x1,%esi
call   1030 <print_mk_devcfg0@plt>
mov    0x1c(%rsp),%edi
mov    $0x1,%esi
call   10b0 <print_mk_devcp@plt>
mov    0x20(%rsp),%edi
mov    $0x1,%esi
call   1090 <print_mk_devsign@plt>
mov    0x24(%rsp),%ebx
mov    %ebx,%edi
mov    $0x1,%esi
call   1080 <print_mk_devseq@plt>
mov    0x34(%rsp),%edi
mov    0x30(%rsp),%esi
mov    0x2c(%rsp),%edx
mov    0x28(%rsp),%ecx
call   10a0 <print_mk_devsn@plt>
movzwl %r12w,%eax
movzwl %bx,%ecx
cmp    %ecx,%eax
lea    0xd13(%rip),%rax
lea    0xd64(%rip),%rdi
cmovb  %rax,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Boot flash 1 bits\0A\00"
@.str.1 = [19 x i8] c"Boot flash 2 bits\0A\00"
@.str.2 = [89 x i8] c" Boot flash 1 aliased by Lower Boot Alias.\0A Boot flash 2 is aliased by Upper Boot alias\0A\00"
@.str.3 = [89 x i8] c" Boot flash 2 aliased by Lower Boot Alias.\0A Boot flash 1 is aliased by Upper Boot Alias\0A\00"
define void @print_mk(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16, i32 %17) {
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
store i32 %0, i32* %19
store i32 %1, i32* %20
store i32 %2, i32* %21
store i32 %3, i32* %22
store i32 %4, i32* %23
store i32 %5, i32* %24
store i32 %6, i32* %25
store i32 %7, i32* %26
store i32 %8, i32* %27
store i32 %9, i32* %28
store i32 %10, i32* %29
store i32 %11, i32* %30
store i32 %12, i32* %31
store i32 %13, i32* %32
store i32 %14, i32* %33
store i32 %15, i32* %34
store i32 %16, i32* %35
store i32 %17, i32* %36
%37 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%38 = load i32, i32* %19
%39 = call i32 @print_mk_devcfg3(i32 %38, i32 0)
%40 = load i32, i32* %20
%41 = call i32 @print_mk_devcfg2(i32 %40, i32 0)
%42 = load i32, i32* %21
%43 = call i32 @print_mk_devcfg1(i32 %42, i32 0)
%44 = load i32, i32* %22
%45 = call i32 @print_mk_devcfg0(i32 %44, i32 0)
%46 = load i32, i32* %23
%47 = call i32 @print_mk_devcp(i32 %46, i32 0)
%48 = load i32, i32* %24
%49 = call i32 @print_mk_devsign(i32 %48, i32 0)
%50 = load i32, i32* %25
%51 = call i32 @print_mk_devseq(i32 %50, i32 0)
%52 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%53 = load i32, i32* %26
%54 = call i32 @print_mk_devcfg3(i32 %53, i32 1)
%55 = load i32, i32* %27
%56 = call i32 @print_mk_devcfg2(i32 %55, i32 1)
%57 = load i32, i32* %28
%58 = call i32 @print_mk_devcfg1(i32 %57, i32 1)
%59 = load i32, i32* %29
%60 = call i32 @print_mk_devcfg0(i32 %59, i32 1)
%61 = load i32, i32* %30
%62 = call i32 @print_mk_devcp(i32 %61, i32 1)
%63 = load i32, i32* %31
%64 = call i32 @print_mk_devsign(i32 %63, i32 1)
%65 = load i32, i32* %32
%66 = call i32 @print_mk_devseq(i32 %65, i32 1)
%67 = load i32, i32* %33
%68 = load i32, i32* %34
%69 = load i32, i32* %35
%70 = load i32, i32* %36
%71 = call i32 @print_mk_devsn(i32 %67, i32 %68, i32 %69, i32 %70)
%72 = load i32, i32* %25
%73 = and i32 %72, 65535
%74 = load i32, i32* %32
%75 = and i32 %74, 65535
%76 = icmp uge i32 %73, %75
br i1 %76, label %77, label %79
77: ; preds = %18
%78 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
br label %81
79: ; preds = %18
%80 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.3, i64 0, i64 0))
br label %81
81: ; preds = %79, %77
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"Boot flash 1 bits\00"
@str.4 = [18 x i8] c"Boot flash 2 bits\00"
@str.5 = [88 x i8] c" Boot flash 2 aliased by Lower Boot Alias.\0A Boot flash 1 is aliased by Upper Boot Alias\00"
@str.6 = [88 x i8] c" Boot flash 1 aliased by Lower Boot Alias.\0A Boot flash 2 is aliased by Upper Boot alias\00"
define void @print_mk(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16, i32 %17) {
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 @print_mk_devcfg3(i32 %0, i32 0)
%21 = tail call i32 @print_mk_devcfg2(i32 %1, i32 0)
%22 = tail call i32 @print_mk_devcfg1(i32 %2, i32 0)
%23 = tail call i32 @print_mk_devcfg0(i32 %3, i32 0)
%24 = tail call i32 @print_mk_devcp(i32 %4, i32 0)
%25 = tail call i32 @print_mk_devsign(i32 %5, i32 0)
%26 = tail call i32 @print_mk_devseq(i32 %6, i32 0)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
%28 = tail call i32 @print_mk_devcfg3(i32 %7, i32 1)
%29 = tail call i32 @print_mk_devcfg2(i32 %8, i32 1)
%30 = tail call i32 @print_mk_devcfg1(i32 %9, i32 1)
%31 = tail call i32 @print_mk_devcfg0(i32 %10, i32 1)
%32 = tail call i32 @print_mk_devcp(i32 %11, i32 1)
%33 = tail call i32 @print_mk_devsign(i32 %12, i32 1)
%34 = tail call i32 @print_mk_devseq(i32 %13, i32 1)
%35 = tail call i32 @print_mk_devsn(i32 %14, i32 %15, i32 %16, i32 %17)
%36 = and i32 %6, 65535
%37 = and i32 %13, 65535
%38 = icmp ult i32 %36, %37
%39 = select i1 %38, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([88 x i8], [88 x i8]* @str.6, i64 0, i64 0)
%40 = tail call i32 @puts(i8* dereferenceable(1) %39)
ret void
}