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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ XMoveResizeWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                     long, long, long, long);
int /*<<< orphan*/ XMoveWindow(int /*<<< orphan*/ *, int /*<<< orphan*/, long,
                               long);
int /*<<< orphan*/ XResizeWindow(int /*<<< orphan*/ *, int /*<<< orphan*/, long,
                                 long);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int sscanf(char *, char *, long *, long *, long *, long *);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
int window_move_resize(Display *disp, Window win, char *arg) {
  signed long x, y, w, h;
  const char *argerr = "The -e option expects a list of comma separated "
                       "integers: \"X,Y,width,height\"\n";
  if (!arg || strlen(arg) == 0) {
    fputs(argerr, stderr);
    return EXIT_FAILURE;
  }
  if (sscanf(arg, "%ld,%ld,%ld,%ld", &x, &y, &w, &h) != 4) {
    fputs(argerr, stderr);
    return EXIT_FAILURE;
  }
  if ((w < 1 || h < 1) && (x >= 0 && y >= 0)) {
    XMoveWindow(disp, win, x, y);
  } else if ((x < 0 || y < 0) && (w >= 1 && h >= -1)) {
    XResizeWindow(disp, win, w, h);
  } else if (x >= 0 && y >= 0 && w >= 1 && h >= 1) {
    XMoveResizeWindow(disp, win, x, y, w, h);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<window_move_resize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xe86(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     119c <window_move_resize+0x3c>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jne    11bf <window_move_resize+0x5f>
mov    -0x48(%rbp),%rdi
mov    0x2e39(%rip),%rax
mov    (%rax),%esi
call   1070 <fputs@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12f3 <window_move_resize+0x193>
mov    -0x20(%rbp),%rdi
lea    0xe84(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    -0x40(%rbp),%r9
call   1080 <sscanf@plt>
cmp    $0x4,%eax
je     120b <window_move_resize+0xab>
mov    -0x48(%rbp),%rdi
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
call   1070 <fputs@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12f3 <window_move_resize+0x193>
cmpq   $0x1,-0x38(%rbp)
jl     1221 <window_move_resize+0xc1>
cmpq   $0x1,-0x40(%rbp)
jge    1250 <window_move_resize+0xf0>
cmpq   $0x0,-0x28(%rbp)
jl     1250 <window_move_resize+0xf0>
cmpq   $0x0,-0x30(%rbp)
jl     1250 <window_move_resize+0xf0>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1050 <XMoveWindow@plt>
jmp    12e7 <window_move_resize+0x187>
cmpq   $0x0,-0x28(%rbp)
jl     1266 <window_move_resize+0x106>
cmpq   $0x0,-0x30(%rbp)
jge    1295 <window_move_resize+0x135>
cmpq   $0x1,-0x38(%rbp)
jl     1295 <window_move_resize+0x135>
cmpq   $0xffffffffffffffff,-0x40(%rbp)
jl     1295 <window_move_resize+0x135>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1030 <XResizeWindow@plt>
jmp    12e2 <window_move_resize+0x182>
cmpq   $0x0,-0x28(%rbp)
jl     12dd <window_move_resize+0x17d>
cmpq   $0x0,-0x30(%rbp)
jl     12dd <window_move_resize+0x17d>
cmpq   $0x1,-0x38(%rbp)
jl     12dd <window_move_resize+0x17d>
cmpq   $0x1,-0x40(%rbp)
jl     12dd <window_move_resize+0x17d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
call   1060 <XMoveResizeWindow@plt>
jmp    12e2 <window_move_resize+0x182>
jmp    12e7 <window_move_resize+0x187>
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<window_move_resize>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
test   %rdx,%rdx
je     11da <window_move_resize+0x8a>
cmpb   $0x0,(%rdx)
je     11da <window_move_resize+0x8a>
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xedd(%rip),%rsi
lea    0x20(%rsp),%rax
lea    0x18(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rdx,%rdi
mov    %rax,%rdx
call   1070 <sscanf@plt>
cmp    $0x4,%eax
jne    11da <window_move_resize+0x8a>
mov    0x10(%rsp),%r8
test   %r8,%r8
setle  %al
mov    0x8(%rsp),%r9
test   %r9,%r9
setle  %bl
or     %al,%bl
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
cmp    $0x1,%bl
jne    1204 <window_move_resize+0xb4>
test   %rdx,%rdx
js     1204 <window_move_resize+0xb4>
test   %rcx,%rcx
js     1204 <window_move_resize+0xb4>
mov    %r15,%rdi
mov    %r14d,%esi
call   1040 <XMoveWindow@plt>
mov    0x2df8(%rip),%rbp
jmp    11f6 <window_move_resize+0xa6>
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
lea    0xe16(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2de2(%rip),%rbp
mov    0x0(%rbp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdx,%rax
or     %rcx,%rax
jns    1231 <window_move_resize+0xe1>
test   %r8,%r8
jle    1231 <window_move_resize+0xe1>
cmp    $0xffffffffffffffff,%r9
jl     1231 <window_move_resize+0xe1>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r8,%rdx
mov    %r9,%rcx
call   1030 <XResizeWindow@plt>
mov    0x2da1(%rip),%rbp
jmp    11f6 <window_move_resize+0xa6>
mov    0x2d98(%rip),%rbp
test   %rdx,%rdx
js     11f6 <window_move_resize+0xa6>
test   %rcx,%rcx
js     11f6 <window_move_resize+0xa6>
test   %r8,%r8
jle    11f6 <window_move_resize+0xa6>
test   %r9,%r9
jle    11f6 <window_move_resize+0xa6>
mov    %r15,%rdi
mov    %r14d,%esi
call   1050 <XMoveResizeWindow@plt>
jmp    11f6 <window_move_resize+0xa6>

LLVM IR (-O0):
@.str = [78 x i8] c"The -e option expects a list of comma separated integers: \22X,Y,width,height\22\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [16 x i8] c"%ld,%ld,%ld,%ld\00"
@EXIT_SUCCESS = global i32 0
define i32 @window_move_resize(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8** %12
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = load i8*, i8** %7
%17 = call i64 @strlen(i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15, %3
%20 = load i8*, i8** %12
%21 = load i32, i32* @stderr
%22 = call i32 @fputs(i8* %20, i32 %21)
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %4
br label %93
24: ; preds = %15
%25 = load i8*, i8** %7
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64* %8, i64* %9, i64* %10, i64* %11)
%27 = icmp ne i32 %26, 4
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8*, i8** %12
%30 = load i32, i32* @stderr
%31 = call i32 @fputs(i8* %29, i32 %30)
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %4
br label %93
33: ; preds = %24
%34 = load i64, i64* %10
%35 = icmp slt i64 %34, 1
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i64, i64* %11
%38 = icmp slt i64 %37, 1
br i1 %38, label %39, label %51
39: ; preds = %36, %33
%40 = load i64, i64* %8
%41 = icmp sge i64 %40, 0
br i1 %41, label %42, label %51
42: ; preds = %39
%43 = load i64, i64* %9
%44 = icmp sge i64 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = load i32*, i32** %5
%47 = load i32, i32* %6
%48 = load i64, i64* %8
%49 = load i64, i64* %9
%50 = call i32 @XMoveWindow(i32* %46, i32 %47, i64 %48, i64 %49)
br label %91
51: ; preds = %42, %39, %36
%52 = load i64, i64* %8
%53 = icmp slt i64 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %51
%55 = load i64, i64* %9
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %69
57: ; preds = %54, %51
%58 = load i64, i64* %10
%59 = icmp sge i64 %58, 1
br i1 %59, label %60, label %69
60: ; preds = %57
%61 = load i64, i64* %11
%62 = icmp sge i64 %61, -1
br i1 %62, label %63, label %69
63: ; preds = %60
%64 = load i32*, i32** %5
%65 = load i32, i32* %6
%66 = load i64, i64* %10
%67 = load i64, i64* %11
%68 = call i32 @XResizeWindow(i32* %64, i32 %65, i64 %66, i64 %67)
br label %90
69: ; preds = %60, %57, %54
%70 = load i64, i64* %8
%71 = icmp sge i64 %70, 0
br i1 %71, label %72, label %89
72: ; preds = %69
%73 = load i64, i64* %9
%74 = icmp sge i64 %73, 0
br i1 %74, label %75, label %89
75: ; preds = %72
%76 = load i64, i64* %10
%77 = icmp sge i64 %76, 1
br i1 %77, label %78, label %89
78: ; preds = %75
%79 = load i64, i64* %11
%80 = icmp sge i64 %79, 1
br i1 %80, label %81, label %89
81: ; preds = %78
%82 = load i32*, i32** %5
%83 = load i32, i32* %6
%84 = load i64, i64* %8
%85 = load i64, i64* %9
%86 = load i64, i64* %10
%87 = load i64, i64* %11
%88 = call i32 @XMoveResizeWindow(i32* %82, i32 %83, i64 %84, i64 %85, i64 %86, i64 %87)
br label %89
89: ; preds = %81, %78, %75, %72, %69
br label %90
90: ; preds = %89, %63
br label %91
91: ; preds = %90, %45
%92 = load i32, i32* @EXIT_SUCCESS
store i32 %92, i32* %4
br label %93
93: ; preds = %91, %28, %19
%94 = load i32, i32* %4
ret i32 %94
}

LLVM IR (-O2):
@.str = [78 x i8] c"The -e option expects a list of comma separated integers: \22X,Y,width,height\22\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [16 x i8] c"%ld,%ld,%ld,%ld\00"
@EXIT_SUCCESS = global i32 0
define i32 @window_move_resize(i32* %0, i32 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = bitcast i64* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = bitcast i64* %7 to i8*
%12 = icmp eq i8* %2, null
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load i8, i8* %2
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13, %3
%17 = load i32, i32* @stderr
%18 = tail call i32 @fputs(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %56
19: ; preds = %13
%20 = call i32 @sscanf(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64* %4, i64* %5, i64* %6, i64* %7)
%21 = icmp eq i32 %20, 4
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = call i32 @fputs(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %56
25: ; preds = %19
%26 = load i64, i64* %6
%27 = icmp slt i64 %26, 1
%28 = load i64, i64* %7
%29 = icmp slt i64 %28, 1
%30 = select i1 %27, i1 true, i1 %29
%31 = load i64, i64* %4
%32 = icmp sgt i64 %31, -1
%33 = select i1 %30, i1 %32, i1 false
%34 = load i64, i64* %5
%35 = icmp sgt i64 %34, -1
%36 = select i1 %33, i1 %35, i1 false
br i1 %36, label %37, label %39
37: ; preds = %25
%38 = call i32 @XMoveWindow(i32* %0, i32 %1, i64 %31, i64 %34)
br label %56
39: ; preds = %25
%40 = icmp slt i64 %31, 0
%41 = icmp slt i64 %34, 0
%42 = select i1 %40, i1 true, i1 %41
%43 = icmp sgt i64 %26, 0
%44 = select i1 %42, i1 %43, i1 false
%45 = icmp sgt i64 %28, -2
%46 = select i1 %44, i1 %45, i1 false
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i32 @XResizeWindow(i32* %0, i32 %1, i64 %26, i64 %28)
br label %56
49: ; preds = %39
%50 = select i1 %32, i1 %35, i1 false
%51 = select i1 %50, i1 %43, i1 false
%52 = icmp sgt i64 %28, 0
%53 = select i1 %51, i1 %52, i1 false
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 @XMoveResizeWindow(i32* %0, i32 %1, i64 %31, i64 %34, i64 %26, i64 %28)
br label %56
56: ; preds = %37, %49, %54, %47, %22, %16
%57 = phi i32* [ @EXIT_FAILURE, %16 ], [ @EXIT_FAILURE, %22 ], [ @EXIT_SUCCESS, %47 ], [ @EXIT_SUCCESS, %54 ], [ @EXIT_SUCCESS, %49 ], [ @EXIT_SUCCESS, %37 ]
%58 = load i32, i32* %57
ret i32 %58
}