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

/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ mvwinchstr(int /*<<< orphan*/ *, int, int,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int /*<<< orphan*/ report_nstr(int /*<<< orphan*/ *);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
scalar_t__ sscanf(char *, char *, int *);
void cmd_mvwinchstr(int nargs, char **args) {
  int y, x;
  chtype string[256];
  WINDOW *win;
  if (check_arg_count(nargs, 3) == 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;
  }
  report_count(2);
  report_return(mvwinchstr(win, y, x, string));
  report_nstr(string);
}


x86 assembly (clang, -O0):
<cmd_mvwinchstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
call   1060 <check_arg_count@plt>
cmp    $0x1,%eax
jne    119d <cmd_mvwinchstr+0x2d>
jmp    128c <cmd_mvwinchstr+0x11c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x428(%rbp),%rdx
lea    0xe4e(%rip),%rsi
call   1080 <sscanf@plt>
cmp    $0x0,%rax
jne    11dc <cmd_mvwinchstr+0x6c>
mov    $0x1,%edi
call   1070 <report_count@plt>
lea    0xe31(%rip),%rdi
call   1090 <report_error@plt>
jmp    128c <cmd_mvwinchstr+0x11c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe25(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x0,%rax
jne    1219 <cmd_mvwinchstr+0xa9>
mov    $0x1,%edi
call   1070 <report_count@plt>
lea    0xdf4(%rip),%rdi
call   1090 <report_error@plt>
jmp    128c <cmd_mvwinchstr+0x11c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xde8(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x0,%rax
jne    1256 <cmd_mvwinchstr+0xe6>
mov    $0x1,%edi
call   1070 <report_count@plt>
lea    0xdb7(%rip),%rdi
call   1090 <report_error@plt>
jmp    128c <cmd_mvwinchstr+0x11c>
mov    $0x2,%edi
call   1070 <report_count@plt>
mov    -0x428(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x420(%rbp),%rcx
call   1050 <mvwinchstr@plt>
mov    %eax,%edi
call   1040 <report_return@plt>
lea    -0x420(%rbp),%rdi
call   1030 <report_nstr@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvwinchstr>:
push   %rbx
sub    $0x410,%rsp
mov    %rsi,%rbx
mov    $0x3,%esi
call   1060 <check_arg_count@plt>
cmp    $0x1,%eax
je     1223 <cmd_mvwinchstr+0xb3>
mov    (%rbx),%rdi
lea    0xe68(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1080 <sscanf@plt>
test   %rax,%rax
je     120d <cmd_mvwinchstr+0x9d>
mov    0x8(%rbx),%rdi
lea    0xe5e(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1080 <sscanf@plt>
test   %rax,%rax
je     120d <cmd_mvwinchstr+0x9d>
mov    0x10(%rbx),%rdi
lea    0xe44(%rip),%rsi
mov    %rsp,%rdx
call   1080 <sscanf@plt>
test   %rax,%rax
je     120d <cmd_mvwinchstr+0x9d>
mov    $0x2,%edi
call   1070 <report_count@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rcx
call   1050 <mvwinchstr@plt>
mov    %eax,%edi
call   1040 <report_return@plt>
mov    %rbx,%rdi
call   1030 <report_nstr@plt>
jmp    1223 <cmd_mvwinchstr+0xb3>
mov    $0x1,%edi
call   1070 <report_count@plt>
lea    0xde5(%rip),%rdi
call   1090 <report_error@plt>
add    $0x410,%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_mvwinchstr(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i32]
%8 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = load i32, i32* %3
%10 = call i32 @check_arg_count(i32 %9, i32 3)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %2
br label %51
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = bitcast i32** %8 to i32*
%18 = call i64 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = call i32 @report_count(i32 1)
%22 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %51
23: ; preds = %13
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @sscanf(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = call i32 @report_count(i32 1)
%31 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %51
32: ; preds = %23
%33 = load i8**, i8*** %4
%34 = getelementptr inbounds i8*, i8** %33, 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* %6)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %32
%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 %51
41: ; preds = %32
%42 = call i32 @report_count(i32 2)
%43 = load i32*, i32** %8
%44 = load i32, i32* %5
%45 = load i32, i32* %6
%46 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 0
%47 = call i32 @mvwinchstr(i32* %43, i32 %44, i32 %45, i32* %46)
%48 = call i32 @report_return(i32 %47)
%49 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 0
%50 = call i32 @report_nstr(i32* %49)
br label %51
51: ; preds = %41, %38, %29, %20, %12
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_mvwinchstr(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i32]
%6 = alloca i32*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast [256 x i32]* %5 to i8*
%10 = bitcast i32** %6 to i8*
%11 = tail call i32 @check_arg_count(i32 %0, i32 3)
%12 = icmp eq i32 %11, 1
br i1 %12, label %46, label %13
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = bitcast i32** %6 to i32*
%16 = call i64 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = call i32 @report_count(i32 1)
%20 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %46
21: ; preds = %13
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = call i32 @report_count(i32 1)
%28 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %46
29: ; preds = %21
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = call i64 @sscanf(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = call i32 @report_count(i32 1)
%36 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %46
37: ; preds = %29
%38 = call i32 @report_count(i32 2)
%39 = load i32*, i32** %6
%40 = load i32, i32* %3
%41 = load i32, i32* %4
%42 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 0
%43 = call i32 @mvwinchstr(i32* %39, i32 %40, i32 %41, i32* %42)
%44 = call i32 @report_return(i32 %43)
%45 = call i32 @report_nstr(i32* %42)
br label %46
46: ; preds = %2, %37, %34, %26, %18
ret void
}