#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*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
char *mm_put_str(unsigned char *);
int /*<<< orphan*/ stderr;
int mm_print_error(unsigned char *str, int error_code) {
  switch (error_code) {
  case 11:
    fprintf(stderr, "%s %s\n", mm_put_str(str),
            "MM_ERROR: cannot read the file!");
    break;
  case 12:
    fprintf(stderr, "%s %s\n", mm_put_str(str),
            "MM_ERROR: cannot write the file!");
    break;
  case 13:
    fprintf(stderr, "%s %s\n", mm_put_str(str), "MM_ERROR: not matrix!");
    break;
  case 14:
    fprintf(stderr, "%s %s\n", mm_put_str(str),
            "MM_ERROR: cannot find MM header!");
    break;
  case 15:
    fprintf(stderr, "%s %s\n", mm_put_str(str),
            "MM_ERROR: is unsupported type!");
    break;
  case 16:
    fprintf(stderr, "%s %s\n", mm_put_str(str),
            "MM_ERROR: length of line exceeded!");
    break;
  case 17:
    fprintf(stderr, "%s %s\n", mm_put_str(str), "MM_ERROR: premature EOF!");
    break;
  default:
    fprintf(stderr, "%s %s\n", mm_put_str(str),
            "MM_ERROR: cannot specify the king of errors!");
    break;
  }
  return error_code;
}


x86 assembly (clang, -O0):
<mm_print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffff5,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x6,%eax
ja     12bd <mm_print_error+0x19d>
mov    -0x18(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xea2(%rip),%rsi
lea    0xea2(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe6f(%rip),%rsi
lea    0xe8f(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe3c(%rip),%rsi
lea    0xe7d(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x28(%rbp),%edi
mov    %rax,%rdx
lea    0xe09(%rip),%rsi
lea    0xe60(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xdd6(%rip),%rsi
lea    0xe4e(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x30(%rbp),%edi
mov    %rax,%rdx
lea    0xda3(%rip),%rsi
lea    0xe3a(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x34(%rbp),%edi
mov    %rax,%rdx
lea    0xd70(%rip),%rsi
lea    0xe2a(%rip),%rcx
call   1040 <fprintf@plt>
jmp    12eb <mm_print_error+0x1cb>
mov    0x2d1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mm_put_str@plt>
mov    -0x38(%rbp),%edi
mov    %rax,%rdx
lea    0xd3d(%rip),%rsi
lea    0xe10(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_print_error>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
lea    -0xb(%r14),%eax
cmp    $0x6,%eax
ja     1142 <mm_print_error+0x22>
cltq
lea    0xfcf(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    1149 <mm_print_error+0x29>
lea    0xf91(%rip),%rbx
mov    0x2e90(%rip),%rax
mov    (%rax),%ebp
call   1030 <mm_put_str@plt>
lea    0xea2(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <fprintf@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [32 x i8] c"MM_ERROR: cannot read the file!\00"
@.str.2 = [33 x i8] c"MM_ERROR: cannot write the file!\00"
@.str.3 = [22 x i8] c"MM_ERROR: not matrix!\00"
@.str.4 = [33 x i8] c"MM_ERROR: cannot find MM header!\00"
@.str.5 = [31 x i8] c"MM_ERROR: is unsupported type!\00"
@.str.6 = [35 x i8] c"MM_ERROR: length of line exceeded!\00"
@.str.7 = [25 x i8] c"MM_ERROR: premature EOF!\00"
@.str.8 = [45 x i8] c"MM_ERROR: cannot specify the king of errors!\00"
define i32 @mm_print_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %41 [
i32 11, label %6
i32 12, label %11
i32 13, label %16
i32 14, label %21
i32 15, label %26
i32 16, label %31
i32 17, label %36
]
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = call i8* @mm_put_str(i8* %8)
%10 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %46
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = call i8* @mm_put_str(i8* %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %46
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %3
%19 = call i8* @mm_put_str(i8* %18)
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %46
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %3
%24 = call i8* @mm_put_str(i8* %23)
%25 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %24, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
br label %46
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %3
%29 = call i8* @mm_put_str(i8* %28)
%30 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %46
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %3
%34 = call i8* @mm_put_str(i8* %33)
%35 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %34, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
br label %46
36: ; preds = %2
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %3
%39 = call i8* @mm_put_str(i8* %38)
%40 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %39, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %46
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %3
%44 = call i8* @mm_put_str(i8* %43)
%45 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %44, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
br label %46
46: ; preds = %41, %36, %31, %26, %21, %16, %11, %6
%47 = load i32, i32* %4
ret i32 %47
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [32 x i8] c"MM_ERROR: cannot read the file!\00"
@.str.2 = [33 x i8] c"MM_ERROR: cannot write the file!\00"
@.str.3 = [22 x i8] c"MM_ERROR: not matrix!\00"
@.str.4 = [33 x i8] c"MM_ERROR: cannot find MM header!\00"
@.str.5 = [31 x i8] c"MM_ERROR: is unsupported type!\00"
@.str.6 = [35 x i8] c"MM_ERROR: length of line exceeded!\00"
@.str.7 = [25 x i8] c"MM_ERROR: premature EOF!\00"
@.str.8 = [45 x i8] c"MM_ERROR: cannot specify the king of errors!\00"
@reltable.mm_print_error = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([32 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([35 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.mm_print_error to i64)) to i32)]
define i32 @mm_print_error(i8* %0, i32 returned %1) {
%3 = add i32 %1, -11
%4 = icmp ult i32 %3, 7
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.mm_print_error to i8*), i64 %7)
br label %9
9: ; preds = %2, %5
%10 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), %2 ]
%11 = load i32, i32* @stderr
%12 = tail call i8* @mm_put_str(i8* %0)
%13 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %10)
ret i32 %1
}