#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 mapExtendedMPAARating(int mpaarating, char **ratingStr) {
  char *szRating = malloc((40));
  strcpy(szRating, "");
  if (mpaarating & 0x00400000) {
    strcat(szRating, "AC ");
  }
  if (mpaarating & 0x00800000) {
    strcat(szRating, "BN ");
  }
  if (mpaarating & 0x01000000) {
    strcat(szRating, "GL ");
  }
  if (mpaarating & 0x02000000) {
    strcat(szRating, "GV ");
  }
  if (mpaarating & 0x04000000) {
    strcat(szRating, "AL ");
  }
  if (mpaarating & 0x08000000) {
    strcat(szRating, "MV ");
  }
  if (mpaarating & 0x10000000) {
    strcat(szRating, "N ");
  }
  if (mpaarating & 0x20000000) {
    strcat(szRating, "RP ");
  }
  if (mpaarating & 0x40000000) {
    strcat(szRating, "SC ");
  }
  if (mpaarating & 0x80000000) {
    strcat(szRating, "V ");
  }
  *ratingStr = szRating;
}


x86 assembly (clang, -O0):
<mapExtendedMPAARating>:
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    0xeab(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
and    $0x400000,%eax
cmp    $0x0,%eax
je     117e <mapExtendedMPAARating+0x4e>
mov    -0x18(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x800000,%eax
cmp    $0x0,%eax
je     119f <mapExtendedMPAARating+0x6f>
mov    -0x18(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x1000000,%eax
cmp    $0x0,%eax
je     11c0 <mapExtendedMPAARating+0x90>
mov    -0x18(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x2000000,%eax
cmp    $0x0,%eax
je     11e1 <mapExtendedMPAARating+0xb1>
mov    -0x18(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x4000000,%eax
cmp    $0x0,%eax
je     1202 <mapExtendedMPAARating+0xd2>
mov    -0x18(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x8000000,%eax
cmp    $0x0,%eax
je     1223 <mapExtendedMPAARating+0xf3>
mov    -0x18(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x10000000,%eax
cmp    $0x0,%eax
je     1244 <mapExtendedMPAARating+0x114>
mov    -0x18(%rbp),%rdi
lea    0xdc6(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x20000000,%eax
cmp    $0x0,%eax
je     1265 <mapExtendedMPAARating+0x135>
mov    -0x18(%rbp),%rdi
lea    0xdb8(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x40000000,%eax
cmp    $0x0,%eax
je     1286 <mapExtendedMPAARating+0x156>
mov    -0x18(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     12a7 <mapExtendedMPAARating+0x177>
mov    -0x18(%rbp),%rdi
lea    0xd6b(%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):
<mapExtendedMPAARating>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeb6(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
test   $0x400000,%ebp
jne    11c9 <mapExtendedMPAARating+0x99>
test   $0x800000,%ebp
jne    11e0 <mapExtendedMPAARating+0xb0>
test   $0x1000000,%ebp
jne    11fb <mapExtendedMPAARating+0xcb>
test   $0x2000000,%ebp
jne    1216 <mapExtendedMPAARating+0xe6>
test   $0x4000000,%ebp
jne    1231 <mapExtendedMPAARating+0x101>
test   $0x8000000,%ebp
jne    124c <mapExtendedMPAARating+0x11c>
test   $0x10000000,%ebp
jne    1267 <mapExtendedMPAARating+0x137>
test   $0x20000000,%ebp
jne    1282 <mapExtendedMPAARating+0x152>
test   $0x40000000,%ebp
jne    129d <mapExtendedMPAARating+0x16d>
test   %ebp,%ebp
js     12b4 <mapExtendedMPAARating+0x184>
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe30(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x800000,%ebp
je     1165 <mapExtendedMPAARating+0x35>
lea    0xe1d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x1000000,%ebp
je     1171 <mapExtendedMPAARating+0x41>
lea    0xe06(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x2000000,%ebp
je     117d <mapExtendedMPAARating+0x4d>
lea    0xdef(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x4000000,%ebp
je     1189 <mapExtendedMPAARating+0x59>
lea    0xdd8(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x8000000,%ebp
je     1195 <mapExtendedMPAARating+0x65>
lea    0xdc1(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x10000000,%ebp
je     11a1 <mapExtendedMPAARating+0x71>
lea    0xd97(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x20000000,%ebp
je     11ad <mapExtendedMPAARating+0x7d>
lea    0xd8f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   $0x40000000,%ebp
je     11b9 <mapExtendedMPAARating+0x89>
lea    0xd78(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
test   %ebp,%ebp
jns    11c1 <mapExtendedMPAARating+0x91>
lea    0xd52(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
jmp    11c1 <mapExtendedMPAARating+0x91>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"AC \00"
@.str.2 = [4 x i8] c"BN \00"
@.str.3 = [4 x i8] c"GL \00"
@.str.4 = [4 x i8] c"GV \00"
@.str.5 = [4 x i8] c"AL \00"
@.str.6 = [4 x i8] c"MV \00"
@.str.7 = [3 x i8] c"N \00"
@.str.8 = [4 x i8] c"RP \00"
@.str.9 = [4 x i8] c"SC \00"
@.str.10 = [3 x i8] c"V \00"
define void @mapExtendedMPAARating(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, 4194304
%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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %12, %2
%16 = load i32, i32* %3
%17 = and i32 %16, 8388608
%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 ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %15
%23 = load i32, i32* %3
%24 = and i32 %23, 16777216
%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 ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* %3
%31 = and i32 %30, 33554432
%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 ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %33, %29
%37 = load i32, i32* %3
%38 = and i32 %37, 67108864
%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 ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %40, %36
%44 = load i32, i32* %3
%45 = and i32 %44, 134217728
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i8*, i8** %5
%49 = call i32 @strcat(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %50
50: ; preds = %47, %43
%51 = load i32, i32* %3
%52 = and i32 %51, 268435456
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i8*, i8** %5
%56 = call i32 @strcat(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %57
57: ; preds = %54, %50
%58 = load i32, i32* %3
%59 = and i32 %58, 536870912
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load i8*, i8** %5
%63 = call i32 @strcat(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %64
64: ; preds = %61, %57
%65 = load i32, i32* %3
%66 = and i32 %65, 1073741824
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load i8*, i8** %5
%70 = call i32 @strcat(i8* %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %71
71: ; preds = %68, %64
%72 = load i32, i32* %3
%73 = and i32 %72, -2147483648
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = load i8*, i8** %5
%77 = call i32 @strcat(i8* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %78
78: ; preds = %75, %71
%79 = load i8*, i8** %5
%80 = load i8**, i8*** %4
store i8* %79, i8** %80
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"AC \00"
@.str.2 = [4 x i8] c"BN \00"
@.str.3 = [4 x i8] c"GL \00"
@.str.4 = [4 x i8] c"GV \00"
@.str.5 = [4 x i8] c"AL \00"
@.str.6 = [4 x i8] c"MV \00"
@.str.7 = [3 x i8] c"N \00"
@.str.8 = [4 x i8] c"RP \00"
@.str.9 = [4 x i8] c"SC \00"
@.str.10 = [3 x i8] c"V \00"
define void @mapExtendedMPAARating(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, 4194304
%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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = and i32 %0, 8388608
%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 ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = and i32 %0, 16777216
%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 ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = and i32 %0, 33554432
%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 ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = and i32 %0, 67108864
%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 ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = and i32 %0, 134217728
%31 = icmp eq i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = and i32 %0, 268435456
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = and i32 %0, 536870912
%41 = icmp eq i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
%45 = and i32 %0, 1073741824
%46 = icmp eq i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
%50 = icmp sgt i32 %0, -1
br i1 %50, label %53, label %51
51: ; preds = %49
%52 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
store i8* %3, i8** %1
ret void
}