#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ print_points(float, float, float, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  float x, y, direction;
  FILE *ppp;
  x = 0.0;
  y = 0.0;
  for (direction = 0.0; direction < 360.0; direction += 10.0) {
    ppp = popen("/usr/local/bin/gnuplot", "w");
    fprintf(ppp, "set term gif size 128,128\n");
    fprintf(ppp, "set data style linespoints\n");
    fprintf(ppp, "set output \"%0.3f.gif\"\n", direction / 1000.0);
    fprintf(ppp, "plot [-2:2] [-2:2] \"-\"\n");
    print_points(x, y, direction, ppp);
    fprintf(ppp, "e\n");
    fprintf(ppp, "quit\n");
    fclose(ppp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe81(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1265 <main+0x125>
lea    0xe88(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2f(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe84(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
mov    -0x28(%rbp),%rdi
call   1050 <print_points@plt>
mov    -0x28(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdbd(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    116e <main+0x2e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0xfffffff6,%r13d
lea    0xeed(%rip),%rbx
lea    0xefe(%rip),%rbp
lea    0xf0f(%rip),%r14
lea    0xf0b(%rip),%r15
add    $0xa,%r13d
xorps  %xmm0,%xmm0
cvtsi2ss %r13d,%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe65(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,%r12
mov    $0x1a,%esi
mov    $0x1,%edx
lea    0xe5e(%rip),%rdi
mov    %rax,%rcx
call   1070 <fwrite@plt>
mov    $0x1b,%esi
mov    $0x1,%edx
lea    0xe60(%rip),%rdi
mov    %r12,%rcx
call   1070 <fwrite@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xe0e(%rip),%xmm0
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %r12,%rcx
call   1070 <fwrite@plt>
xorpd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm2
mov    %r12,%rdi
call   1050 <print_points@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rdi
mov    %r12,%rcx
call   1070 <fwrite@plt>
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r12,%rcx
call   1070 <fwrite@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
cmp    $0x15e,%r13d
jb     1180 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/usr/local/bin/gnuplot\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [27 x i8] c"set term gif size 128,128\0A\00"
@.str.3 = [28 x i8] c"set data style linespoints\0A\00"
@.str.4 = [24 x i8] c"set output \22%0.3f.gif\22\0A\00"
@.str.5 = [24 x i8] c"plot [-2:2] [-2:2] \22-\22\0A\00"
@.str.6 = [3 x i8] c"e\0A\00"
@.str.7 = [6 x i8] c"quit\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
br label %10
10: ; preds = %38, %2
%11 = load float, float* %8
%12 = fpext float %11 to double
%13 = fcmp olt double %12, 3.600000e+02
br i1 %13, label %14, label %43
14: ; preds = %10
%15 = call i32* @popen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %9
%16 = load i32*, i32** %9
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32*, i32** %9
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32*, i32** %9
%21 = load float, float* %8
%22 = fpext float %21 to double
%23 = fdiv double %22, 1.000000e+03
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), double %23)
%25 = load i32*, i32** %9
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%27 = load float, float* %6
%28 = load float, float* %7
%29 = load float, float* %8
%30 = load i32*, i32** %9
%31 = call i32 @print_points(float %27, float %28, float %29, i32* %30)
%32 = load i32*, i32** %9
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%34 = load i32*, i32** %9
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%36 = load i32*, i32** %9
%37 = call i32 @fclose(i32* %36)
br label %38
38: ; preds = %14
%39 = load float, float* %8
%40 = fpext float %39 to double
%41 = fadd double %40, 1.000000e+01
%42 = fptrunc double %41 to float
store float %42, float* %8
br label %10
43: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"/usr/local/bin/gnuplot\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [27 x i8] c"set term gif size 128,128\0A\00"
@.str.3 = [28 x i8] c"set data style linespoints\0A\00"
@.str.4 = [24 x i8] c"set output \22%0.3f.gif\22\0A\00"
@.str.5 = [24 x i8] c"plot [-2:2] [-2:2] \22-\22\0A\00"
@.str.6 = [3 x i8] c"e\0A\00"
@.str.7 = [6 x i8] c"quit\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %17, %3 ]
%5 = sitofp i32 %4 to float
%6 = fpext float %5 to double
%7 = tail call i32* @popen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 26, i64 1, i32* %7)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %7)
%10 = fdiv double %6, 1.000000e+03
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), double %10)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i64 23, i64 1, i32* %7)
%13 = tail call i32 @print_points(float 0.000000e+00, float 0.000000e+00, float %5, i32* %7)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %7)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 5, i64 1, i32* %7)
%16 = tail call i32 @fclose(i32* %7)
%17 = add nuw nsw i32 %4, 10
%18 = icmp ult i32 %4, 350
br i1 %18, label %3, label %19
19: ; preds = %3
ret i32 0
}