#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 HYPRE_GetErrorArg();
int /*<<< orphan*/ sprintf(char *, char *, ...);
void HYPRE_DescribeError(int ierr, char *msg) {
  if (ierr == 0)
    sprintf(msg, "[No error] ");
  if (ierr & 1)
    sprintf(msg, "[Generic error] ");
  if (ierr & 2)
    sprintf(msg, "[Memory error] ");
  if (ierr & 4)
    sprintf(msg, "[Error in argument %d] ", HYPRE_GetErrorArg());
  if (ierr & 256)
    sprintf(msg, "[Method did not converge] ");
}


x86 assembly (clang, -O0):
<HYPRE_DescribeError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114b <HYPRE_DescribeError+0x2b>
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     116c <HYPRE_DescribeError+0x4c>
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     118d <HYPRE_DescribeError+0x6d>
mov    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11bf <HYPRE_DescribeError+0x9f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <HYPRE_GetErrorArg@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     11e2 <HYPRE_DescribeError+0xc2>
mov    -0x10(%rbp),%rdi
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HYPRE_DescribeError>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
test   %edi,%edi
je     1148 <HYPRE_DescribeError+0x28>
mov    %edi,%ebp
test   $0x1,%bpl
jne    115e <HYPRE_DescribeError+0x3e>
test   $0x2,%bpl
jne    1172 <HYPRE_DescribeError+0x52>
test   $0x4,%bpl
jne    1182 <HYPRE_DescribeError+0x62>
test   $0x100,%ebp
jne    11a4 <HYPRE_DescribeError+0x84>
jmp    11b9 <HYPRE_DescribeError+0x99>
movabs $0x6f727265206f4e5b,%rax
72 72 6f
mov    %rax,(%rbx)
movl   $0x205d72,0x8(%rbx)
jmp    11b9 <HYPRE_DescribeError+0x99>
movups 0xea7(%rip),%xmm0
movups %xmm0,(%rbx)
movb   $0x0,0x10(%rbx)
test   $0x2,%bpl
je     1138 <HYPRE_DescribeError+0x18>
movups 0xea4(%rip),%xmm0
movups %xmm0,(%rbx)
test   $0x4,%bpl
je     113e <HYPRE_DescribeError+0x1e>
xor    %eax,%eax
call   1030 <HYPRE_GetErrorArg@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
test   $0x100,%ebp
je     11b9 <HYPRE_DescribeError+0x99>
movups 0xea5(%rip),%xmm0
movups %xmm0,0xb(%rbx)
movups 0xe8f(%rip),%xmm0
movups %xmm0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"[No error] \00"
@.str.1 = [17 x i8] c"[Generic error] \00"
@.str.2 = [16 x i8] c"[Memory error] \00"
@.str.3 = [24 x i8] c"[Error in argument %d] \00"
@.str.4 = [27 x i8] c"[Method did not converge] \00"
define void @HYPRE_DescribeError(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %2
%11 = load i32, i32* %3
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %3
%19 = and i32 %18, 2
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i8*, i8** %4
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* %3
%26 = and i32 %25, 4
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load i8*, i8** %4
%30 = call i32 (...) @HYPRE_GetErrorArg()
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %29, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %28, %24
%33 = load i32, i32* %3
%34 = and i32 %33, 256
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = call i32 (i8*, i8*, ...) @sprintf(i8* %37, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %36, %32
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"[No error] \00"
@.str.1 = [17 x i8] c"[Generic error] \00"
@.str.2 = [16 x i8] c"[Memory error] \00"
@.str.3 = [24 x i8] c"[Error in argument %d] \00"
@.str.4 = [27 x i8] c"[Method did not converge] \00"
define void @HYPRE_DescribeError(i32 %0, i8* nocapture writeonly %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %5
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(12) %1, i8* align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 12, i1 false)
br label %23
5: ; preds = %2
%6 = and i32 %0, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %5
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %1, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 17, i1 false)
br label %9
9: ; preds = %8, %5
%10 = and i32 %0, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %1, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i64 16, i1 false)
br label %13
13: ; preds = %12, %9
%14 = and i32 %0, 4
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i32 (...) @HYPRE_GetErrorArg()
%18 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %13
%20 = and i32 %0, 256
%21 = icmp eq i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %19
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(27) %1, i8* align 1 dereferenceable(27) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i64 27, i1 false)
br label %23
23: ; preds = %4, %22, %19
ret void
}