#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 /*<<< orphan*/ show_result(char *, ...);
void show_ExtendedCursorPosition(char *report) {
  int pos = 0;
  int Pl = scan_any(report, &pos, 'R');
  int Pc = scan_any(report, &pos, 'R');
  int Pp = scan_any(report, &pos, 'R');
  if (Pl != 0 && Pc != 0) {
    if (Pp != 0)
      show_result("Line %d, Column %d, Page %d", Pl, Pc, Pp);
    else
      show_result("Line %d, Column %d (Page?)", Pl, Pc);
  } else
    show_result("failed");
}


x86 assembly (clang, -O0):
<show_ExtendedCursorPosition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x52,%edx
call   1030 <scan_any@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x52,%edx
call   1030 <scan_any@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x52,%edx
call   1030 <scan_any@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11c5 <show_ExtendedCursorPosition+0xa5>
cmpl   $0x0,-0x14(%rbp)
je     11c5 <show_ExtendedCursorPosition+0xa5>
cmpl   $0x0,-0x18(%rbp)
je     11ac <show_ExtendedCursorPosition+0x8c>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <show_result@plt>
jmp    11c0 <show_ExtendedCursorPosition+0xa0>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <show_result@plt>
jmp    11d3 <show_ExtendedCursorPosition+0xb3>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <show_result@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_ExtendedCursorPosition>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbp
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x52,%edx
call   1030 <scan_any@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x52,%edx
call   1030 <scan_any@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x52,%edx
call   1030 <scan_any@plt>
test   %r15d,%r15d
je     1190 <show_ExtendedCursorPosition+0x70>
test   %r14d,%r14d
je     1190 <show_ExtendedCursorPosition+0x70>
test   %eax,%eax
je     11a0 <show_ExtendedCursorPosition+0x80>
lea    0xe81(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <show_result@plt>
jmp    11b4 <show_ExtendedCursorPosition+0x94>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <show_result@plt>
jmp    11b4 <show_ExtendedCursorPosition+0x94>
lea    0xe75(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <show_result@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Line %d, Column %d, Page %d\00"
@.str.1 = [27 x i8] c"Line %d, Column %d (Page?)\00"
@.str.2 = [7 x i8] c"failed\00"
define void @show_ExtendedCursorPosition(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
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 82)
store i32 %8, i32* %4
%9 = load i8*, i8** %2
%10 = call i32 @scan_any(i8* %9, i32* %3, i8 signext 82)
store i32 %10, i32* %5
%11 = load i8*, i8** %2
%12 = call i32 @scan_any(i8* %11, i32* %3, i8 signext 82)
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %1
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = call i32 (i8*, ...) @show_result(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
br label %30
26: ; preds = %18
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = call i32 (i8*, ...) @show_result(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %28)
br label %30
30: ; preds = %26, %21
br label %33
31: ; preds = %15, %1
%32 = call i32 (i8*, ...) @show_result(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %30
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Line %d, Column %d, Page %d\00"
@.str.1 = [27 x i8] c"Line %d, Column %d (Page?)\00"
@.str.2 = [7 x i8] c"failed\00"
define void @show_ExtendedCursorPosition(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 82)
%5 = call i32 @scan_any(i8* %0, i32* %2, i8 signext 82)
%6 = call i32 @scan_any(i8* %0, i32* %2, i8 signext 82)
%7 = icmp ne i32 %4, 0
%8 = icmp ne i32 %5, 0
%9 = select i1 %7, i1 %8, i1 false
br i1 %9, label %10, label %16
10: ; preds = %1
%11 = icmp eq i32 %6, 0
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = call i32 (i8*, ...) @show_result(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6)
br label %18
14: ; preds = %10
%15 = call i32 (i8*, ...) @show_result(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
br label %18
16: ; preds = %1
%17 = call i32 (i8*, ...) @show_result(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %12, %14, %16
ret void
}