#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int /*<<< orphan*/ stderr;
int system(char *);
int main(int ac, char *av[]) {
  if (ac < 1)
    return 1;
  int c = atoi(av[1]);
  int i;
  char bfr[256];
  for (i = 0; i < c; i++) {
    snprintf(bfr, 256,
             "apl --LX \"z←'libaplplot.so' ⎕FX 'plot'\" --eval \"z←'bgblack; "
             "file frame%04d.png' plot 2○(%d+⍳128)÷6\"",
             i, i);
    int rc = system(bfr);
    fprintf(stderr, "%d\n", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    116f <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    11e9 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e9 <main+0xa9>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x100,%esi
lea    0xe54(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x120(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x124(%rbp)
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xe99(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1186 <main+0x46>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
test   %edi,%edi
jle    11d7 <main+0x97>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jle    11c3 <main+0x83>
mov    %eax,%r15d
xor    %ebp,%ebp
lea    0xe8e(%rip),%r14
mov    %rsp,%rbx
mov    0x2e64(%rip),%r13
lea    0xeec(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
mov    %ebp,%ecx
mov    %ebp,%r8d
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %ebp,%edx
call   1050 <fprintf@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [111 x i8] c"apl --LX \22z\E2\86\90'libaplplot.so' \E2\8E\95FX 'plot'\22 --eval \22z\E2\86\90'bgblack; file frame%04d.png' plot 2\E2\97\8B(%d+\E2\8D\B3128)\C3\B76\22\00"
@stderr = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %35
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %6
store i32 0, i32* %7
br label %18
18: ; preds = %32, %13
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%24 = load i32, i32* %7
%25 = load i32, i32* %7
%26 = call i32 @snprintf(i8* %23, i32 256, i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25)
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%28 = call i32 @system(i8* %27)
store i32 %28, i32* %9
%29 = load i32, i32* @stderr
%30 = load i32, i32* %7
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %22
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %18
35: ; preds = %12, %18
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [111 x i8] c"apl --LX \22z\E2\86\90'libaplplot.so' \E2\8E\95FX 'plot'\22 --eval \22z\E2\86\90'bgblack; file frame%04d.png' plot 2\E2\97\8B(%d+\E2\8D\B3128)\C3\B76\22\00"
@stderr = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = icmp slt i32 %0, 1
br i1 %4, label %20, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %19
11: ; preds = %5, %11
%12 = phi i32 [ %17, %11 ], [ 0, %5 ]
%13 = call i32 @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %12)
%14 = call i32 @system(i8* %9)
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%17 = add nuw nsw i32 %12, 1
%18 = icmp eq i32 %17, %8
br i1 %18, label %19, label %11
19: ; preds = %11, %5
br label %20
20: ; preds = %2, %19
%21 = phi i32 [ 0, %19 ], [ 1, %2 ]
ret i32 %21
}