#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stdout;
main(int argc, char **argv) {
  int sec, i, j, seg, strip;
  int rcout = 1;
  int icout = 1;
  char name[256];
  char spname[256], csname[256];
  double offset;
  double cur_base = 1.23684e-05, cur_var;
  double res_base = 1.6, res_var;
  double length, width = 0.8;
  FILE *fp;
  setbuf(stdout, 0);
  printf("#segment(#(row):");
  scanf("%d", &seg);
  printf("# R-I section in each segment:");
  scanf("%d", &sec);
  printf("# strip in each segment:");
  scanf("%d", &strip);
  printf("fileroot:");
  scanf("%s", name);
  printf("voltage offset:");
  scanf("%lf", &offset);
  printf("#seg(#row): %d\n", seg);
  printf("#sec(R-I section): %d\n", sec);
  printf("#vertical strip: %d\n", strip);
  printf("filename: %s\n", name);
  printf("voltage offset: %g\n", offset);
  if (strip >= sec) {
    printf("Invalid p/g strip number %d", strip);
    exit(-1);
  }
  sprintf(spname, "%s.sp", name);
  sprintf(csname, "%s.cs", name);
  fp = fopen(spname, "w");
  if (!fp) {
    perror(spname);
    exit(-1);
  }
  fprintf(fp, "num_node %d\n", sec * seg);
  fprintf(fp, "matrix_size %d\n\n", sec * seg);
  fprintf(fp, "* %d x %d ground network\n", seg, sec);
  for (j = 0; j < seg; j++) {
    fprintf(fp, "*seg: %d\n", j + 1);
    if ((seg - j) > 1) {
      int interval = sec / strip;
      if (interval < 3) {
        printf("Serise chain circuit is too small: %d", interval);
        exit(-1);
      }
      fprintf(fp, "* inter-segment connection\n");
      for (i = 0; i < strip; i++) {
        fprintf(fp, "R%d %d %d 6.16 0.8 49.28 37\n", rcout++,
                j * sec + interval * (i + 1),
                (j + 1) * sec + interval * (i + 1));
      }
    }
    fprintf(fp, "R%d %d %d 2.5 0.8 20 37\n", rcout++, 0, j * sec + 1);
    for (i = 1; i < sec; i++) {
      cur_var = cur_base * ((rand() % 10) / 100.0);
      fprintf(fp, "I%d %d %d %g\n", icout++, 0, (i + j * sec),
              cur_base + cur_var);
      res_var = res_base * ((rand() % 10) / 100.0);
      length = width * (res_var + res_base) * 10.0;
      fprintf(fp, "R%d %d %d %g %g %g 37\n", rcout++, (i + j * sec),
              (i + 1 + j * sec), res_base + res_var, width, length);
    }
    fprintf(fp, "I%d %d %d 1.23684e-05\n", icout++, 0, (i + j * sec));
    fprintf(fp, "R%d %d %d 2.5 0.8 20 37\n", rcout++, (i + j * sec), 0);
  }
  fprintf(fp, "\n.op");
  fprintf(fp, "\n.end");
  fclose(fp);
  fp = fopen(csname, "w");
  if (!fp) {
    perror(csname);
    exit(-1);
  }
  fprintf(fp, "*layer information\n");
  fprintf(fp, "*Layer INDEX UNIT_RES MIN_WIDTH MAX_CURRENT_DEN\n");
  fprintf(fp, "LAYER 37 0.1 0.4 1.7\n");
  fprintf(fp, "\n*voltage constraint\n");
  for (i = 1; i <= seg * sec; i++) {
    fprintf(fp, "CONST v(%d) <= %g\n", i, offset);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x390,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movsd  0xe41(%rip),%xmm0
movsd  %xmm0,-0x340(%rbp)
ff
movsd  0xe29(%rip),%xmm0
movsd  %xmm0,-0x350(%rbp)
ff
movsd  0xe11(%rip),%xmm0
movsd  %xmm0,-0x368(%rbp)
ff
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf63(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf43(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf23(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdef(%rip),%rdi
lea    -0x338(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x20(%rbp),%esi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x338(%rbp),%xmm0
ff
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1332 <main+0x192>
mov    -0x24(%rbp),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    -0x230(%rbp),%rdi
lea    -0x130(%rbp),%rdx
lea    0xdc5(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x330(%rbp),%rdi
lea    -0x130(%rbp),%rdx
lea    0xdb1(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x230(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x370(%rbp)
cmpq   $0x0,-0x370(%rbp)
jne    13a4 <main+0x204>
lea    -0x230(%rbp),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x370(%rbp),%rdi
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
lea    0xd61(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
lea    0xd52(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xd48(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    170f <main+0x56f>
mov    -0x370(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
lea    0xd34(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
cmp    $0x1,%eax
jle    14fe <main+0x35e>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x374(%rbp)
cmpl   $0x3,-0x374(%rbp)
jge    146c <main+0x2cc>
mov    -0x374(%rbp),%esi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x370(%rbp),%rdi
lea    0xd08(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14f9 <main+0x359>
mov    -0x370(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%ecx
imul   -0x14(%rbp),%ecx
mov    -0x374(%rbp),%eax
mov    -0x18(%rbp),%esi
add    $0x1,%esi
imul   %esi,%eax
add    %eax,%ecx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
imul   -0x14(%rbp),%r8d
mov    -0x374(%rbp),%eax
mov    -0x18(%rbp),%esi
add    $0x1,%esi
imul   %esi,%eax
add    %eax,%r8d
lea    0xcba(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1488 <main+0x2e8>
jmp    14fe <main+0x35e>
mov    -0x370(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%r8d
imul   -0x14(%rbp),%r8d
add    $0x1,%r8d
lea    0xc97(%rip),%rsi
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    16a2 <main+0x502>
movsd  -0x340(%rbp),%xmm0
ff
movsd  %xmm0,-0x388(%rbp)
ff
mov    $0x0,%al
call   10c0 <rand@plt>
movsd  -0x388(%rbp),%xmm0
ff
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm1
movsd  0xaad(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x348(%rbp)
ff
mov    -0x370(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%r8d
movsd  -0x340(%rbp),%xmm0
ff
addsd  -0x348(%rbp),%xmm0
ff
lea    0xc1a(%rip),%rsi
xor    %ecx,%ecx
mov    $0x1,%al
call   1060 <fprintf@plt>
movsd  -0x350(%rbp),%xmm0
ff
movsd  %xmm0,-0x380(%rbp)
ff
mov    $0x0,%al
call   10c0 <rand@plt>
movsd  -0x380(%rbp),%xmm0
ff
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm1
movsd  0xa2a(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x358(%rbp)
ff
movsd  -0x368(%rbp),%xmm0
ff
movsd  -0x358(%rbp),%xmm1
ff
addsd  -0x350(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0x9ee(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x360(%rbp)
ff
mov    -0x370(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%ecx
mov    -0x18(%rbp),%r8d
add    $0x1,%r8d
mov    -0x1c(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%r8d
movsd  -0x350(%rbp),%xmm0
ff
addsd  -0x358(%rbp),%xmm0
ff
movsd  -0x368(%rbp),%xmm1
ff
movsd  -0x360(%rbp),%xmm2
ff
lea    0xb55(%rip),%rsi
mov    $0x3,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1534 <main+0x394>
mov    -0x370(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%r8d
lea    0xb30(%rip),%rsi
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%ecx
lea    0xac4(%rip),%rsi
xor    %r8d,%r8d
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13fe <main+0x25e>
mov    -0x370(%rbp),%rdi
lea    0xaf3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
lea    0xae3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x330(%rbp),%rdi
lea    0x9c5(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x370(%rbp)
cmpq   $0x0,-0x370(%rbp)
jne    1783 <main+0x5e3>
lea    -0x330(%rbp),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x370(%rbp),%rdi
lea    0xa8a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
lea    0xa89(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
lea    0xaa5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x370(%rbp),%rdi
lea    0xaa6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jg     181e <main+0x67e>
mov    -0x370(%rbp),%rdi
mov    -0x18(%rbp),%edx
movsd  -0x338(%rbp),%xmm0
ff
lea    0xa83(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    17de <main+0x63e>
mov    -0x370(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x390,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x348,%rsp
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
lea    0xe50(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf99(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe3b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe37(%rip),%rdi
lea    0x240(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe21(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe23(%rip),%rdi
lea    0x38(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xe0e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xe13(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe1a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0x38(%rsp),%xmm0
lea    0xe11(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
cmp    0x8(%rsp),%esi
jge    178c <main+0x5dc>
lea    0xe25(%rip),%rsi
lea    0x140(%rsp),%rbx
lea    0x240(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rdx
call   10a0 <sprintf@plt>
lea    0xe09(%rip),%rsi
lea    0x40(%rsp),%rdi
mov    %rbp,%rdx
call   10a0 <sprintf@plt>
lea    0xdfb(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1795 <main+0x5e5>
mov    %rax,%rbx
mov    0xc(%rsp),%edx
imul   0x8(%rsp),%edx
lea    0xdd9(%rip),%rsi
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0xc(%rsp),%edx
imul   0x8(%rsp),%edx
lea    0xdcc(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xdc4(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1655 <main+0x4a5>
mov    $0x1,%eax
xor    %r13d,%r13d
mov    $0x1,%r14d
mov    $0x1,%ebp
mov    %rbx,0x18(%rsp)
jmp    141e <main+0x26e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r14),%r12d
mov    $0x1,%r15d
mov    %rbp,%rdx
add    $0x1,%ebp
imul   %r13d,%r8d
add    %r15d,%r8d
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
lea    0xe23(%rip),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x2,%r14d
imul   0x8(%rsp),%r13d
add    %r15d,%r13d
mov    %rbx,%rdi
lea    0xdc5(%rip),%rsi
mov    %r12d,%edx
mov    %r13d,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
mov    0x2c(%rsp),%ecx
mov    %ecx,%r13d
cmp    0xc(%rsp),%ecx
jge    1655 <main+0x4a5>
mov    %eax,0x14(%rsp)
lea    0x1(%r13),%edx
mov    %rbx,%rdi
lea    0xd22(%rip),%rsi
mov    %edx,0x2c(%rsp)
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0xc(%rsp),%eax
sub    %r13d,%eax
cmp    $0x2,%eax
jl     14d5 <main+0x325>
mov    0x8(%rsp),%eax
cltd
idivl  0x10(%rsp)
mov    %eax,%r15d
cmp    $0x2,%eax
jle    1771 <main+0x5c1>
mov    $0x1b,%esi
mov    $0x1,%edx
lea    0xd11(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
cmpl   $0x0,0x10(%rsp)
jle    14d5 <main+0x325>
mov    %rbp,0x20(%rsp)
xor    %ebx,%ebx
mov    %r15d,%ebp
mov    0x14(%rsp),%r12d
nop
lea    (%r14,%rbx,1),%edx
mov    0x8(%rsp),%r8d
add    $0x1,%ebx
mov    %r13d,%ecx
imul   %r8d,%ecx
add    %ebp,%ecx
imul   %r12d,%r8d
add    %ebp,%r8d
mov    0x18(%rsp),%rdi
lea    0xce6(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
add    %r15d,%ebp
cmp    0x10(%rsp),%ebx
jl     1490 <main+0x2e0>
add    %ebx,%r14d
mov    0x18(%rsp),%rbx
mov    0x20(%rsp),%rbp
mov    0x8(%rsp),%r8d
imul   %r13d,%r8d
add    $0x1,%r8d
mov    %rbx,%rdi
lea    0xccf(%rip),%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x8(%rsp),%r8d
cmp    $0x2,%r8d
jl     13b0 <main+0x200>
mov    %r13,0x30(%rsp)
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15d,%r12d
add    $0x1,%r14d
mov    %r14,0x20(%rsp)
lea    (%r12,%rbp,1),%ebx
add    $0xffffffff,%ebx
xor    %eax,%eax
call   10d0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xa9a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xa96(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x8(%rsp),%r8d
mov    0x30(%rsp),%r13
imul   %r13d,%r8d
add    %r15d,%r8d
addsd  %xmm1,%xmm0
mov    0x18(%rsp),%r14
mov    %r14,%rdi
lea    0xc3a(%rip),%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    $0x1,%al
call   1060 <fprintf@plt>
xor    %eax,%eax
call   10d0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xa28(%rip),%xmm0
movsd  0xa30(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,%xmm2
movsd  0xa24(%rip),%xmm1
mulsd  %xmm1,%xmm2
mulsd  0xa20(%rip),%xmm2
lea    0x1(%r12),%r15d
mov    0x8(%rsp),%eax
imul   %r13d,%eax
mov    %r12d,%ecx
add    %eax,%ecx
lea    (%r12,%rax,1),%r8d
add    $0x1,%r8d
mov    %r14,%rdi
mov    0x20(%rsp),%r14
lea    0xbb9(%rip),%rsi
mov    %r14d,%edx
mov    $0x3,%al
call   1060 <fprintf@plt>
mov    0x8(%rsp),%r8d
cmp    %r8d,%r15d
jl     1520 <main+0x370>
lea    0x1(%r14),%r12d
add    %r15d,%ebp
add    $0xffffffff,%ebp
mov    0x30(%rsp),%r13
jmp    13ba <main+0x20a>
lea    0xbb4(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xba0(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xa82(%rip),%rsi
lea    0x40(%rsp),%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     179f <main+0x5ef>
mov    %rax,%rbx
lea    0xb68(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xb63(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xb7b(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xb78(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    0x8(%rsp),%eax
imul   0xc(%rsp),%eax
test   %eax,%eax
jle    1755 <main+0x5a5>
xor    %ebp,%ebp
lea    0xb66(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    0x8(%rsp),%eax
imul   0xc(%rsp),%eax
cmp    %eax,%ebp
jl     1730 <main+0x580>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x348,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x9e4(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0x95d(%rip),%rdi
jmp    177b <main+0x5cb>
lea    0x140(%rsp),%rdi
jmp    17a4 <main+0x5f4>
lea    0x40(%rsp),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"#segment(#(row):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"# R-I section in each segment:\00"
@.str.3 = [25 x i8] c"# strip in each segment:\00"
@.str.4 = [10 x i8] c"fileroot:\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [16 x i8] c"voltage offset:\00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [16 x i8] c"#seg(#row): %d\0A\00"
@.str.9 = [23 x i8] c"#sec(R-I section): %d\0A\00"
@.str.10 = [21 x i8] c"#vertical strip: %d\0A\00"
@.str.11 = [14 x i8] c"filename: %s\0A\00"
@.str.12 = [20 x i8] c"voltage offset: %g\0A\00"
@.str.13 = [28 x i8] c"Invalid p/g strip number %d\00"
@.str.14 = [6 x i8] c"%s.sp\00"
@.str.15 = [6 x i8] c"%s.cs\00"
@.str.16 = [2 x i8] c"w\00"
@.str.17 = [13 x i8] c"num_node %d\0A\00"
@.str.18 = [17 x i8] c"matrix_size %d\0A\0A\00"
@.str.19 = [26 x i8] c"* %d x %d ground network\0A\00"
@.str.20 = [10 x i8] c"*seg: %d\0A\00"
@.str.21 = [38 x i8] c"Serise chain circuit is too small: %d\00"
@.str.22 = [28 x i8] c"* inter-segment connection\0A\00"
@.str.23 = [29 x i8] c"R%d %d %d 6.16 0.8 49.28 37\0A\00"
@.str.24 = [25 x i8] c"R%d %d %d 2.5 0.8 20 37\0A\00"
@.str.25 = [14 x i8] c"I%d %d %d %g\0A\00"
@.str.26 = [23 x i8] c"R%d %d %d %g %g %g 37\0A\00"
@.str.27 = [23 x i8] c"I%d %d %d 1.23684e-05\0A\00"
@.str.28 = [5 x i8] c"\0A.op\00"
@.str.29 = [6 x i8] c"\0A.end\00"
@.str.30 = [20 x i8] c"*layer information\0A\00"
@.str.31 = [49 x i8] c"*Layer INDEX UNIT_RES MIN_WIDTH MAX_CURRENT_DEN\0A\00"
@.str.32 = [22 x i8] c"LAYER 37 0.1 0.4 1.7\0A\00"
@.str.33 = [22 x i8] c"\0A*voltage constraint\0A\00"
@.str.34 = [19 x i8] c"CONST v(%d) <= %g\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
%11 = alloca i32
%12 = alloca i32
%13 = alloca [256 x i8]
%14 = alloca [256 x i8]
%15 = alloca [256 x i8]
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca i32*
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %11
store i32 1, i32* %12
store double 1.236840e-05, double* %17
store double 1.600000e+00, double* %19
store double 8.000000e-01, double* %22
%25 = load i32, i32* @stdout
%26 = call i32 @setbuf(i32 %25, i32 0)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %16)
%38 = load i32, i32* %9
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %10
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %44)
%46 = load double, double* %16
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), double %46)
%48 = load i32, i32* %10
%49 = load i32, i32* %6
%50 = icmp sge i32 %48, %49
br i1 %50, label %51, label %55
51: ; preds = %2
%52 = load i32, i32* %10
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i32 %52)
%54 = call i32 @exit(i32 -1)
unreachable
55: ; preds = %2
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%58 = call i32 @sprintf(i8* %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %57)
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%61 = call i32 @sprintf(i8* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* %60)
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
store i32* %63, i32** %23
%64 = load i32*, i32** %23
%65 = icmp ne i32* %64, null
br i1 %65, label %70, label %66
66: ; preds = %55
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%68 = call i32 @perror(i8* %67)
%69 = call i32 @exit(i32 -1)
unreachable
70: ; preds = %55
%71 = load i32*, i32** %23
%72 = load i32, i32* %6
%73 = load i32, i32* %9
%74 = mul nsw i32 %72, %73
%75 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), i32 %74)
%76 = load i32*, i32** %23
%77 = load i32, i32* %6
%78 = load i32, i32* %9
%79 = mul nsw i32 %77, %78
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %76, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i32 %79)
%81 = load i32*, i32** %23
%82 = load i32, i32* %9
%83 = load i32, i32* %6
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %81, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0), i32 %82, i32 %83)
store i32 0, i32* %8
br label %85
85: ; preds = %227, %70
%86 = load i32, i32* %8
%87 = load i32, i32* %9
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %230
89: ; preds = %85
%90 = load i32*, i32** %23
%91 = load i32, i32* %8
%92 = add nsw i32 %91, 1
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %9
%95 = load i32, i32* %8
%96 = sub nsw i32 %94, %95
%97 = icmp sgt i32 %96, 1
br i1 %97, label %98, label %141
98: ; preds = %89
%99 = load i32, i32* %6
%100 = load i32, i32* %10
%101 = sdiv i32 %99, %100
store i32 %101, i32* %24
%102 = load i32, i32* %24
%103 = icmp slt i32 %102, 3
br i1 %103, label %104, label %108
104: ; preds = %98
%105 = load i32, i32* %24
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.21, i64 0, i64 0), i32 %105)
%107 = call i32 @exit(i32 -1)
unreachable
108: ; preds = %98
%109 = load i32*, i32** %23
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %109, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0))
store i32 0, i32* %7
br label %111
111: ; preds = %137, %108
%112 = load i32, i32* %7
%113 = load i32, i32* %10
%114 = icmp slt i32 %112, %113
br i1 %114, label %115, label %140
115: ; preds = %111
%116 = load i32*, i32** %23
%117 = load i32, i32* %11
%118 = add nsw i32 %117, 1
store i32 %118, i32* %11
%119 = load i32, i32* %8
%120 = load i32, i32* %6
%121 = mul nsw i32 %119, %120
%122 = load i32, i32* %24
%123 = load i32, i32* %7
%124 = add nsw i32 %123, 1
%125 = mul nsw i32 %122, %124
%126 = add nsw i32 %121, %125
%127 = load i32, i32* %8
%128 = add nsw i32 %127, 1
%129 = load i32, i32* %6
%130 = mul nsw i32 %128, %129
%131 = load i32, i32* %24
%132 = load i32, i32* %7
%133 = add nsw i32 %132, 1
%134 = mul nsw i32 %131, %133
%135 = add nsw i32 %130, %134
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %116, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0), i32 %117, i32 %126, i32 %135)
br label %137
137: ; preds = %115
%138 = load i32, i32* %7
%139 = add nsw i32 %138, 1
store i32 %139, i32* %7
br label %111
140: ; preds = %111
br label %141
141: ; preds = %140, %89
%142 = load i32*, i32** %23
%143 = load i32, i32* %11
%144 = add nsw i32 %143, 1
store i32 %144, i32* %11
%145 = load i32, i32* %8
%146 = load i32, i32* %6
%147 = mul nsw i32 %145, %146
%148 = add nsw i32 %147, 1
%149 = call i32 (i32*, i8*, ...) @fprintf(i32* %142, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.24, i64 0, i64 0), i32 %143, i32 0, i32 %148)
store i32 1, i32* %7
br label %150
150: ; preds = %205, %141
%151 = load i32, i32* %7
%152 = load i32, i32* %6
%153 = icmp slt i32 %151, %152
br i1 %153, label %154, label %208
154: ; preds = %150
%155 = load double, double* %17
%156 = call i32 (...) @rand()
%157 = srem i32 %156, 10
%158 = sitofp i32 %157 to double
%159 = fdiv double %158, 1.000000e+02
%160 = fmul double %155, %159
store double %160, double* %18
%161 = load i32*, i32** %23
%162 = load i32, i32* %12
%163 = add nsw i32 %162, 1
store i32 %163, i32* %12
%164 = load i32, i32* %7
%165 = load i32, i32* %8
%166 = load i32, i32* %6
%167 = mul nsw i32 %165, %166
%168 = add nsw i32 %164, %167
%169 = load double, double* %17
%170 = load double, double* %18
%171 = fadd double %169, %170
%172 = call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0), i32 %162, i32 0, i32 %168, double %171)
%173 = load double, double* %19
%174 = call i32 (...) @rand()
%175 = srem i32 %174, 10
%176 = sitofp i32 %175 to double
%177 = fdiv double %176, 1.000000e+02
%178 = fmul double %173, %177
store double %178, double* %20
%179 = load double, double* %22
%180 = load double, double* %20
%181 = load double, double* %19
%182 = fadd double %180, %181
%183 = fmul double %179, %182
%184 = fmul double %183, 1.000000e+01
store double %184, double* %21
%185 = load i32*, i32** %23
%186 = load i32, i32* %11
%187 = add nsw i32 %186, 1
store i32 %187, i32* %11
%188 = load i32, i32* %7
%189 = load i32, i32* %8
%190 = load i32, i32* %6
%191 = mul nsw i32 %189, %190
%192 = add nsw i32 %188, %191
%193 = load i32, i32* %7
%194 = add nsw i32 %193, 1
%195 = load i32, i32* %8
%196 = load i32, i32* %6
%197 = mul nsw i32 %195, %196
%198 = add nsw i32 %194, %197
%199 = load double, double* %19
%200 = load double, double* %20
%201 = fadd double %199, %200
%202 = load double, double* %22
%203 = load double, double* %21
%204 = call i32 (i32*, i8*, ...) @fprintf(i32* %185, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.26, i64 0, i64 0), i32 %186, i32 %192, i32 %198, double %201, double %202, double %203)
br label %205
205: ; preds = %154
%206 = load i32, i32* %7
%207 = add nsw i32 %206, 1
store i32 %207, i32* %7
br label %150
208: ; preds = %150
%209 = load i32*, i32** %23
%210 = load i32, i32* %12
%211 = add nsw i32 %210, 1
store i32 %211, i32* %12
%212 = load i32, i32* %7
%213 = load i32, i32* %8
%214 = load i32, i32* %6
%215 = mul nsw i32 %213, %214
%216 = add nsw i32 %212, %215
%217 = call i32 (i32*, i8*, ...) @fprintf(i32* %209, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.27, i64 0, i64 0), i32 %210, i32 0, i32 %216)
%218 = load i32*, i32** %23
%219 = load i32, i32* %11
%220 = add nsw i32 %219, 1
store i32 %220, i32* %11
%221 = load i32, i32* %7
%222 = load i32, i32* %8
%223 = load i32, i32* %6
%224 = mul nsw i32 %222, %223
%225 = add nsw i32 %221, %224
%226 = call i32 (i32*, i8*, ...) @fprintf(i32* %218, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.24, i64 0, i64 0), i32 %219, i32 %225, i32 0)
br label %227
227: ; preds = %208
%228 = load i32, i32* %8
%229 = add nsw i32 %228, 1
store i32 %229, i32* %8
br label %85
230: ; preds = %85
%231 = load i32*, i32** %23
%232 = call i32 (i32*, i8*, ...) @fprintf(i32* %231, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i64 0, i64 0))
%233 = load i32*, i32** %23
%234 = call i32 (i32*, i8*, ...) @fprintf(i32* %233, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0))
%235 = load i32*, i32** %23
%236 = call i32 @fclose(i32* %235)
%237 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%238 = call i32* @fopen(i8* %237, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
store i32* %238, i32** %23
%239 = load i32*, i32** %23
%240 = icmp ne i32* %239, null
br i1 %240, label %245, label %241
241: ; preds = %230
%242 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%243 = call i32 @perror(i8* %242)
%244 = call i32 @exit(i32 -1)
unreachable
245: ; preds = %230
%246 = load i32*, i32** %23
%247 = call i32 (i32*, i8*, ...) @fprintf(i32* %246, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.30, i64 0, i64 0))
%248 = load i32*, i32** %23
%249 = call i32 (i32*, i8*, ...) @fprintf(i32* %248, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.31, i64 0, i64 0))
%250 = load i32*, i32** %23
%251 = call i32 (i32*, i8*, ...) @fprintf(i32* %250, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.32, i64 0, i64 0))
%252 = load i32*, i32** %23
%253 = call i32 (i32*, i8*, ...) @fprintf(i32* %252, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.33, i64 0, i64 0))
store i32 1, i32* %7
br label %254
254: ; preds = %265, %245
%255 = load i32, i32* %7
%256 = load i32, i32* %9
%257 = load i32, i32* %6
%258 = mul nsw i32 %256, %257
%259 = icmp sle i32 %255, %258
br i1 %259, label %260, label %268
260: ; preds = %254
%261 = load i32*, i32** %23
%262 = load i32, i32* %7
%263 = load double, double* %16
%264 = call i32 (i32*, i8*, ...) @fprintf(i32* %261, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.34, i64 0, i64 0), i32 %262, double %263)
br label %265
265: ; preds = %260
%266 = load i32, i32* %7
%267 = add nsw i32 %266, 1
store i32 %267, i32* %7
br label %254
268: ; preds = %254
%269 = load i32*, i32** %23
%270 = call i32 @fclose(i32* %269)
%271 = load i32, i32* %3
ret i32 %271
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"#segment(#(row):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"# R-I section in each segment:\00"
@.str.3 = [25 x i8] c"# strip in each segment:\00"
@.str.4 = [10 x i8] c"fileroot:\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [16 x i8] c"voltage offset:\00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [16 x i8] c"#seg(#row): %d\0A\00"
@.str.9 = [23 x i8] c"#sec(R-I section): %d\0A\00"
@.str.10 = [21 x i8] c"#vertical strip: %d\0A\00"
@.str.11 = [14 x i8] c"filename: %s\0A\00"
@.str.12 = [20 x i8] c"voltage offset: %g\0A\00"
@.str.13 = [28 x i8] c"Invalid p/g strip number %d\00"
@.str.14 = [6 x i8] c"%s.sp\00"
@.str.15 = [6 x i8] c"%s.cs\00"
@.str.16 = [2 x i8] c"w\00"
@.str.17 = [13 x i8] c"num_node %d\0A\00"
@.str.18 = [17 x i8] c"matrix_size %d\0A\0A\00"
@.str.19 = [26 x i8] c"* %d x %d ground network\0A\00"
@.str.20 = [10 x i8] c"*seg: %d\0A\00"
@.str.21 = [38 x i8] c"Serise chain circuit is too small: %d\00"
@.str.22 = [28 x i8] c"* inter-segment connection\0A\00"
@.str.23 = [29 x i8] c"R%d %d %d 6.16 0.8 49.28 37\0A\00"
@.str.24 = [25 x i8] c"R%d %d %d 2.5 0.8 20 37\0A\00"
@.str.25 = [14 x i8] c"I%d %d %d %g\0A\00"
@.str.26 = [23 x i8] c"R%d %d %d %g %g %g 37\0A\00"
@.str.27 = [23 x i8] c"I%d %d %d 1.23684e-05\0A\00"
@.str.28 = [5 x i8] c"\0A.op\00"
@.str.29 = [6 x i8] c"\0A.end\00"
@.str.30 = [20 x i8] c"*layer information\0A\00"
@.str.31 = [49 x i8] c"*Layer INDEX UNIT_RES MIN_WIDTH MAX_CURRENT_DEN\0A\00"
@.str.32 = [22 x i8] c"LAYER 37 0.1 0.4 1.7\0A\00"
@.str.33 = [22 x i8] c"\0A*voltage constraint\0A\00"
@.str.34 = [19 x i8] c"CONST v(%d) <= %g\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = alloca double
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%16 = bitcast double* %9 to i8*
%17 = load i32, i32* @stdout
%18 = tail call i32 @setbuf(i32 %17, i32 0)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %9)
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %5
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %13)
%36 = load double, double* %9
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), double %36)
%38 = load i32, i32* %5
%39 = load i32, i32* %3
%40 = icmp slt i32 %38, %39
br i1 %40, label %44, label %41
41: ; preds = %2
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i32 %38)
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %2
%45 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %13)
%46 = call i32 @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* %13)
%47 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = call i32 @perror(i8* %14)
%51 = call i32 @exit(i32 -1)
unreachable
52: ; preds = %44
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = mul nsw i32 %54, %53
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %3
%58 = load i32, i32* %4
%59 = mul nsw i32 %58, %57
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %4
%62 = load i32, i32* %3
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0), i32 %61, i32 %62)
%64 = load i32, i32* %4
%65 = icmp sgt i32 %64, 0
br i1 %65, label %66, label %159
66: ; preds = %52, %142
%67 = phi i32 [ %70, %142 ], [ 0, %52 ]
%68 = phi i32 [ %152, %142 ], [ 1, %52 ]
%69 = phi i32 [ %148, %142 ], [ 1, %52 ]
%70 = add nuw nsw i32 %67, 1
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %4
%73 = sub nsw i32 %72, %67
%74 = icmp sgt i32 %73, 1
br i1 %74, label %75, label %101
75: ; preds = %66
%76 = load i32, i32* %3
%77 = load i32, i32* %5
%78 = sdiv i32 %76, %77
%79 = icmp slt i32 %78, 3
br i1 %79, label %80, label %83
80: ; preds = %75
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.21, i64 0, i64 0), i32 %78)
%82 = call i32 @exit(i32 -1)
unreachable
83: ; preds = %75
%84 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0), i64 27, i64 1, i32* %47)
%85 = load i32, i32* %5
%86 = icmp sgt i32 %85, 0
br i1 %86, label %87, label %101
87: ; preds = %83, %87
%88 = phi i32 [ %93, %87 ], [ 0, %83 ]
%89 = phi i32 [ %90, %87 ], [ %68, %83 ]
%90 = add nsw i32 %89, 1
%91 = load i32, i32* %3
%92 = mul nsw i32 %91, %67
%93 = add nuw nsw i32 %88, 1
%94 = mul nsw i32 %93, %78
%95 = add nsw i32 %92, %94
%96 = mul nsw i32 %91, %70
%97 = add nsw i32 %96, %94
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0), i32 %89, i32 %95, i32 %97)
%99 = load i32, i32* %5
%100 = icmp slt i32 %93, %99
br i1 %100, label %87, label %101
101: ; preds = %87, %83, %66
%102 = phi i32 [ %68, %66 ], [ %68, %83 ], [ %90, %87 ]
%103 = load i32, i32* %3
%104 = mul nsw i32 %103, %67
%105 = add nsw i32 %104, 1
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.24, i64 0, i64 0), i32 %102, i32 0, i32 %105)
%107 = add nsw i32 %102, 1
%108 = load i32, i32* %3
%109 = icmp sgt i32 %108, 1
br i1 %109, label %110, label %142
110: ; preds = %101, %110
%111 = phi i32 [ %139, %110 ], [ %107, %101 ]
%112 = phi i32 [ %136, %110 ], [ 1, %101 ]
%113 = phi i32 [ %119, %110 ], [ %69, %101 ]
%114 = call i32 (...) @rand()
%115 = srem i32 %114, 10
%116 = sitofp i32 %115 to double
%117 = fdiv double %116, 1.000000e+02
%118 = fmul double %117, 1.236840e-05
%119 = add nsw i32 %113, 1
%120 = load i32, i32* %3
%121 = mul nsw i32 %120, %67
%122 = add nsw i32 %121, %112
%123 = fadd double %118, 1.236840e-05
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0), i32 %113, i32 0, i32 %122, double %123)
%125 = call i32 (...) @rand()
%126 = srem i32 %125, 10
%127 = sitofp i32 %126 to double
%128 = fdiv double %127, 1.000000e+02
%129 = fmul double %128, 1.600000e+00
%130 = fadd double %129, 1.600000e+00
%131 = fmul double %130, 8.000000e-01
%132 = fmul double %131, 1.000000e+01
%133 = load i32, i32* %3
%134 = mul nsw i32 %133, %67
%135 = add nsw i32 %134, %112
%136 = add nuw nsw i32 %112, 1
%137 = add nsw i32 %134, %136
%138 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.26, i64 0, i64 0), i32 %111, i32 %135, i32 %137, double %130, double 8.000000e-01, double %132)
%139 = add nsw i32 %111, 1
%140 = load i32, i32* %3
%141 = icmp slt i32 %136, %140
br i1 %141, label %110, label %142
142: ; preds = %110, %101
%143 = phi i32 [ %69, %101 ], [ %119, %110 ]
%144 = phi i32 [ %102, %101 ], [ %111, %110 ]
%145 = phi i32 [ 1, %101 ], [ %136, %110 ]
%146 = phi i32 [ %107, %101 ], [ %139, %110 ]
%147 = phi i32 [ %108, %101 ], [ %140, %110 ]
%148 = add nsw i32 %143, 1
%149 = mul nsw i32 %147, %67
%150 = add nsw i32 %149, %145
%151 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.27, i64 0, i64 0), i32 %143, i32 0, i32 %150)
%152 = add nsw i32 %144, 2
%153 = load i32, i32* %3
%154 = mul nsw i32 %153, %67
%155 = add nsw i32 %154, %145
%156 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.24, i64 0, i64 0), i32 %146, i32 %155, i32 0)
%157 = load i32, i32* %4
%158 = icmp slt i32 %70, %157
br i1 %158, label %66, label %159
159: ; preds = %142, %52
%160 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i64 0, i64 0), i64 4, i64 1, i32* %47)
%161 = call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i64 0, i64 0), i64 5, i64 1, i32* %47)
%162 = call i32 @fclose(i32* %47)
%163 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%164 = icmp eq i32* %163, null
br i1 %164, label %165, label %168
165: ; preds = %159
%166 = call i32 @perror(i8* %15)
%167 = call i32 @exit(i32 -1)
unreachable
168: ; preds = %159
%169 = call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.30, i64 0, i64 0), i64 19, i64 1, i32* %163)
%170 = call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.31, i64 0, i64 0), i64 48, i64 1, i32* %163)
%171 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.32, i64 0, i64 0), i64 21, i64 1, i32* %163)
%172 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.33, i64 0, i64 0), i64 21, i64 1, i32* %163)
%173 = load i32, i32* %4
%174 = load i32, i32* %3
%175 = mul nsw i32 %174, %173
%176 = icmp slt i32 %175, 1
br i1 %176, label %186, label %177
177: ; preds = %168, %177
%178 = phi i32 [ %181, %177 ], [ 1, %168 ]
%179 = load double, double* %9
%180 = call i32 (i32*, i8*, ...) @fprintf(i32* %163, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.34, i64 0, i64 0), i32 %178, double %179)
%181 = add nuw nsw i32 %178, 1
%182 = load i32, i32* %4
%183 = load i32, i32* %3
%184 = mul nsw i32 %183, %182
%185 = icmp slt i32 %178, %184
br i1 %185, label %177, label %186
186: ; preds = %177, %168
%187 = call i32 @fclose(i32* %163)
ret i32 0
}