#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__);
int /*<<< orphan*/ getPsFile(struct ADrawTag *);
void PsFilledTriangle(struct ADrawTag *ctx, unsigned int x1, unsigned int y1,
                      unsigned int x2, unsigned int y2, unsigned int x3,
                      unsigned int y3) {
  fprintf(getPsFile(ctx),
          "newpath "
          "%d %d moveto "
          "%d %d lineto "
          "%d %d lineto "
          "closepath "
          "fill\n",
          x1, 0 - y1, x2, 0 - y2, x3, 0 - y3);
}


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

x86 assembly (clang, -O2):
<PsFilledTriangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r13d
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %esi,%r12d
call   1040 <getPsFile@plt>
neg    %ebp
neg    %r13d
xor    %ebx,%ebx
sub    0x40(%rsp),%ebx
lea    0xeb0(%rip),%rsi
mov    %eax,%edi
mov    %r12d,%edx
mov    %rbp,%rcx
mov    %r15d,%r8d
mov    %r13,%r9
push   %rbx
push   %r14
call   1030 <fprintf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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