#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 argtonum(char *);
int /*<<< orphan*/ invalid_arg(char const *, char *);
scalar_t__ islower(char);
int /*<<< orphan*/ settermheight(int);
int /*<<< orphan*/ settermwidth(int);
int /*<<< orphan*/ strcmp(char const *, char *);
int cmd_wh(const char *name, char *arg) {
  int n;
  if ((!arg || islower(*arg)) && !strcmp(name, "h"))
    return 0;
  n = argtonum(arg);
  if (n < 0)
    invalid_arg(name, "");
  if (*name == 'w')
    settermwidth(n);
  else
    settermheight(n);
  return 1;
}


x86 assembly (clang, -O0):
<cmd_wh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1191 <cmd_wh+0x31>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11b6 <cmd_wh+0x56>
mov    -0x10(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11b6 <cmd_wh+0x56>
movl   $0x0,-0x4(%rbp)
jmp    1208 <cmd_wh+0xa8>
mov    -0x18(%rbp),%rdi
call   1060 <argtonum@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11dc <cmd_wh+0x7c>
mov    -0x10(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1040 <invalid_arg@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x77,%eax
jne    11f9 <cmd_wh+0x99>
mov    -0x1c(%rbp),%edi
call   1080 <settermwidth@plt>
jmp    1201 <cmd_wh+0xa1>
mov    -0x1c(%rbp),%edi
call   1070 <settermheight@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_wh>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
je     117c <cmd_wh+0x1c>
movsbl (%rbx),%edi
call   1030 <islower@plt>
test   %rax,%rax
je     118f <cmd_wh+0x2f>
lea    0xe7d(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11ac <cmd_wh+0x4c>
mov    %rbx,%rdi
call   1060 <argtonum@plt>
mov    %eax,%ebx
test   %eax,%eax
js     11b0 <cmd_wh+0x50>
cmpb   $0x77,(%r14)
jne    11c5 <cmd_wh+0x65>
mov    %ebx,%edi
call   1080 <settermwidth@plt>
jmp    11cc <cmd_wh+0x6c>
xor    %eax,%eax
jmp    11d1 <cmd_wh+0x71>
lea    0xe4a(%rip),%rsi
mov    %r14,%rdi
call   1040 <invalid_arg@plt>
cmpb   $0x77,(%r14)
je     11a3 <cmd_wh+0x43>
mov    %ebx,%edi
call   1070 <settermheight@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"h\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @cmd_wh(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = call i64 @islower(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9, %2
%15 = load i8*, i8** %4
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %14
store i32 0, i32* %3
br label %39
19: ; preds = %14, %9
%20 = load i8*, i8** %5
%21 = call i32 @argtonum(i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = call i32 @invalid_arg(i8* %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %24, %19
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 119
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* %6
%34 = call i32 @settermwidth(i32 %33)
br label %38
35: ; preds = %27
%36 = load i32, i32* %6
%37 = call i32 @settermheight(i32 %36)
br label %38
38: ; preds = %35, %32
store i32 1, i32* %3
br label %39
39: ; preds = %38, %18
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [2 x i8] c"h\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @cmd_wh(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = tail call i64 @islower(i8 signext %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %4, %2
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %8, %4
%12 = tail call i32 @argtonum(i8* %1)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @invalid_arg(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = load i8, i8* %0
%18 = icmp eq i8 %17, 119
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @settermwidth(i32 %12)
br label %23
21: ; preds = %16
%22 = tail call i32 @settermheight(i32 %12)
br label %23
23: ; preds = %19, %21, %8
%24 = phi i32 [ 0, %8 ], [ 1, %21 ], [ 1, %19 ]
ret i32 %24
}