#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*/ sprintf(char *, char *);
int strlen(char *);
char *string_ProfileHeaderFlags(unsigned long flags) {
  static int si = 0;
  static char buf[5][80];
  char *bp, *cp;
  cp = bp = buf[si++];
  si %= 5;
  if (flags & 0x00000001L) {
    sprintf(cp, "Embedded Profile");
  } else {
    sprintf(cp, "Not Embedded Profile");
  }
  cp = cp + strlen(cp);
  if (flags & 0x00000002L) {
    sprintf(cp, ", Use with embedded data only");
  } else {
    sprintf(cp, ", Use anywhere");
  }
  cp = cp + strlen(cp);
  return bp;
}


x86 assembly (clang, -O0):
<string_ProfileHeaderFlags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2f0e(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f03(%rip)
movslq %eax,%rcx
lea    0x2f09(%rip),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    0x2ee4(%rip),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,0x2ed6(%rip)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1191 <string_ProfileHeaderFlags+0x71>
mov    -0x18(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11a1 <string_ProfileHeaderFlags+0x81>
mov    -0x18(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     11e9 <string_ProfileHeaderFlags+0xc9>
mov    -0x18(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f9 <string_ProfileHeaderFlags+0xd9>
mov    -0x18(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_ProfileHeaderFlags>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2f23(%rip),%eax
lea    0x1(%rax),%ecx
lea    (%rax,%rax,4),%rax
shl    $0x4,%rax
lea    0x2f21(%rip),%rbx
add    %rax,%rbx
movslq %ecx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x2eec(%rip)
test   $0x1,%r14b
jne    1174 <string_ProfileHeaderFlags+0x64>
movups 0xe9f(%rip),%xmm0
movups %xmm0,(%rbx)
movabs $0x656c69666f7250,%rax
mov    %rax,0xd(%rbx)
jmp    1182 <string_ProfileHeaderFlags+0x72>
movups 0xe89(%rip),%xmm0
movups %xmm0,(%rbx)
movb   $0x0,0x10(%rbx)
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
test   $0x2,%r14b
jne    11b3 <string_ProfileHeaderFlags+0xa3>
movabs $0x6572656877796e,%rax
mov    %rax,0x7(%rdi)
movabs $0x6e6120657355202c,%rax
20 61 6e
mov    %rax,(%rdi)
jmp    11c8 <string_ProfileHeaderFlags+0xb8>
movups 0xe69(%rip),%xmm0
movups %xmm0,0xe(%rdi)
movups 0xe50(%rip),%xmm0
movups %xmm0,(%rdi)
call   1030 <strlen@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@string_ProfileHeaderFlags.si = internal global i32 0
@string_ProfileHeaderFlags.buf = internal global [5 x [80 x i8]] zeroinitializer
@.str = [17 x i8] c"Embedded Profile\00"
@.str.1 = [21 x i8] c"Not Embedded Profile\00"
@.str.2 = [30 x i8] c", Use with embedded data only\00"
@.str.3 = [15 x i8] c", Use anywhere\00"
define i8* @string_ProfileHeaderFlags(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8*
store i64 %0, i64* %2
%5 = load i32, i32* @string_ProfileHeaderFlags.si
%6 = add nsw i32 %5, 1
store i32 %6, i32* @string_ProfileHeaderFlags.si
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds [5 x [80 x i8]], [5 x [80 x i8]]* @string_ProfileHeaderFlags.buf, i64 0, i64 %7
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
store i8* %9, i8** %3
store i8* %9, i8** %4
%10 = load i32, i32* @string_ProfileHeaderFlags.si
%11 = srem i32 %10, 5
store i32 %11, i32* @string_ProfileHeaderFlags.si
%12 = load i64, i64* %2
%13 = and i64 %12, 1
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %21
18: ; preds = %1
%19 = load i8*, i8** %4
%20 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18, %15
%22 = load i8*, i8** %4
%23 = load i8*, i8** %4
%24 = call i32 @strlen(i8* %23)
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8* %26, i8** %4
%27 = load i64, i64* %2
%28 = and i64 %27, 2
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %21
%31 = load i8*, i8** %4
%32 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %36
33: ; preds = %21
%34 = load i8*, i8** %4
%35 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %33, %30
%37 = load i8*, i8** %4
%38 = load i8*, i8** %4
%39 = call i32 @strlen(i8* %38)
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
store i8* %41, i8** %4
%42 = load i8*, i8** %3
ret i8* %42
}

LLVM IR (-O2):
@string_ProfileHeaderFlags.si = internal unnamed_addr global i32 0
@string_ProfileHeaderFlags.buf = internal global [5 x [80 x i8]] zeroinitializer
@.str = [17 x i8] c"Embedded Profile\00"
@.str.1 = [21 x i8] c"Not Embedded Profile\00"
@.str.2 = [30 x i8] c", Use with embedded data only\00"
@.str.3 = [15 x i8] c", Use anywhere\00"
define i8* @string_ProfileHeaderFlags(i64 %0) {
%2 = load i32, i32* @string_ProfileHeaderFlags.si
%3 = add nsw i32 %2, 1
%4 = zext i32 %2 to i64
%5 = getelementptr inbounds [5 x [80 x i8]], [5 x [80 x i8]]* @string_ProfileHeaderFlags.buf, i64 0, i64 %4, i64 0
%6 = srem i32 %3, 5
store i32 %6, i32* @string_ProfileHeaderFlags.si
%7 = and i64 %0, 1
%8 = icmp eq i64 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(17) %5, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 17, i1 false)
br label %11
10: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(21) %5, i8* align 1 dereferenceable(21) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 21, i1 false)
br label %11
11: ; preds = %10, %9
%12 = tail call i32 @strlen(i8* %5)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x [80 x i8]], [5 x [80 x i8]]* @string_ProfileHeaderFlags.buf, i64 0, i64 %4, i64 %13
%15 = and i64 %0, 2
%16 = icmp eq i64 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %11
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(30) %14, i8* align 1 dereferenceable(30) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 30, i1 false)
br label %19
18: ; preds = %11
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(15) %14, i8* align 1 dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i64 15, i1 false)
br label %19
19: ; preds = %18, %17
%20 = tail call i32 @strlen(i8* %14)
ret i8* %5
}