#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*/ mvwchgat(int /*<<< orphan*/ *, int, int, int, int, int,
                            int /*<<< orphan*/ *);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
scalar_t__ sscanf(char *, char *, int *);
void cmd_mvwchgat(int nargs, char **args) {
  WINDOW *win;
  int y, x, n, attr, colour;
  if (check_arg_count(nargs, 6) == 1)
    return;
  if (sscanf(args[0], "%p", &win) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[1], "%d", &y) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[2], "%d", &x) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[3], "%d", &n) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[4], "%d", &attr) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[5], "%d", &colour) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(mvwchgat(win, y, x, n, attr, colour, NULL));
}


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

x86 assembly (clang, -O2):
<cmd_mvwchgat>:
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    $0x6,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
je     1276 <cmd_mvwchgat+0x116>
mov    (%rbx),%rdi
lea    0xe7b(%rip),%rsi
lea    0x28(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     1260 <cmd_mvwchgat+0x100>
mov    0x8(%rbx),%rdi
lea    0xe6d(%rip),%rsi
lea    0x24(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     1260 <cmd_mvwchgat+0x100>
mov    0x10(%rbx),%rdi
lea    0xe4f(%rip),%rsi
lea    0x20(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     1260 <cmd_mvwchgat+0x100>
mov    0x18(%rbx),%rdi
lea    0xe31(%rip),%rsi
lea    0x1c(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     1260 <cmd_mvwchgat+0x100>
mov    0x20(%rbx),%rdi
lea    0xe17(%rip),%rsi
lea    0x18(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     1260 <cmd_mvwchgat+0x100>
mov    0x28(%rbx),%rdi
lea    0xdfd(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1070 <sscanf@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1060 <report_count@plt>
test   %rbx,%rbx
je     126a <cmd_mvwchgat+0x10a>
mov    0x28(%rsp),%rdi
mov    0x24(%rsp),%esi
mov    0x20(%rsp),%edx
mov    0x1c(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    0x14(%rsp),%r9d
movq   $0x0,(%rsp)
call   1030 <mvwchgat@plt>
mov    %eax,%edi
call   1040 <report_return@plt>
jmp    1276 <cmd_mvwchgat+0x116>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd92(%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_mvwchgat(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
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = load i32, i32* %3
%12 = call i32 @check_arg_count(i32 %11, i32 6)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %2
br label %80
15: ; preds = %2
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = bitcast i32** %5 to i32*
%20 = call i64 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %15
%23 = call i32 @report_count(i32 1)
%24 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %80
25: ; preds = %15
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = call i32 @report_count(i32 1)
%33 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %80
34: ; preds = %25
%35 = load i8**, i8*** %4
%36 = getelementptr inbounds i8*, i8** %35, 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* %7)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %34
%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 %80
43: ; preds = %34
%44 = load i8**, i8*** %4
%45 = getelementptr inbounds i8*, i8** %44, i64 3
%46 = load i8*, i8** %45
%47 = call i64 @sscanf(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %43
%50 = call i32 @report_count(i32 1)
%51 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %80
52: ; preds = %43
%53 = load i8**, i8*** %4
%54 = getelementptr inbounds i8*, i8** %53, i64 4
%55 = load i8*, i8** %54
%56 = call i64 @sscanf(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %52
%59 = call i32 @report_count(i32 1)
%60 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %80
61: ; preds = %52
%62 = load i8**, i8*** %4
%63 = getelementptr inbounds i8*, i8** %62, i64 5
%64 = load i8*, i8** %63
%65 = call i64 @sscanf(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %61
%68 = call i32 @report_count(i32 1)
%69 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %80
70: ; preds = %61
%71 = call i32 @report_count(i32 1)
%72 = load i32*, i32** %5
%73 = load i32, i32* %6
%74 = load i32, i32* %7
%75 = load i32, i32* %8
%76 = load i32, i32* %9
%77 = load i32, i32* %10
%78 = call i32 @mvwchgat(i32* %72, i32 %73, i32 %74, i32 %75, i32 %76, i32 %77, i32* null)
%79 = call i32 @report_return(i32 %78)
br label %80
80: ; preds = %70, %67, %58, %49, %40, %31, %22, %14
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_mvwchgat(i32 %0, i8** nocapture %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32** %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = tail call i32 @check_arg_count(i32 %0, i32 6)
%16 = icmp eq i32 %15, 1
br i1 %16, label %74, label %17
17: ; preds = %2
%18 = load i8*, i8** %1
%19 = bitcast i32** %3 to i32*
%20 = call i64 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = call i32 @report_count(i32 1)
%24 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %74
25: ; preds = %17
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = call i32 @report_count(i32 1)
%32 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %74
33: ; preds = %25
%34 = getelementptr inbounds i8*, i8** %1, i64 2
%35 = load i8*, i8** %34
%36 = call i64 @sscanf(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = call i32 @report_count(i32 1)
%40 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %74
41: ; preds = %33
%42 = getelementptr inbounds i8*, i8** %1, i64 3
%43 = load i8*, i8** %42
%44 = call i64 @sscanf(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = call i32 @report_count(i32 1)
%48 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %74
49: ; preds = %41
%50 = getelementptr inbounds i8*, i8** %1, i64 4
%51 = load i8*, i8** %50
%52 = call i64 @sscanf(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = call i32 @report_count(i32 1)
%56 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %74
57: ; preds = %49
%58 = getelementptr inbounds i8*, i8** %1, i64 5
%59 = load i8*, i8** %58
%60 = call i64 @sscanf(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%61 = icmp eq i64 %60, 0
%62 = call i32 @report_count(i32 1)
br i1 %61, label %63, label %65
63: ; preds = %57
%64 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %74
65: ; preds = %57
%66 = load i32*, i32** %3
%67 = load i32, i32* %4
%68 = load i32, i32* %5
%69 = load i32, i32* %6
%70 = load i32, i32* %7
%71 = load i32, i32* %8
%72 = call i32 @mvwchgat(i32* %66, i32 %67, i32 %68, i32 %69, i32 %70, i32 %71, i32* null)
%73 = call i32 @report_return(i32 %72)
br label %74
74: ; preds = %2, %65, %63, %54, %46, %38, %30, %22
ret void
}