#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*/ strcat(char *, char *);
int strlen(char *);
char *GetRruleDayname(unsigned char a) {
  static char daystring[25];
  *daystring = 0;
  if (a & 0x01) {
    strcat(daystring, "SU,");
  }
  if (a & 0x02) {
    strcat(daystring, "MO,");
  }
  if (a & 0x04) {
    strcat(daystring, "TU,");
  }
  if (a & 0x08) {
    strcat(daystring, "WE,");
  }
  if (a & 0x10) {
    strcat(daystring, "TH,");
  }
  if (a & 0x20) {
    strcat(daystring, "FR,");
  }
  if (a & 0x40) {
    strcat(daystring, "SA,");
  }
  if (strlen(daystring)) {
    daystring[strlen(daystring) - 1] = 0;
  }
  return (daystring);
}


x86 assembly (clang, -O0):
<GetRruleDayname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,0x2f0b(%rip)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1158 <GetRruleDayname+0x38>
lea    0x2ef4(%rip),%rdi
lea    0xead(%rip),%rsi
call   1040 <strcat@plt>
movzbl -0x1(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     117b <GetRruleDayname+0x5b>
lea    0x2ed1(%rip),%rdi
lea    0xe8e(%rip),%rsi
call   1040 <strcat@plt>
movzbl -0x1(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     119e <GetRruleDayname+0x7e>
lea    0x2eae(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcat@plt>
movzbl -0x1(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11c1 <GetRruleDayname+0xa1>
lea    0x2e8b(%rip),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strcat@plt>
movzbl -0x1(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11e4 <GetRruleDayname+0xc4>
lea    0x2e68(%rip),%rdi
lea    0xe31(%rip),%rsi
call   1040 <strcat@plt>
movzbl -0x1(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1207 <GetRruleDayname+0xe7>
lea    0x2e45(%rip),%rdi
lea    0xe12(%rip),%rsi
call   1040 <strcat@plt>
movzbl -0x1(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     122a <GetRruleDayname+0x10a>
lea    0x2e22(%rip),%rdi
lea    0xdf3(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e0f(%rip),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
je     125c <GetRruleDayname+0x13c>
lea    0x2dfa(%rip),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2de8(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2ddd(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRruleDayname>:
push   %rbx
mov    %edi,%ebx
movb   $0x0,0x2f16(%rip)
test   $0x1,%bl
jne    119b <GetRruleDayname+0x7b>
test   $0x2,%bl
jne    11b3 <GetRruleDayname+0x93>
test   $0x4,%bl
jne    11cf <GetRruleDayname+0xaf>
test   $0x8,%bl
jne    11eb <GetRruleDayname+0xcb>
test   $0x10,%bl
jne    1207 <GetRruleDayname+0xe7>
test   $0x20,%bl
jne    1223 <GetRruleDayname+0x103>
test   $0x40,%bl
je     1170 <GetRruleDayname+0x50>
lea    0x2edc(%rip),%rdi
lea    0xead(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2ec9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     1192 <GetRruleDayname+0x72>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0x2ea7(%rip),%rax
pop    %rbx
ret
lea    0x2e9e(%rip),%rdi
lea    0xe57(%rip),%rsi
call   1040 <strcat@plt>
test   $0x2,%bl
je     1134 <GetRruleDayname+0x14>
lea    0x2e86(%rip),%rdi
lea    0xe43(%rip),%rsi
call   1040 <strcat@plt>
test   $0x4,%bl
je     113d <GetRruleDayname+0x1d>
lea    0x2e6a(%rip),%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strcat@plt>
test   $0x8,%bl
je     1146 <GetRruleDayname+0x26>
lea    0x2e4e(%rip),%rdi
lea    0xe13(%rip),%rsi
call   1040 <strcat@plt>
test   $0x10,%bl
je     114f <GetRruleDayname+0x2f>
lea    0x2e32(%rip),%rdi
lea    0xdfb(%rip),%rsi
call   1040 <strcat@plt>
test   $0x20,%bl
je     1158 <GetRruleDayname+0x38>
lea    0x2e16(%rip),%rdi
lea    0xde3(%rip),%rsi
call   1040 <strcat@plt>
test   $0x40,%bl
jne    115d <GetRruleDayname+0x3d>
jmp    1170 <GetRruleDayname+0x50>

LLVM IR (-O0):
@GetRruleDayname.daystring = internal global [25 x i8] zeroinitializer
@.str = [4 x i8] c"SU,\00"
@.str.1 = [4 x i8] c"MO,\00"
@.str.2 = [4 x i8] c"TU,\00"
@.str.3 = [4 x i8] c"WE,\00"
@.str.4 = [4 x i8] c"TH,\00"
@.str.5 = [4 x i8] c"FR,\00"
@.str.6 = [4 x i8] c"SA,\00"
define i8* @GetRruleDayname(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0)
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = and i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = and i32 %18, 4
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = and i32 %25, 8
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %23
%31 = load i8, i8* %2
%32 = zext i8 %31 to i32
%33 = and i32 %32, 16
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %30
%38 = load i8, i8* %2
%39 = zext i8 %38 to i32
%40 = and i32 %39, 32
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %37
%45 = load i8, i8* %2
%46 = zext i8 %45 to i32
%47 = and i32 %46, 64
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %44
%50 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %49, %44
%52 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %51
%55 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0))
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 %57
store i8 0, i8* %58
br label %59
59: ; preds = %54, %51
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0)
}

LLVM IR (-O2):
@GetRruleDayname.daystring = internal global [25 x i8] zeroinitializer
@.str = [4 x i8] c"SU,\00"
@.str.1 = [4 x i8] c"MO,\00"
@.str.2 = [4 x i8] c"TU,\00"
@.str.3 = [4 x i8] c"WE,\00"
@.str.4 = [4 x i8] c"TH,\00"
@.str.5 = [4 x i8] c"FR,\00"
@.str.6 = [4 x i8] c"SA,\00"
define i8* @GetRruleDayname(i8 zeroext %0) {
store i8 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0)
%2 = zext i8 %0 to i32
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = and i32 %2, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = and i32 %2, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = and i32 %2, 8
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = and i32 %2, 16
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = and i32 %2, 32
%29 = icmp eq i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = and i32 %2, 64
%34 = icmp eq i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %32
%36 = tail call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %37
37: ; preds = %35, %32
%38 = tail call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = tail call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0))
%42 = add nsw i32 %41, -1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 %43
store i8 0, i8* %44
br label %45
45: ; preds = %40, %37
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @GetRruleDayname.daystring, i64 0, i64 0)
}