#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*/ descramble(unsigned char *, unsigned char *);
int /*<<< orphan*/ print_bldspec(unsigned char *);
int /*<<< orphan*/ print_flags(unsigned char *);
int /*<<< orphan*/ print_string(unsigned char *);
void print_alpha(unsigned char *data, int bldspec_flag, int flags_flag) {
  unsigned char str[7];
  descramble(data, str);
  if (bldspec_flag) {
    print_bldspec(str);
  } else {
    if (flags_flag && (data[7] == 0xff)) {
      print_flags(str);
    } else {
      print_string(str);
    }
  }
}


x86 assembly (clang, -O0):
<print_alpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x17(%rbp),%rsi
call   1060 <descramble@plt>
cmpl   $0x0,-0xc(%rbp)
je     1177 <print_alpha+0x37>
lea    -0x17(%rbp),%rdi
call   1050 <print_bldspec@plt>
jmp    11b0 <print_alpha+0x70>
cmpl   $0x0,-0x10(%rbp)
je     11a2 <print_alpha+0x62>
mov    -0x8(%rbp),%rax
movzbl 0x7(%rax),%eax
cmp    $0xff,%eax
jne    11a2 <print_alpha+0x62>
lea    -0x17(%rbp),%rdi
call   1040 <print_flags@plt>
jmp    11ab <print_alpha+0x6b>
lea    -0x17(%rbp),%rdi
call   1030 <print_string@plt>
jmp    11b0 <print_alpha+0x70>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_alpha>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x9(%rsp),%rsi
call   1060 <descramble@plt>
test   %ebp,%ebp
je     116a <print_alpha+0x2a>
lea    0x9(%rsp),%rdi
call   1050 <print_bldspec@plt>
jmp    118b <print_alpha+0x4b>
test   %r14d,%r14d
je     1175 <print_alpha+0x35>
cmpb   $0xff,0x7(%rbx)
je     1181 <print_alpha+0x41>
lea    0x9(%rsp),%rdi
call   1030 <print_string@plt>
jmp    118b <print_alpha+0x4b>
lea    0x9(%rsp),%rdi
call   1040 <print_flags@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @print_alpha(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [7 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%10 = call i32 @descramble(i8* %8, i8* %9)
%11 = load i32, i32* %5
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%15 = call i32 @print_bldspec(i8* %14)
br label %32
16: ; preds = %3
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 7
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp eq i32 %23, 255
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%27 = call i32 @print_flags(i8* %26)
br label %31
28: ; preds = %19, %16
%29 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%30 = call i32 @print_string(i8* %29)
br label %31
31: ; preds = %28, %25
br label %32
32: ; preds = %31, %13
ret void
}

LLVM IR (-O2):
define void @print_alpha(i8* %0, i32 %1, i32 %2) {
%4 = alloca [7 x i8]
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%6 = call i32 @descramble(i8* %0, i8* %5)
%7 = icmp eq i32 %1, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 @print_bldspec(i8* %5)
br label %20
10: ; preds = %3
%11 = icmp eq i32 %2, 0
br i1 %11, label %18, label %12
12: ; preds = %10
%13 = getelementptr inbounds i8, i8* %0, i64 7
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @print_flags(i8* %5)
br label %20
18: ; preds = %12, %10
%19 = call i32 @print_string(i8* %5)
br label %20
20: ; preds = %16, %18, %8
ret void
}