#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 */
char *malloc(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void mapExtendedTVRating(int tvrating, char **ratingStr) {
  char *szRating = malloc((40));
  strcpy(szRating, "");
  if (tvrating & 0x00020000) {
    strcat(szRating, "S");
  }
  if (tvrating & 0x00040000) {
    strcat(szRating, "V");
  }
  if (tvrating & 0x00080000) {
    strcat(szRating, "L");
  }
  if (tvrating & 0x00100000) {
    strcat(szRating, "D");
  }
  if (tvrating & 0x00200000) {
    strcat(szRating, "F");
  }
  *ratingStr = szRating;
}


x86 assembly (clang, -O0):
<mapExtendedTVRating>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
and    $0x20000,%eax
cmp    $0x0,%eax
je     117e <mapExtendedTVRating+0x4e>
mov    -0x18(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x40000,%eax
cmp    $0x0,%eax
je     119f <mapExtendedTVRating+0x6f>
mov    -0x18(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x80000,%eax
cmp    $0x0,%eax
je     11c0 <mapExtendedTVRating+0x90>
mov    -0x18(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x100000,%eax
cmp    $0x0,%eax
je     11e1 <mapExtendedTVRating+0xb1>
mov    -0x18(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x200000,%eax
cmp    $0x0,%eax
je     1202 <mapExtendedTVRating+0xd2>
mov    -0x18(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapExtendedTVRating>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeba(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
test   $0x20000,%ebp
jne    1194 <mapExtendedTVRating+0x64>
test   $0x40000,%ebp
jne    11ab <mapExtendedTVRating+0x7b>
test   $0x80000,%ebp
jne    11c2 <mapExtendedTVRating+0x92>
test   $0x100000,%ebp
jne    11d9 <mapExtendedTVRating+0xa9>
test   $0x200000,%ebp
je     118c <mapExtendedTVRating+0x5c>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x40000,%ebp
je     1165 <mapExtendedTVRating+0x35>
lea    0xe50(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x80000,%ebp
je     116d <mapExtendedTVRating+0x3d>
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x100000,%ebp
je     1175 <mapExtendedTVRating+0x45>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x200000,%ebp
jne    117d <mapExtendedTVRating+0x4d>
jmp    118c <mapExtendedTVRating+0x5c>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"S\00"
@.str.2 = [2 x i8] c"V\00"
@.str.3 = [2 x i8] c"L\00"
@.str.4 = [2 x i8] c"D\00"
@.str.5 = [2 x i8] c"F\00"
define void @mapExtendedTVRating(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i8* @malloc(i32 40)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = and i32 %9, 131072
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %12, %2
%16 = load i32, i32* %3
%17 = and i32 %16, 262144
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %5
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %15
%23 = load i32, i32* %3
%24 = and i32 %23, 524288
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i8*, i8** %5
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* %3
%31 = and i32 %30, 1048576
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i8*, i8** %5
%35 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %33, %29
%37 = load i32, i32* %3
%38 = and i32 %37, 2097152
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i8*, i8** %5
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %40, %36
%44 = load i8*, i8** %5
%45 = load i8**, i8*** %4
store i8* %44, i8** %45
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"S\00"
@.str.2 = [2 x i8] c"V\00"
@.str.3 = [2 x i8] c"L\00"
@.str.4 = [2 x i8] c"D\00"
@.str.5 = [2 x i8] c"F\00"
define void @mapExtendedTVRating(i32 %0, i8** nocapture writeonly %1) {
%3 = tail call dereferenceable_or_null(40) i8* @malloc(i32 40)
%4 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = and i32 %0, 131072
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = and i32 %0, 262144
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = and i32 %0, 524288
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = and i32 %0, 1048576
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = and i32 %0, 2097152
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
store i8* %3, i8** %1
ret void
}