#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*/ err_msg(char *);
int /*<<< orphan*/ ping();
void dp_err(int k) {
  ping();
  switch (k) {
  case -1:
    err_msg("Input is not consistent");
    break;
  case -2:
    err_msg("Larger nmax needed");
    break;
  case -3:
    err_msg("Step size too small");
    break;
  case -4:
    err_msg("Problem became stiff");
    break;
  }
}


x86 assembly (clang, -O0):
<dp_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
call   1030 <ping@plt>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     119a <dp_err+0x7a>
mov    -0x10(%rbp),%rax
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeae(%rip),%rdi
call   1040 <err_msg@plt>
jmp    119a <dp_err+0x7a>
lea    0xeb5(%rip),%rdi
call   1040 <err_msg@plt>
jmp    119a <dp_err+0x7a>
lea    0xeb7(%rip),%rdi
call   1040 <err_msg@plt>
jmp    119a <dp_err+0x7a>
lea    0xeba(%rip),%rdi
call   1040 <err_msg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dp_err>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <ping@plt>
cmp    $0xfffffffc,%ebx
jb     1149 <dp_err+0x29>
add    $0x4,%ebx
movslq %ebx,%rax
lea    0xf18(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
pop    %rbx
jmp    1040 <err_msg@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Input is not consistent\00"
@.str.1 = [19 x i8] c"Larger nmax needed\00"
@.str.2 = [20 x i8] c"Step size too small\00"
@.str.3 = [21 x i8] c"Problem became stiff\00"
define void @dp_err(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @ping()
%4 = load i32, i32* %2
switch i32 %4, label %13 [
i32 -1, label %5
i32 -2, label %7
i32 -3, label %9
i32 -4, label %11
]
5: ; preds = %1
%6 = call i32 @err_msg(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %13
7: ; preds = %1
%8 = call i32 @err_msg(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %13
9: ; preds = %1
%10 = call i32 @err_msg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %1
%12 = call i32 @err_msg(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %1, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Input is not consistent\00"
@.str.1 = [19 x i8] c"Larger nmax needed\00"
@.str.2 = [20 x i8] c"Step size too small\00"
@.str.3 = [21 x i8] c"Problem became stiff\00"
@reltable.dp_err = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.dp_err to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.dp_err to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.dp_err to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.dp_err to i64)) to i32)]
define void @dp_err(i32 %0) {
%2 = tail call i32 (...) @ping()
%3 = icmp ugt i32 %0, -5
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = add i32 %0, 4
%6 = sext i32 %5 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.dp_err to i8*), i64 %7)
%9 = tail call i32 @err_msg(i8* %8)
br label %10
10: ; preds = %1, %4
ret void
}