#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,
                           unsigned int, unsigned int, unsigned int,
                           unsigned int, unsigned int, unsigned int,
                           unsigned int);
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, -y1, x2, -y1, x2, -y2, x1, -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    %ecx,%ecx
sub    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
xor    %r9d,%r9d
sub    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%ebx
xor    %r11d,%r11d
sub    -0x20(%rbp),%r11d
mov    -0x14(%rbp),%r10d
xor    %eax,%eax
sub    -0x20(%rbp),%eax
lea    0xe8e(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <fprintf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<PsFilledRectangle>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
call   1040 <getPsFile@plt>
neg    %ebp
neg    %ebx
lea    0xebe(%rip),%rsi
mov    %eax,%edi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    %ebp,%r9d
push   %rbx
push   %r15
push   %rbx
push   %r14
call   1030 <fprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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 = load i32, i32* %9
%17 = load i32, i32* %8
%18 = sub i32 0, %17
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = sub i32 0, %20
%22 = load i32, i32* %7
%23 = load i32, i32* %10
%24 = sub i32 0, %23
%25 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %15, i32 %16, i32 %18, i32 %19, i32 %21, i32 %22, i32 %24)
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 = sub i32 0, %4
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %7, i32 %3, i32 %7, i32 %3, i32 %8, i32 %1, i32 %8)
ret void
}