#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 scan_any(char *, int *, char);
int scanto(char *, int *, char);
int /*<<< orphan*/ show_result(char const *, int);
void show_MultisessionStatus(char *report) {
  int pos = 0;
  int Ps1 = scan_any(report, &pos, 'n');
  int Ps2 = scanto(report, &pos, 'n');
  const char *show;
  switch (Ps1) {
  case 80:
    show = "SSU sessions enabled (%d max)";
    break;
  case 81:
    show = "SSU sessions available but pending (%d max)";
    break;
  case 83:
    show = "SSU sessions not ready";
    break;
  case 87:
    show = "Sessions on separate lines";
    break;
  default:
    show = "failed";
  }
  show_result(show, Ps2);
}


x86 assembly (clang, -O0):
<show_MultisessionStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    %rsi,-0x38(%rbp)
mov    $0x6e,%edx
mov    %edx,-0x2c(%rbp)
call   1040 <scan_any@plt>
mov    -0x38(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <scanto@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffb0,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x7,%eax
ja     11db <show_MultisessionStatus+0xab>
mov    -0x28(%rbp),%rax
lea    0xe6e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe7e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11e6 <show_MultisessionStatus+0xb6>
lea    0xe8c(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11e6 <show_MultisessionStatus+0xb6>
lea    0xea8(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11e6 <show_MultisessionStatus+0xb6>
lea    0xeaf(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11e6 <show_MultisessionStatus+0xb6>
lea    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <show_result@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_MultisessionStatus>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%r15
mov    %r15,%rsi
mov    $0x6e,%edx
call   1040 <scan_any@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x6e,%edx
call   1030 <scanto@plt>
add    $0xffffffb0,%ebx
cmp    $0x7,%ebx
ja     1183 <show_MultisessionStatus+0x53>
movslq %ebx,%rcx
lea    0xf0a(%rip),%rdx
movslq (%rdx,%rcx,4),%rdi
add    %rdx,%rdi
jmp    118a <show_MultisessionStatus+0x5a>
lea    0xef2(%rip),%rdi
mov    %eax,%esi
call   1050 <show_result@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"SSU sessions enabled (%d max)\00"
@.str.1 = [44 x i8] c"SSU sessions available but pending (%d max)\00"
@.str.2 = [23 x i8] c"SSU sessions not ready\00"
@.str.3 = [27 x i8] c"Sessions on separate lines\00"
@.str.4 = [7 x i8] c"failed\00"
define void @show_MultisessionStatus(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%7 = load i8*, i8** %2
%8 = call i32 @scan_any(i8* %7, i32* %3, i8 signext 110)
store i32 %8, i32* %4
%9 = load i8*, i8** %2
%10 = call i32 @scanto(i8* %9, i32* %3, i8 signext 110)
store i32 %10, i32* %5
%11 = load i32, i32* %4
switch i32 %11, label %16 [
i32 80, label %12
i32 81, label %13
i32 83, label %14
i32 87, label %15
]
12: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %6
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8** %6
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %6
br label %17
17: ; preds = %16, %15, %14, %13, %12
%18 = load i8*, i8** %6
%19 = load i32, i32* %5
%20 = call i32 @show_result(i8* %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"SSU sessions enabled (%d max)\00"
@.str.1 = [44 x i8] c"SSU sessions available but pending (%d max)\00"
@.str.2 = [23 x i8] c"SSU sessions not ready\00"
@.str.3 = [27 x i8] c"Sessions on separate lines\00"
@.str.4 = [7 x i8] c"failed\00"
@reltable.show_MultisessionStatus = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.show_MultisessionStatus to i64)) to i32)]
define void @show_MultisessionStatus(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @scan_any(i8* %0, i32* %2, i8 signext 110)
%5 = call i32 @scanto(i8* %0, i32* %2, i8 signext 110)
%6 = add i32 %4, -80
%7 = icmp ult i32 %6, 8
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = sext i32 %6 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.show_MultisessionStatus to i8*), i64 %10)
br label %12
12: ; preds = %1, %8
%13 = phi i8* [ %11, %8 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %1 ]
%14 = call i32 @show_result(i8* %13, i32 %5)
ret void
}