#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 *);
scalar_t__ strlen(char *);
void ataError2String(int error, char *string) {
  string[0] = '\0';
  if (error & 0x40) {
    strcat(string, "uncorrectable data error");
  }
  if (error & 0x20) {
    if (strlen(string))
      strcat(string, ", ");
    strcat(string, "media changed");
  }
  if (error & 0x10) {
    if (strlen(string))
      strcat(string, ", ");
    strcat(string, "ID or target sector not found");
  }
  if (error & 0x08) {
    if (strlen(string))
      strcat(string, ", ");
    strcat(string, "media change requested");
  }
  if (error & 0x04) {
    if (strlen(string))
      strcat(string, ", ");
    strcat(string, "command aborted - invalid command");
  }
  if (error & 0x02) {
    if (strlen(string))
      strcat(string, ", ");
    strcat(string, "track 0 not found");
  }
  if (error & 0x01) {
    if (strlen(string))
      strcat(string, ", ");
    strcat(string, "address mark not found");
  }
  if (!strlen(string))
    strcat(string, "unknown error");
}


x86 assembly (clang, -O0):
<ataError2String>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1155 <ataError2String+0x35>
mov    -0x10(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1197 <ataError2String+0x77>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     1187 <ataError2String+0x67>
mov    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11d9 <ataError2String+0xb9>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     11c9 <ataError2String+0xa9>
mov    -0x10(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     121b <ataError2String+0xfb>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     120b <ataError2String+0xeb>
mov    -0x10(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     125d <ataError2String+0x13d>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     124d <ataError2String+0x12d>
mov    -0x10(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     129f <ataError2String+0x17f>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     128f <ataError2String+0x16f>
mov    -0x10(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     12e1 <ataError2String+0x1c1>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     12d1 <ataError2String+0x1b1>
mov    -0x10(%rbp),%rdi
lea    0xd4d(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1304 <ataError2String+0x1e4>
mov    -0x10(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ataError2String>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
movb   $0x0,(%rsi)
test   $0x40,%bpl
jne    1165 <ataError2String+0x55>
test   $0x20,%bpl
jne    117a <ataError2String+0x6a>
test   $0x10,%bpl
jne    11a3 <ataError2String+0x93>
test   $0x8,%bpl
jne    11d0 <ataError2String+0xc0>
test   $0x4,%bpl
jne    11fd <ataError2String+0xed>
test   $0x2,%bpl
jne    122a <ataError2String+0x11a>
test   $0x1,%bpl
jne    1257 <ataError2String+0x147>
cmpb   $0x0,(%rbx)
je     1283 <ataError2String+0x173>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe94(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
test   $0x20,%bpl
je     1127 <ataError2String+0x17>
cmpb   $0x0,(%rbx)
je     118e <ataError2String+0x7e>
lea    0xe93(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
test   $0x10,%bpl
je     112d <ataError2String+0x1d>
cmpb   $0x0,(%rbx)
je     11b7 <ataError2String+0xa7>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
test   $0x8,%bpl
je     1137 <ataError2String+0x27>
cmpb   $0x0,(%rbx)
je     11e4 <ataError2String+0xd4>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xe5d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
test   $0x4,%bpl
je     1141 <ataError2String+0x31>
cmpb   $0x0,(%rbx)
je     1211 <ataError2String+0x101>
lea    0xe10(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
test   $0x2,%bpl
je     114b <ataError2String+0x3b>
cmpb   $0x0,(%rbx)
je     123e <ataError2String+0x12e>
lea    0xde3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xe3c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
test   $0x1,%bpl
je     1155 <ataError2String+0x45>
cmpb   $0x0,(%rbx)
je     126b <ataError2String+0x15b>
lea    0xdb6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xe21(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
cmpb   $0x0,(%rbx)
jne    115e <ataError2String+0x4e>
lea    0xe20(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strcat@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"uncorrectable data error\00"
@.str.1 = [3 x i8] c", \00"
@.str.2 = [14 x i8] c"media changed\00"
@.str.3 = [30 x i8] c"ID or target sector not found\00"
@.str.4 = [23 x i8] c"media change requested\00"
@.str.5 = [34 x i8] c"command aborted - invalid command\00"
@.str.6 = [18 x i8] c"track 0 not found\00"
@.str.7 = [23 x i8] c"address mark not found\00"
@.str.8 = [14 x i8] c"unknown error\00"
define void @ataError2String(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 0, i8* %6
%7 = load i32, i32* %3
%8 = and i32 %7, 64
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %2
%14 = load i32, i32* %3
%15 = and i32 %14, 32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = call i64 @strlen(i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i8*, i8** %4
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %21, %17
%25 = load i8*, i8** %4
%26 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %24, %13
%28 = load i32, i32* %3
%29 = and i32 %28, 16
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %41
31: ; preds = %27
%32 = load i8*, i8** %4
%33 = call i64 @strlen(i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %35, %31
%39 = load i8*, i8** %4
%40 = call i32 @strcat(i8* %39, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %38, %27
%42 = load i32, i32* %3
%43 = and i32 %42, 8
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %41
%46 = load i8*, i8** %4
%47 = call i64 @strlen(i8* %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i8*, i8** %4
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %52
52: ; preds = %49, %45
%53 = load i8*, i8** %4
%54 = call i32 @strcat(i8* %53, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %55
55: ; preds = %52, %41
%56 = load i32, i32* %3
%57 = and i32 %56, 4
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %69
59: ; preds = %55
%60 = load i8*, i8** %4
%61 = call i64 @strlen(i8* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i8*, i8** %4
%65 = call i32 @strcat(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %66
66: ; preds = %63, %59
%67 = load i8*, i8** %4
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %69
69: ; preds = %66, %55
%70 = load i32, i32* %3
%71 = and i32 %70, 2
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %83
73: ; preds = %69
%74 = load i8*, i8** %4
%75 = call i64 @strlen(i8* %74)
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = load i8*, i8** %4
%79 = call i32 @strcat(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %80
80: ; preds = %77, %73
%81 = load i8*, i8** %4
%82 = call i32 @strcat(i8* %81, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %83
83: ; preds = %80, %69
%84 = load i32, i32* %3
%85 = and i32 %84, 1
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %97
87: ; preds = %83
%88 = load i8*, i8** %4
%89 = call i64 @strlen(i8* %88)
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %87
%92 = load i8*, i8** %4
%93 = call i32 @strcat(i8* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %94
94: ; preds = %91, %87
%95 = load i8*, i8** %4
%96 = call i32 @strcat(i8* %95, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %97
97: ; preds = %94, %83
%98 = load i8*, i8** %4
%99 = call i64 @strlen(i8* %98)
%100 = icmp ne i64 %99, 0
br i1 %100, label %104, label %101
101: ; preds = %97
%102 = load i8*, i8** %4
%103 = call i32 @strcat(i8* %102, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %104
104: ; preds = %101, %97
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"uncorrectable data error\00"
@.str.1 = [3 x i8] c", \00"
@.str.2 = [14 x i8] c"media changed\00"
@.str.3 = [30 x i8] c"ID or target sector not found\00"
@.str.4 = [23 x i8] c"media change requested\00"
@.str.5 = [34 x i8] c"command aborted - invalid command\00"
@.str.6 = [18 x i8] c"track 0 not found\00"
@.str.7 = [23 x i8] c"address mark not found\00"
@.str.8 = [14 x i8] c"unknown error\00"
define void @ataError2String(i32 %0, i8* %1) {
store i8 0, i8* %1
%3 = and i32 %0, 64
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = and i32 %0, 32
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %7
%18 = and i32 %0, 16
%19 = icmp eq i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %17
%21 = load i8, i8* %1
%22 = icmp eq i8 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %17
%28 = and i32 %0, 8
%29 = icmp eq i32 %28, 0
br i1 %29, label %37, label %30
30: ; preds = %27
%31 = load i8, i8* %1
%32 = icmp eq i8 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
%36 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %27
%38 = and i32 %0, 4
%39 = icmp eq i32 %38, 0
br i1 %39, label %47, label %40
40: ; preds = %37
%41 = load i8, i8* %1
%42 = icmp eq i8 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
%46 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %37
%48 = and i32 %0, 2
%49 = icmp eq i32 %48, 0
br i1 %49, label %57, label %50
50: ; preds = %47
%51 = load i8, i8* %1
%52 = icmp eq i8 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %50
%54 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %55
55: ; preds = %53, %50
%56 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %57
57: ; preds = %55, %47
%58 = and i32 %0, 1
%59 = icmp eq i32 %58, 0
br i1 %59, label %67, label %60
60: ; preds = %57
%61 = load i8, i8* %1
%62 = icmp eq i8 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
%66 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %67
67: ; preds = %65, %57
%68 = load i8, i8* %1
%69 = icmp eq i8 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
ret void
}