#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 */
struct ADrawTag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int, scalar_t__,
                           unsigned int, scalar_t__, unsigned int, scalar_t__,
                           unsigned int, scalar_t__);
int /*<<< orphan*/ getPsFile(struct ADrawTag *);
void PsFilledRectangle(struct ADrawTag *ctx, unsigned int x1, unsigned int y1,
                       unsigned int x2, unsigned int y2) {
  fprintf(getPsFile(ctx),
          "newpath "
          "%d %d moveto "
          "%d %d lineto "
          "%d %d lineto "
          "%d %d lineto "
          "closepath "
          "fill\n",
          x1, 0 - y1, x2, 0 - y1, x2, 0 - y2, x1, 0 - y2);
}


x86 assembly (clang, -O0):
<PsFilledRectangle>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getPsFile@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
sub    -0x18(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x1c(%rbp),%r8d
xor    %eax,%eax
sub    -0x18(%rbp),%eax
mov    %eax,%eax
mov    %eax,%r9d
mov    -0x1c(%rbp),%ebx
xor    %eax,%eax
sub    -0x20(%rbp),%eax
mov    %eax,%eax
mov    %eax,%r11d
mov    -0x14(%rbp),%r10d
xor    %eax,%eax
sub    -0x20(%rbp),%eax
mov    %eax,%eax
lea    0xe82(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <fprintf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<PsFilledRectangle>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%r12d
call   1040 <getPsFile@plt>
neg    %ebx
neg    %r15d
lea    0xebc(%rip),%rsi
mov    %eax,%edi
mov    %r12d,%edx
mov    %rbx,%rcx
mov    %r14d,%r8d
mov    %rbx,%r9
push   %r15
push   %r12
push   %r15
push   %r14
call   1030 <fprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ADrawTag = type { i32 }
@.str = [76 x i8] c"newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath fill\0A\00"
define void @PsFilledRectangle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.ADrawTag*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.ADrawTag* %0, %struct.ADrawTag** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.ADrawTag*, %struct.ADrawTag** %6
%12 = call i32 @getPsFile(%struct.ADrawTag* %11)
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = sub i32 0, %14
%16 = zext i32 %15 to i64
%17 = load i32, i32* %9
%18 = load i32, i32* %8
%19 = sub i32 0, %18
%20 = zext i32 %19 to i64
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = sub i32 0, %22
%24 = zext i32 %23 to i64
%25 = load i32, i32* %7
%26 = load i32, i32* %10
%27 = sub i32 0, %26
%28 = zext i32 %27 to i64
%29 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %13, i64 %16, i32 %17, i64 %20, i32 %21, i64 %24, i32 %25, i64 %28)
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type { i32 }
@.str = [76 x i8] c"newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath fill\0A\00"
define void @PsFilledRectangle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @getPsFile(%struct.ADrawTag* %0)
%7 = sub i32 0, %2
%8 = zext i32 %7 to i64
%9 = sub i32 0, %4
%10 = zext i32 %9 to i64
%11 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %1, i64 %8, i32 %3, i64 %8, i32 %3, i64 %10, i32 %1, i64 %10)
ret void
}