#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ prefresh(int /*<<< orphan*/ *, int, int, int, int, int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
scalar_t__ sscanf(char *, char *, int *);
void cmd_prefresh(int nargs, char **args) {
  int pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y, smax_x;
  WINDOW *pad;
  if (check_arg_count(nargs, 7) == 1)
    return;
  if (sscanf(args[0], "%p", &pad) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[1], "%d", &pbeg_y) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[2], "%d", &pbeg_x) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[3], "%d", &sbeg_y) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[4], "%d", &sbeg_x) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[5], "%d", &smax_y) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[6], "%d", &smax_x) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(prefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y, smax_x));
}


x86 assembly (clang, -O0):
<cmd_prefresh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_prefresh+0x2a>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe64(%rip),%rsi
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    11c6 <cmd_prefresh+0x66>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xe47(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3b(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1203 <cmd_prefresh+0xa3>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xe0a(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdfe(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1240 <cmd_prefresh+0xe0>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xdcd(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdc1(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    127d <cmd_prefresh+0x11d>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd90(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xd84(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    12ba <cmd_prefresh+0x15a>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd53(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xd47(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    12f7 <cmd_prefresh+0x197>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd16(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xd0a(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1334 <cmd_prefresh+0x1d4>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xcd9(%rip),%rdi
call   1080 <report_error@plt>
jmp    1365 <cmd_prefresh+0x205>
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <prefresh@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_prefresh>:
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    $0x7,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
je     1293 <cmd_prefresh+0x133>
mov    (%rbx),%rdi
lea    0xe7b(%rip),%rsi
lea    0x28(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     127d <cmd_prefresh+0x11d>
mov    0x8(%rbx),%rdi
lea    0xe6d(%rip),%rsi
lea    0x24(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     127d <cmd_prefresh+0x11d>
mov    0x10(%rbx),%rdi
lea    0xe4f(%rip),%rsi
lea    0x20(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     127d <cmd_prefresh+0x11d>
mov    0x18(%rbx),%rdi
lea    0xe31(%rip),%rsi
lea    0x1c(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     127d <cmd_prefresh+0x11d>
mov    0x20(%rbx),%rdi
lea    0xe13(%rip),%rsi
lea    0x18(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     127d <cmd_prefresh+0x11d>
mov    0x28(%rbx),%rdi
lea    0xdf9(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     127d <cmd_prefresh+0x11d>
mov    0x30(%rbx),%rdi
lea    0xddf(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1070 <sscanf@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1060 <report_count@plt>
test   %rbx,%rbx
je     1287 <cmd_prefresh+0x127>
mov    0x28(%rsp),%rdi
mov    0x24(%rsp),%esi
mov    0x20(%rsp),%edx
mov    0x1c(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    0x14(%rsp),%r9d
mov    0x10(%rsp),%eax
mov    %eax,(%rsp)
call   1050 <prefresh@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
jmp    1293 <cmd_prefresh+0x133>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd75(%rip),%rdi
call   1080 <report_error@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%p\00"
@.str.1 = [13 x i8] c"BAD ARGUMENT\00"
@.str.2 = [3 x i8] c"%d\00"
define void @cmd_prefresh(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%12 = load i32, i32* %3
%13 = call i32 @check_arg_count(i32 %12, i32 7)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %2
br label %91
16: ; preds = %2
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = bitcast i32** %11 to i32*
%21 = call i64 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = call i32 @report_count(i32 1)
%25 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
26: ; preds = %16
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = call i32 @report_count(i32 1)
%34 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
35: ; preds = %26
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i64 @sscanf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = call i32 @report_count(i32 1)
%43 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
44: ; preds = %35
%45 = load i8**, i8*** %4
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = call i64 @sscanf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = call i32 @report_count(i32 1)
%52 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
53: ; preds = %44
%54 = load i8**, i8*** %4
%55 = getelementptr inbounds i8*, i8** %54, i64 4
%56 = load i8*, i8** %55
%57 = call i64 @sscanf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %53
%60 = call i32 @report_count(i32 1)
%61 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
62: ; preds = %53
%63 = load i8**, i8*** %4
%64 = getelementptr inbounds i8*, i8** %63, i64 5
%65 = load i8*, i8** %64
%66 = call i64 @sscanf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %62
%69 = call i32 @report_count(i32 1)
%70 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
71: ; preds = %62
%72 = load i8**, i8*** %4
%73 = getelementptr inbounds i8*, i8** %72, i64 6
%74 = load i8*, i8** %73
%75 = call i64 @sscanf(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %71
%78 = call i32 @report_count(i32 1)
%79 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %91
80: ; preds = %71
%81 = call i32 @report_count(i32 1)
%82 = load i32*, i32** %11
%83 = load i32, i32* %5
%84 = load i32, i32* %6
%85 = load i32, i32* %7
%86 = load i32, i32* %8
%87 = load i32, i32* %9
%88 = load i32, i32* %10
%89 = call i32 @prefresh(i32* %82, i32 %83, i32 %84, i32 %85, i32 %86, i32 %87, i32 %88)
%90 = call i32 @report_return(i32 %89)
br label %91
91: ; preds = %80, %77, %68, %59, %50, %41, %32, %23, %15
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%p\00"
@.str.1 = [13 x i8] c"BAD ARGUMENT\00"
@.str.2 = [3 x i8] c"%d\00"
define void @cmd_prefresh(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = bitcast i32** %9 to i8*
%17 = tail call i32 @check_arg_count(i32 %0, i32 7)
%18 = icmp eq i32 %17, 1
br i1 %18, label %85, label %19
19: ; preds = %2
%20 = load i8*, i8** %1
%21 = bitcast i32** %9 to i32*
%22 = call i64 @sscanf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = call i32 @report_count(i32 1)
%26 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
27: ; preds = %19
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = call i32 @report_count(i32 1)
%34 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
35: ; preds = %27
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = call i64 @sscanf(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = call i32 @report_count(i32 1)
%42 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
43: ; preds = %35
%44 = getelementptr inbounds i8*, i8** %1, i64 3
%45 = load i8*, i8** %44
%46 = call i64 @sscanf(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = call i32 @report_count(i32 1)
%50 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
51: ; preds = %43
%52 = getelementptr inbounds i8*, i8** %1, i64 4
%53 = load i8*, i8** %52
%54 = call i64 @sscanf(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %51
%57 = call i32 @report_count(i32 1)
%58 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
59: ; preds = %51
%60 = getelementptr inbounds i8*, i8** %1, i64 5
%61 = load i8*, i8** %60
%62 = call i64 @sscanf(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = call i32 @report_count(i32 1)
%66 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
67: ; preds = %59
%68 = getelementptr inbounds i8*, i8** %1, i64 6
%69 = load i8*, i8** %68
%70 = call i64 @sscanf(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%71 = icmp eq i64 %70, 0
%72 = call i32 @report_count(i32 1)
br i1 %71, label %73, label %75
73: ; preds = %67
%74 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %85
75: ; preds = %67
%76 = load i32*, i32** %9
%77 = load i32, i32* %3
%78 = load i32, i32* %4
%79 = load i32, i32* %5
%80 = load i32, i32* %6
%81 = load i32, i32* %7
%82 = load i32, i32* %8
%83 = call i32 @prefresh(i32* %76, i32 %77, i32 %78, i32 %79, i32 %80, i32 %81, i32 %82)
%84 = call i32 @report_return(i32 %83)
br label %85
85: ; preds = %2, %75, %73, %64, %56, %48, %40, %32, %24
ret void
}