#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_DeviceAttributes(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, "Transparency");
  } else {
    sprintf(cp, "Reflective");
  }
  cp = cp + strlen(cp);
  if (flags & 0x00000002L) {
    sprintf(cp, ", Matte");
  } else {
    sprintf(cp, ", Glossy");
  }
  cp = cp + strlen(cp);
  return bp;
}


x86 assembly (clang, -O0):
<string_DeviceAttributes>:
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_DeviceAttributes+0x71>
mov    -0x18(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11a1 <string_DeviceAttributes+0x81>
mov    -0x18(%rbp),%rdi
lea    0xe71(%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_DeviceAttributes+0xc9>
mov    -0x18(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f9 <string_DeviceAttributes+0xd9>
mov    -0x18(%rbp),%rdi
lea    0xe2c(%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_DeviceAttributes>:
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    1170 <string_DeviceAttributes+0x60>
movabs $0x697463656c666552,%rax
63 74 69
mov    %rax,(%rbx)
movl   $0x657669,0x7(%rbx)
jmp    118b <string_DeviceAttributes+0x7b>
movabs $0x79636e65726170,%rax
mov    %rax,0x5(%rbx)
movabs $0x726170736e617254,%rax
70 61 72
mov    %rax,(%rbx)
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
test   $0x2,%r14b
jne    11b2 <string_DeviceAttributes+0xa2>
movabs $0x7973736f6c47202c,%rax
73 73 79
mov    %rax,(%rdi)
movb   $0x0,0x8(%rdi)
jmp    11bf <string_DeviceAttributes+0xaf>
movabs $0x657474614d202c,%rax
mov    %rax,(%rdi)
call   1030 <strlen@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@string_DeviceAttributes.si = internal global i32 0
@string_DeviceAttributes.buf = internal global [5 x [80 x i8]] zeroinitializer
@.str = [13 x i8] c"Transparency\00"
@.str.1 = [11 x i8] c"Reflective\00"
@.str.2 = [8 x i8] c", Matte\00"
@.str.3 = [9 x i8] c", Glossy\00"
define i8* @string_DeviceAttributes(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8*
store i64 %0, i64* %2
%5 = load i32, i32* @string_DeviceAttributes.si
%6 = add nsw i32 %5, 1
store i32 %6, i32* @string_DeviceAttributes.si
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds [5 x [80 x i8]], [5 x [80 x i8]]* @string_DeviceAttributes.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_DeviceAttributes.si
%11 = srem i32 %10, 5
store i32 %11, i32* @string_DeviceAttributes.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 ([13 x i8], [13 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 ([11 x i8], [11 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 ([8 x i8], [8 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 ([9 x i8], [9 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_DeviceAttributes.si = internal unnamed_addr global i32 0
@string_DeviceAttributes.buf = internal global [5 x [80 x i8]] zeroinitializer
@.str = [13 x i8] c"Transparency\00"
@.str.1 = [11 x i8] c"Reflective\00"
@.str.3 = [9 x i8] c", Glossy\00"
define i8* @string_DeviceAttributes(i64 %0) {
%2 = load i32, i32* @string_DeviceAttributes.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_DeviceAttributes.buf, i64 0, i64 %4, i64 0
%6 = srem i32 %3, 5
store i32 %6, i32* @string_DeviceAttributes.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(13) %5, i8* align 1 dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 13, i1 false)
br label %11
10: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(11) %5, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 11, 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_DeviceAttributes.buf, i64 0, i64 %4, i64 %13
%15 = and i64 %0, 2
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %11
%18 = bitcast i8* %14 to i64*
store i64 28557015845249068, i64* %18
br label %20
19: ; preds = %11
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %14, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 9, i1 false)
br label %20
20: ; preds = %19, %17
%21 = tail call i32 @strlen(i8* %14)
ret i8* %5
}