#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*/ printf(char *, ...);
int main(int argc, char **argv) {
  int i, start, end, j;
  int spacing = 200;
  if (argc < 4) {
    printf("%s root start end (%s SD 0 31)\n", argv[0], argv[0]);
    return 0;
  }
  if (argc == 5)
    spacing = atoi(argv[4]);
  start = atoi(argv[2]);
  end = atoi(argv[3]);
  printf("v 20030223\n");
  for (i = start, j = 1; start < end ? i <= end : i >= end;
       i += start < end ?: -1, j++) {
    printf("N 200 %d %d %d 4\n{\n", j * spacing, 200 + 800, j * spacing);
    printf("T %d %d 5 10 1 1 0 0\n", 200 + 800 / 2, spacing * j + 30);
    printf("netname=%s%d\n}\n", argv[1], i);
  }
  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)
movl   $0xc8,-0x24(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    116f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12b1 <main+0x191>
cmpl   $0x5,-0x8(%rbp)
jne    1189 <main+0x69>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e6 <main+0xc6>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
jmp    11f7 <main+0xd7>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setge  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    $0x0,%eax
je     12aa <main+0x18a>
mov    -0x20(%rbp),%esi
imul   -0x24(%rbp),%esi
mov    -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
lea    0xe14(%rip),%rdi
mov    $0x3e8,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%edx
imul   -0x20(%rbp),%edx
add    $0x1e,%edx
lea    0xe0b(%rip),%rdi
mov    $0x258,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x14(%rbp),%edx
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x2c(%rbp)
test   $0x1,%al
jne    127b <main+0x15b>
jmp    1286 <main+0x166>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1293 <main+0x173>
mov    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1293 <main+0x173>
mov    -0x30(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c4 <main+0xa4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
cmp    $0x3,%edi
jg     115c <main+0x2c>
mov    (%r15),%rdx
lea    0xeb3(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1232 <main+0x102>
mov    $0xc8,%eax
cmp    $0x5,%edi
jne    116f <main+0x3f>
mov    0x20(%r15),%rdi
call   1050 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x10(%r15),%rdi
call   1050 <atoi@plt>
mov    %eax,%r12d
mov    0x18(%r15),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %ebx,%r12d
setle  %al
setge  %cl
cmovl  %eax,%ecx
cmp    $0x1,%cl
jne    1232 <main+0x102>
xor    %eax,%eax
cmp    %ebx,%r12d
setl   %al
lea    (%rax,%rax,1),%r14d
add    $0xffffffff,%r14d
mov    0x4(%rsp),%eax
mov    %eax,%r13d
mov    %r12d,%ebp
nopl   0x0(%rax)
lea    0xe49(%rip),%rdi
mov    %r13d,%esi
mov    $0x3e8,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1e(%r13),%edx
lea    0xe40(%rip),%rdi
mov    $0x258,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r15),%rsi
lea    0xe3f(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    %r14d,%ebp
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %ebx,%ebp
setle  %al
setge  %cl
cmp    %ebx,%r12d
cmovl  %eax,%ecx
add    0x4(%rsp),%r13d
test   %cl,%cl
jne    11d0 <main+0xa0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"%s root start end (%s SD 0 31)\0A\00"
@.str.1 = [12 x i8] c"v 20030223\0A\00"
@.str.2 = [20 x i8] c"N 200 %d %d %d 4\0A{\0A\00"
@.str.3 = [22 x i8] c"T %d %d 5 10 1 1 0 0\0A\00"
@.str.4 = [16 x i8] c"netname=%s%d\0A}\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 i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 200, i32* %10
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %19)
store i32 0, i32* %3
br label %89
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 5
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 4
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %10
br label %29
29: ; preds = %24, %21
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %7
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %8
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32, i32* %7
store i32 %39, i32* %6
store i32 1, i32* %9
br label %40
40: ; preds = %82, %29
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load i32, i32* %6
%46 = load i32, i32* %8
%47 = icmp sle i32 %45, %46
%48 = zext i1 %47 to i32
br label %54
49: ; preds = %40
%50 = load i32, i32* %6
%51 = load i32, i32* %8
%52 = icmp sge i32 %50, %51
%53 = zext i1 %52 to i32
br label %54
54: ; preds = %49, %44
%55 = phi i32 [ %48, %44 ], [ %53, %49 ]
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %88
57: ; preds = %54
%58 = load i32, i32* %9
%59 = load i32, i32* %10
%60 = mul nsw i32 %58, %59
%61 = load i32, i32* %9
%62 = load i32, i32* %10
%63 = mul nsw i32 %61, %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %60, i32 1000, i32 %63)
%65 = load i32, i32* %10
%66 = load i32, i32* %9
%67 = mul nsw i32 %65, %66
%68 = add nsw i32 %67, 30
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 600, i32 %68)
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = load i32, i32* %6
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %72, i32 %73)
br label %75
75: ; preds = %57
%76 = load i32, i32* %7
%77 = load i32, i32* %8
%78 = icmp slt i32 %76, %77
%79 = zext i1 %78 to i32
br i1 %78, label %80, label %81
80: ; preds = %75
br label %82
81: ; preds = %75
br label %82
82: ; preds = %81, %80
%83 = phi i32 [ %79, %80 ], [ -1, %81 ]
%84 = load i32, i32* %6
%85 = add nsw i32 %84, %83
store i32 %85, i32* %6
%86 = load i32, i32* %9
%87 = add nsw i32 %86, 1
store i32 %87, i32* %9
br label %40
88: ; preds = %54
store i32 0, i32* %3
br label %89
89: ; preds = %88, %13
%90 = load i32, i32* %3
ret i32 %90
}

LLVM IR (-O2):
@.str = [32 x i8] c"%s root start end (%s SD 0 31)\0A\00"
@.str.2 = [20 x i8] c"N 200 %d %d %d 4\0A{\0A\00"
@.str.3 = [22 x i8] c"T %d %d 5 10 1 1 0 0\0A\00"
@.str.4 = [16 x i8] c"netname=%s%d\0A}\0A\00"
@str = [11 x i8] c"v 20030223\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %5)
br label %43
7: ; preds = %2
%8 = icmp eq i32 %0, 5
br i1 %8, label %9, label %13
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 4
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
br label %13
13: ; preds = %9, %7
%14 = phi i32 [ %12, %9 ], [ 200, %7 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%22 = icmp slt i32 %17, %20
%23 = icmp sle i32 %17, %20
%24 = icmp sge i32 %17, %20
%25 = select i1 %22, i1 %23, i1 %24
br i1 %25, label %26, label %43
26: ; preds = %13
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = select i1 %22, i32 1, i32 -1
br label %29
29: ; preds = %26, %29
%30 = phi i32 [ 1, %26 ], [ %39, %29 ]
%31 = phi i32 [ %17, %26 ], [ %38, %29 ]
%32 = mul nsw i32 %30, %14
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 1000, i32 %32)
%34 = add nsw i32 %32, 30
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 600, i32 %34)
%36 = load i8*, i8** %27
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %36, i32 %31)
%38 = add nsw i32 %31, %28
%39 = add nuw nsw i32 %30, 1
%40 = icmp sle i32 %38, %20
%41 = icmp sge i32 %38, %20
%42 = select i1 %22, i1 %40, i1 %41
br i1 %42, label %29, label %43
43: ; preds = %29, %13, %4
ret i32 0
}