#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 /*<<< orphan*/ printf(char *, ...);
void d_plot(int t, int n, double scale, int y0) {
  printf("2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 1 2\n");
  printf("1 1 1.00 60.00 120.00\n");
  printf("\t%d %d ", 450 + 225 + (int)(t * scale), (1000 * n + 1800) + y0);
  printf("%d %d\n", 450 + 225 + (int)(t * scale),
         (1000 * n + 1800 - 2 * 225) + y0);
}


x86 assembly (clang, -O0):
<d_plot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
imul   $0x3e8,-0x8(%rbp),%edx
add    $0x708,%edx
add    -0x14(%rbp),%edx
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
imul   $0x3e8,-0x8(%rbp),%edx
add    $0x708,%edx
sub    $0x1c2,%edx
add    -0x14(%rbp),%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_plot>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
movsd  %xmm0,(%rsp)
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%ebp
add    $0x2a3,%ebp
imul   $0x3e8,%r14d,%ebx
lea    (%rbx,%r15,1),%edx
add    $0x708,%edx
lea    0xe86(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%r15,1),%edx
add    $0x546,%edx
lea    0xe74(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 1 2\0A\00"
@.str.1 = [23 x i8] c"1 1 1.00 60.00 120.00\0A\00"
@.str.2 = [8 x i8] c"\09%d %d \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
define void @d_plot(i32 %0, i32 %1, double %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
store i32 %3, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = load double, double* %7
%14 = fmul double %12, %13
%15 = fptosi double %14 to i32
%16 = add nsw i32 675, %15
%17 = load i32, i32* %6
%18 = mul nsw i32 1000, %17
%19 = add nsw i32 %18, 1800
%20 = load i32, i32* %8
%21 = add nsw i32 %19, %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %21)
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to double
%25 = load double, double* %7
%26 = fmul double %24, %25
%27 = fptosi double %26 to i32
%28 = add nsw i32 675, %27
%29 = load i32, i32* %6
%30 = mul nsw i32 1000, %29
%31 = add nsw i32 %30, 1800
%32 = sub nsw i32 %31, 450
%33 = load i32, i32* %8
%34 = add nsw i32 %32, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %34)
ret void
}

LLVM IR (-O2):
@.str.2 = [8 x i8] c"\09%d %d \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
@str = [39 x i8] c"2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 1 2\00"
@str.4 = [22 x i8] c"1 1 1.00 60.00 120.00\00"
define void @d_plot(i32 %0, i32 %1, double %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%7 = sitofp i32 %0 to double
%8 = fmul double %7, %2
%9 = fptosi double %8 to i32
%10 = add nsw i32 %9, 675
%11 = mul nsw i32 %1, 1000
%12 = add i32 %11, %3
%13 = add i32 %12, 1800
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %13)
%15 = add i32 %12, 1350
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %15)
ret void
}