#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 arc_plot(int t1, int t2, int n, double scale, int y0) {
  printf("3 0 2 1 0 7 50 0 -1 0.000 0 0 1 3\n");
  printf("1 1 1.00 60.00 120.00\n");
  printf("\t%d %d ", 450 + 225 + (int)(t1 * scale),
         (1000 * n + 1800 - (int)(2.2 * 225)) + y0);
  printf("%d %d ", 450 + 225 + (int)((t1 + t2) / 2 * scale),
         (1000 * n + 1800 - (int)(2.5 * 225)) + y0);
  printf("%d %d\n", 450 + 225 + (int)(t2 * scale),
         (1000 * n + 1800 - (int)(2.2 * 225)) + y0);
  printf("1 1 1\n");
}


x86 assembly (clang, -O0):
<arc_plot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
imul   $0x3e8,-0xc(%rbp),%edx
add    $0x708,%edx
sub    $0x1ef,%edx
add    -0x1c(%rbp),%edx
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
imul   $0x3e8,-0xc(%rbp),%edx
add    $0x708,%edx
sub    $0x232,%edx
add    -0x1c(%rbp),%edx
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
imul   $0x3e8,-0xc(%rbp),%edx
add    $0x708,%edx
sub    $0x1ef,%edx
add    -0x1c(%rbp),%edx
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc_plot>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r15d
movsd  %xmm0,0x8(%rsp)
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
imul   $0x3e8,%ebp,%ebp
lea    (%r15,%rbp,1),%r12d
add    $0x519,%r12d
lea    0xe7d(%rip),%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    %r14d,%ebx
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
lea    (%r15,%rbp,1),%edx
add    $0x4d6,%edx
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%esi
add    $0x2a3,%esi
lea    0xe21(%rip),%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"3 0 2 1 0 7 50 0 -1 0.000 0 0 1 3\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 \00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
@.str.5 = [7 x i8] c"1 1 1\0A\00"
define void @arc_plot(i32 %0, i32 %1, i32 %2, double %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double %3, double* %9
store i32 %4, i32* %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = sitofp i32 %13 to double
%15 = load double, double* %9
%16 = fmul double %14, %15
%17 = fptosi double %16 to i32
%18 = add nsw i32 675, %17
%19 = load i32, i32* %8
%20 = mul nsw i32 1000, %19
%21 = add nsw i32 %20, 1800
%22 = sub nsw i32 %21, 495
%23 = load i32, i32* %10
%24 = add nsw i32 %22, %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %24)
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = add nsw i32 %26, %27
%29 = sdiv i32 %28, 2
%30 = sitofp i32 %29 to double
%31 = load double, double* %9
%32 = fmul double %30, %31
%33 = fptosi double %32 to i32
%34 = add nsw i32 675, %33
%35 = load i32, i32* %8
%36 = mul nsw i32 1000, %35
%37 = add nsw i32 %36, 1800
%38 = sub nsw i32 %37, 562
%39 = load i32, i32* %10
%40 = add nsw i32 %38, %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %34, i32 %40)
%42 = load i32, i32* %7
%43 = sitofp i32 %42 to double
%44 = load double, double* %9
%45 = fmul double %43, %44
%46 = fptosi double %45 to i32
%47 = add nsw i32 675, %46
%48 = load i32, i32* %8
%49 = mul nsw i32 1000, %48
%50 = add nsw i32 %49, 1800
%51 = sub nsw i32 %50, 495
%52 = load i32, i32* %10
%53 = add nsw i32 %51, %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [8 x i8] c"\09%d %d \00"
@.str.3 = [7 x i8] c"%d %d \00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
@str = [34 x i8] c"3 0 2 1 0 7 50 0 -1 0.000 0 0 1 3\00"
@str.6 = [22 x i8] c"1 1 1.00 60.00 120.00\00"
@str.7 = [6 x i8] c"1 1 1\00"
define void @arc_plot(i32 %0, i32 %1, i32 %2, double %3, i32 %4) {
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.6, i64 0, i64 0))
%8 = sitofp i32 %0 to double
%9 = fmul double %8, %3
%10 = fptosi double %9 to i32
%11 = add nsw i32 %10, 675
%12 = mul nsw i32 %2, 1000
%13 = add i32 %12, %4
%14 = add i32 %13, 1305
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %14)
%16 = add nsw i32 %1, %0
%17 = sdiv i32 %16, 2
%18 = sitofp i32 %17 to double
%19 = fmul double %18, %3
%20 = fptosi double %19 to i32
%21 = add nsw i32 %20, 675
%22 = add i32 %13, 1238
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %22)
%24 = sitofp i32 %1 to double
%25 = fmul double %24, %3
%26 = fptosi double %25 to i32
%27 = add nsw i32 %26, 675
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %27, i32 %14)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
ret void
}