#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*/ mvwprintw(int /*<<< orphan*/ *, int, int, char *, char *);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
scalar_t__ sscanf(char *, char *, int *);
void cmd_mvwprintw(int nargs, char **args) {
  int y, x;
  WINDOW *win;
  if (check_arg_count(nargs, 5) == 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(1);
  report_return(mvwprintw(win, y, x, args[3], args[4]));
}


x86 assembly (clang, -O0):
<cmd_mvwprintw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_mvwprintw+0x2a>
jmp    1270 <cmd_mvwprintw+0x110>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x20(%rbp),%rdx
lea    0xe64(%rip),%rsi
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    11c6 <cmd_mvwprintw+0x66>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe47(%rip),%rdi
call   1070 <report_error@plt>
jmp    1270 <cmd_mvwprintw+0x110>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3b(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    1203 <cmd_mvwprintw+0xa3>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe0a(%rip),%rdi
call   1070 <report_error@plt>
jmp    1270 <cmd_mvwprintw+0x110>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdfe(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    1240 <cmd_mvwprintw+0xe0>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xdcd(%rip),%rdi
call   1070 <report_error@plt>
jmp    1270 <cmd_mvwprintw+0x110>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%r8
call   1080 <mvwprintw@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvwprintw>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    $0x5,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
je     1210 <cmd_mvwprintw+0xb0>
mov    (%rbx),%rdi
lea    0xe79(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11fa <cmd_mvwprintw+0x9a>
mov    0x8(%rbx),%rdi
lea    0xe6f(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11fa <cmd_mvwprintw+0x9a>
mov    0x10(%rbx),%rdi
lea    0xe55(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1060 <sscanf@plt>
mov    %rax,%r14
mov    $0x1,%edi
call   1050 <report_count@plt>
test   %r14,%r14
je     1204 <cmd_mvwprintw+0xa4>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x18(%rbx),%rcx
mov    0x20(%rbx),%r8
call   1080 <mvwprintw@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
jmp    1210 <cmd_mvwprintw+0xb0>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xdf8(%rip),%rdi
call   1070 <report_error@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
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_mvwprintw(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = load i32, i32* %3
%9 = call i32 @check_arg_count(i32 %8, i32 5)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %2
br label %53
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = bitcast i32** %7 to i32*
%17 = call i64 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = call i32 @report_count(i32 1)
%21 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %53
22: ; preds = %12
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @sscanf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @report_count(i32 1)
%30 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %53
31: ; preds = %22
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i64 @sscanf(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = call i32 @report_count(i32 1)
%39 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %53
40: ; preds = %31
%41 = call i32 @report_count(i32 1)
%42 = load i32*, i32** %7
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = load i8**, i8*** %4
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = load i8**, i8*** %4
%49 = getelementptr inbounds i8*, i8** %48, i64 4
%50 = load i8*, i8** %49
%51 = call i32 @mvwprintw(i32* %42, i32 %43, i32 %44, i8* %47, i8* %50)
%52 = call i32 @report_return(i32 %51)
br label %53
53: ; preds = %40, %37, %28, %19, %11
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_mvwprintw(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32** %5 to i8*
%9 = tail call i32 @check_arg_count(i32 %0, i32 5)
%10 = icmp eq i32 %9, 1
br i1 %10, label %45, label %11
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = bitcast i32** %5 to i32*
%14 = call i64 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = call i32 @report_count(i32 1)
%18 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %45
19: ; preds = %11
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @sscanf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%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 %45
27: ; preds = %19
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%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* %4)
%31 = icmp eq i64 %30, 0
%32 = call i32 @report_count(i32 1)
br i1 %31, label %33, label %35
33: ; preds = %27
%34 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %45
35: ; preds = %27
%36 = load i32*, i32** %5
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = getelementptr inbounds i8*, i8** %1, i64 3
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8*, i8** %1, i64 4
%42 = load i8*, i8** %41
%43 = call i32 @mvwprintw(i32* %36, i32 %37, i32 %38, i8* %40, i8* %42)
%44 = call i32 @report_return(i32 %43)
br label %45
45: ; preds = %2, %35, %33, %24, %16
ret void
}