#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*/ _SC_NPROCESSORS_ONLN;
int /*<<< orphan*/ assert(int);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ msg(int, int, char *, ...);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int sysconf(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int getsystemcores(int explain) {
  int syscores, coreids, physids, procpuinfocores;
  int usesyscores, useprocpuinfo, amd, intel, res;
  FILE *p;
  syscores = sysconf(_SC_NPROCESSORS_ONLN);
  if (explain) {
    if (syscores > 0)
      msg(-1, 1, "'sysconf' reports %d processors online", syscores);
    else
      msg(-1, 1, "'sysconf' fails to determine number of online processors");
  }
  p = popen("grep '^core id' /proc/cpuinfo 2>/dev/null|sort|uniq|wc -l", "r");
  if (p) {
    if (fscanf(p, "%d", &coreids) != 1)
      coreids = 0;
    if (explain) {
      if (coreids > 0)
        msg(-1, 1, "found %d unique core ids in '/proc/cpuinfo'", coreids);
      else
        msg(-1, 1, "failed to extract core ids from '/proc/cpuinfo'");
    }
    pclose(p);
  } else
    coreids = 0;
  p = popen("grep '^physical id' /proc/cpuinfo 2>/dev/null|sort|uniq|wc -l",
            "r");
  if (p) {
    if (fscanf(p, "%d", &physids) != 1)
      physids = 0;
    if (explain) {
      if (physids > 0)
        msg(-1, 1, "found %d unique physical ids in '/proc/cpuinfo'", physids);
      else
        msg(-1, 1, "failed to extract physical ids from '/proc/cpuinfo'");
    }
    pclose(p);
  } else
    physids = 0;
  if (coreids > 0 && physids > 0 && (procpuinfocores = coreids * physids) > 0) {
    if (explain)
      msg(-1, 1, "%d cores = %d core times %d physical ids in '/proc/cpuinfo'",
          procpuinfocores, coreids, physids);
  } else
    procpuinfocores = 0;
  usesyscores = useprocpuinfo = 0;
  if (procpuinfocores > 0 && procpuinfocores == syscores) {
    if (explain)
      msg(-1, 1, "'sysconf' and '/proc/cpuinfo' results match");
    usesyscores = 1;
  } else if (procpuinfocores > 0 && syscores <= 0) {
    if (explain)
      msg(-1, 1, "only '/proc/cpuinfo' result valid");
    useprocpuinfo = 1;
  } else if (procpuinfocores <= 0 && syscores > 0) {
    if (explain)
      msg(-1, 1, "only 'sysconf' result valid");
    usesyscores = 1;
  } else {
    intel = !system("grep vendor /proc/cpuinfo 2>/dev/null|grep -q Intel");
    if (intel && explain)
      msg(-1, 1, "found Intel as vendor in '/proc/cpuinfo'");
    amd = !system("grep vendor /proc/cpuinfo 2>/dev/null|grep -q AMD");
    if (amd && explain)
      msg(-1, 1, "found AMD as vendor in '/proc/cpuinfo'");
    assert(syscores > 0);
    assert(procpuinfocores > 0);
    assert(syscores != procpuinfocores);
    if (amd) {
      if (explain)
        msg(-1, 1, "trusting 'sysconf' on AMD");
      usesyscores = 1;
    } else if (intel) {
      if (explain) {
        msg(-1, 1, "'sysconf' result off by a factor of %f on Intel",
            syscores / (double)procpuinfocores);
        msg(-1, 1, "trusting '/proc/cpuinfo' on Intel");
      }
      useprocpuinfo = 1;
    } else {
      if (explain)
        msg(-1, 1, "trusting 'sysconf' on unknown vendor machine");
      usesyscores = 1;
    }
  }
  if (useprocpuinfo) {
    if (explain)
      msg(-1, 0, "assuming cores = core * physical ids in '/proc/cpuinfo' = %d",
          procpuinfocores);
    res = procpuinfocores;
  } else if (usesyscores) {
    if (explain)
      msg(-1, 0,
          "assuming cores = number of processors reported by 'sysconf' = %d",
          syscores);
    res = syscores;
  } else {
    if (explain)
      msg(-1, 0, "using compiled in default value of %d workers", 8);
    res = 8;
  }
  return res;
}


x86 assembly (clang, -O0):
<getsystemcores>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11dd <getsystemcores+0x6d>
cmpl   $0x0,-0x8(%rbp)
jle    11c0 <getsystemcores+0x50>
mov    -0x8(%rbp),%ecx
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe4c(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    11d8 <getsystemcores+0x68>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe56(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    11dd <getsystemcores+0x6d>
lea    0xe7c(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1070 <popen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1282 <getsystemcores+0x112>
mov    -0x30(%rbp),%rdi
lea    0x1200(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     1223 <getsystemcores+0xb3>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1274 <getsystemcores+0x104>
cmpl   $0x0,-0xc(%rbp)
jle    1257 <getsystemcores+0xe7>
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe51(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    126f <getsystemcores+0xff>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe60(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    1274 <getsystemcores+0x104>
mov    -0x30(%rbp),%rdi
call   1040 <pclose@plt>
jmp    1289 <getsystemcores+0x119>
movl   $0x0,-0xc(%rbp)
lea    0xe68(%rip),%rdi
lea    0xe03(%rip),%rsi
call   1070 <popen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     132e <getsystemcores+0x1be>
mov    -0x30(%rbp),%rdi
lea    0x1154(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     12cf <getsystemcores+0x15f>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1320 <getsystemcores+0x1b0>
cmpl   $0x0,-0x10(%rbp)
jle    1303 <getsystemcores+0x193>
mov    -0x10(%rbp),%ecx
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe3f(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    131b <getsystemcores+0x1ab>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe52(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    1320 <getsystemcores+0x1b0>
mov    -0x30(%rbp),%rdi
call   1040 <pclose@plt>
jmp    1335 <getsystemcores+0x1c5>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    138e <getsystemcores+0x21e>
cmpl   $0x0,-0x10(%rbp)
jle    138e <getsystemcores+0x21e>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    138e <getsystemcores+0x21e>
cmpl   $0x0,-0x4(%rbp)
je     1389 <getsystemcores+0x219>
mov    -0x14(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe18(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
jmp    1395 <getsystemcores+0x225>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    13e7 <getsystemcores+0x277>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    13e7 <getsystemcores+0x277>
cmpl   $0x0,-0x4(%rbp)
je     13db <getsystemcores+0x26b>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xe02(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x1,-0x18(%rbp)
jmp    1603 <getsystemcores+0x493>
cmpl   $0x0,-0x14(%rbp)
jle    1429 <getsystemcores+0x2b9>
cmpl   $0x0,-0x8(%rbp)
jg     1429 <getsystemcores+0x2b9>
cmpl   $0x0,-0x4(%rbp)
je     141d <getsystemcores+0x2ad>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xdec(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x1,-0x1c(%rbp)
jmp    15fe <getsystemcores+0x48e>
cmpl   $0x0,-0x14(%rbp)
jg     146b <getsystemcores+0x2fb>
cmpl   $0x0,-0x8(%rbp)
jle    146b <getsystemcores+0x2fb>
cmpl   $0x0,-0x4(%rbp)
je     145f <getsystemcores+0x2ef>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xdcc(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x1,-0x18(%rbp)
jmp    15f9 <getsystemcores+0x489>
lea    0xdce(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     14b3 <getsystemcores+0x343>
cmpl   $0x0,-0x4(%rbp)
je     14b3 <getsystemcores+0x343>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xdc8(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
lea    0xde3(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     14fb <getsystemcores+0x38b>
cmpl   $0x0,-0x4(%rbp)
je     14fb <getsystemcores+0x38b>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xddb(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
cmpl   $0x0,-0x20(%rbp)
je     1568 <getsystemcores+0x3f8>
cmpl   $0x0,-0x4(%rbp)
je     155c <getsystemcores+0x3ec>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xda1(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x1,-0x18(%rbp)
jmp    15f4 <getsystemcores+0x484>
cmpl   $0x0,-0x24(%rbp)
je     15c6 <getsystemcores+0x456>
cmpl   $0x0,-0x4(%rbp)
je     15ba <getsystemcores+0x44a>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xd75(%rip),%rdx
mov    $0x1,%al
call   1090 <msg@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xd8d(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x1,-0x1c(%rbp)
jmp    15ef <getsystemcores+0x47f>
cmpl   $0x0,-0x4(%rbp)
je     15e8 <getsystemcores+0x478>
mov    $0xffffffff,%edi
mov    $0x1,%esi
lea    0xd81(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x1,-0x18(%rbp)
jmp    15f4 <getsystemcores+0x484>
jmp    15f9 <getsystemcores+0x489>
jmp    15fe <getsystemcores+0x48e>
jmp    1603 <getsystemcores+0x493>
cmpl   $0x0,-0x1c(%rbp)
je     163a <getsystemcores+0x4ca>
cmpl   $0x0,-0x4(%rbp)
je     162f <getsystemcores+0x4bf>
mov    -0x14(%rbp),%ecx
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xd67(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    16a1 <getsystemcores+0x531>
cmpl   $0x0,-0x18(%rbp)
je     1671 <getsystemcores+0x501>
cmpl   $0x0,-0x4(%rbp)
je     1666 <getsystemcores+0x4f6>
mov    -0x8(%rbp),%ecx
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xd6d(%rip),%rdx
mov    $0x0,%al
call   1090 <msg@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    169c <getsystemcores+0x52c>
cmpl   $0x0,-0x4(%rbp)
je     1695 <getsystemcores+0x525>
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xd84(%rip),%rdx
mov    $0x8,%ecx
mov    $0x0,%al
call   1090 <msg@plt>
movl   $0x8,-0x28(%rbp)
jmp    16a1 <getsystemcores+0x531>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsystemcores>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r12d
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    %eax,%r14d
test   %r12d,%r12d
je     11ce <getsystemcores+0x5e>
test   %r14d,%r14d
jle    11b6 <getsystemcores+0x46>
lea    0xe60(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    %r14d,%ecx
xor    %eax,%eax
call   1090 <msg@plt>
jmp    11ce <getsystemcores+0x5e>
lea    0xe6a(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
lea    0xe8b(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1070 <popen@plt>
test   %rax,%rax
je     1231 <getsystemcores+0xc1>
mov    %rax,%rbx
lea    0x121a(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     120a <getsystemcores+0x9a>
movl   $0x0,0x4(%rsp)
test   %r12d,%r12d
je     1253 <getsystemcores+0xe3>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    123b <getsystemcores+0xcb>
lea    0xe7e(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
jmp    1253 <getsystemcores+0xe3>
movl   $0x0,0x4(%rsp)
jmp    125b <getsystemcores+0xeb>
lea    0xe86(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
mov    %rbx,%rdi
call   1040 <pclose@plt>
lea    0xe96(%rip),%rdi
lea    0xe31(%rip),%rsi
call   1070 <popen@plt>
test   %rax,%rax
je     12ba <getsystemcores+0x14a>
mov    %rax,%rbx
lea    0x118d(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     1294 <getsystemcores+0x124>
movl   $0x0,(%rsp)
test   %r12d,%r12d
je     12e0 <getsystemcores+0x170>
mov    (%rsp),%ecx
test   %ecx,%ecx
jle    12c8 <getsystemcores+0x158>
lea    0xe8f(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
jmp    12e0 <getsystemcores+0x170>
movl   $0x0,(%rsp)
xor    %ebx,%ebx
jmp    135e <getsystemcores+0x1ee>
lea    0xe97(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
mov    %rbx,%rdi
call   1040 <pclose@plt>
mov    0x4(%rsp),%r8d
xor    %ebx,%ebx
test   %r8d,%r8d
jle    135e <getsystemcores+0x1ee>
mov    (%rsp),%r9d
mov    $0x0,%r13d
test   %r9d,%r9d
jle    1361 <getsystemcores+0x1f1>
mov    %r9d,%ebp
imul   %r8d,%ebp
xor    %ebx,%ebx
test   %ebp,%ebp
cmovg  %ebp,%ebx
jle    1334 <getsystemcores+0x1c4>
test   %r12d,%r12d
je     1334 <getsystemcores+0x1c4>
lea    0xe7b(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <msg@plt>
mov    %ebp,%ebx
test   %ebx,%ebx
setne  %r13b
je     141f <getsystemcores+0x2af>
cmp    %r14d,%ebx
jne    141f <getsystemcores+0x2af>
test   %r12d,%r12d
je     14d9 <getsystemcores+0x369>
lea    0xe7d(%rip),%rdx
jmp    1452 <getsystemcores+0x2e2>
xor    %r13d,%r13d
test   %ebx,%ebx
jne    137f <getsystemcores+0x20f>
test   %r14d,%r14d
jle    137f <getsystemcores+0x20f>
test   %r12d,%r12d
je     14d9 <getsystemcores+0x369>
lea    0xeaa(%rip),%rdx
jmp    1452 <getsystemcores+0x2e2>
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%r15d
test   %r12d,%r12d
je     13b0 <getsystemcores+0x240>
test   %r15d,%r15d
jne    13b0 <getsystemcores+0x240>
lea    0xed5(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
lea    0xee6(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%ebp
test   %r12d,%r12d
je     13df <getsystemcores+0x26f>
test   %ebp,%ebp
jne    13df <getsystemcores+0x26f>
lea    0xf01(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
xor    %edi,%edi
test   %r14d,%r14d
setg   %dil
call   1060 <assert@plt>
movzbl %r13b,%edi
call   1060 <assert@plt>
xor    %edi,%edi
cmp    %ebx,%r14d
setne  %dil
call   1060 <assert@plt>
test   %ebp,%ebp
je     1442 <getsystemcores+0x2d2>
test   %r15d,%r15d
je     147d <getsystemcores+0x30d>
test   %r12d,%r12d
je     14d9 <getsystemcores+0x369>
lea    0xf45(%rip),%rdx
jmp    1452 <getsystemcores+0x2e2>
test   %ebx,%ebx
je     1361 <getsystemcores+0x1f1>
test   %r14d,%r14d
jg     1361 <getsystemcores+0x1f1>
test   %r12d,%r12d
je     14d6 <getsystemcores+0x366>
lea    0xdc2(%rip),%rdx
jmp    14ae <getsystemcores+0x33e>
test   %r12d,%r12d
je     14d9 <getsystemcores+0x369>
lea    0xea4(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
lea    0xf62(%rip),%rdx
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    %r14d,%ecx
xor    %eax,%eax
call   1090 <msg@plt>
jmp    14d9 <getsystemcores+0x369>
test   %r12d,%r12d
je     14d6 <getsystemcores+0x366>
cvtsi2sd %r14d,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
lea    0xe7a(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    $0x1,%al
call   1090 <msg@plt>
lea    0xe92(%rip),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <msg@plt>
lea    0xec9(%rip),%rdx
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1090 <msg@plt>
mov    %ebx,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
@.str = [39 x i8] c"'sysconf' reports %d processors online\00"
@.str.1 = [57 x i8] c"'sysconf' fails to determine number of online processors\00"
@.str.2 = [58 x i8] c"grep '^core id' /proc/cpuinfo 2>/dev/null|sort|uniq|wc -l\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [44 x i8] c"found %d unique core ids in '/proc/cpuinfo'\00"
@.str.6 = [48 x i8] c"failed to extract core ids from '/proc/cpuinfo'\00"
@.str.7 = [62 x i8] c"grep '^physical id' /proc/cpuinfo 2>/dev/null|sort|uniq|wc -l\00"
@.str.8 = [48 x i8] c"found %d unique physical ids in '/proc/cpuinfo'\00"
@.str.9 = [52 x i8] c"failed to extract physical ids from '/proc/cpuinfo'\00"
@.str.10 = [60 x i8] c"%d cores = %d core times %d physical ids in '/proc/cpuinfo'\00"
@.str.11 = [44 x i8] c"'sysconf' and '/proc/cpuinfo' results match\00"
@.str.12 = [34 x i8] c"only '/proc/cpuinfo' result valid\00"
@.str.13 = [28 x i8] c"only 'sysconf' result valid\00"
@.str.14 = [52 x i8] c"grep vendor /proc/cpuinfo 2>/dev/null|grep -q Intel\00"
@.str.15 = [41 x i8] c"found Intel as vendor in '/proc/cpuinfo'\00"
@.str.16 = [50 x i8] c"grep vendor /proc/cpuinfo 2>/dev/null|grep -q AMD\00"
@.str.17 = [39 x i8] c"found AMD as vendor in '/proc/cpuinfo'\00"
@.str.18 = [26 x i8] c"trusting 'sysconf' on AMD\00"
@.str.19 = [48 x i8] c"'sysconf' result off by a factor of %f on Intel\00"
@.str.20 = [34 x i8] c"trusting '/proc/cpuinfo' on Intel\00"
@.str.21 = [45 x i8] c"trusting 'sysconf' on unknown vendor machine\00"
@.str.22 = [61 x i8] c"assuming cores = core * physical ids in '/proc/cpuinfo' = %d\00"
@.str.23 = [65 x i8] c"assuming cores = number of processors reported by 'sysconf' = %d\00"
@.str.24 = [46 x i8] c"using compiled in default value of %d workers\00"
define i32 @getsystemcores(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store i32 %0, i32* %2
%13 = load i32, i32* @_SC_NPROCESSORS_ONLN
%14 = call i32 @sysconf(i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %1
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %3
%22 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %17
%24 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %1
%27 = call i32* @popen(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %27, i32** %12
%28 = load i32*, i32** %12
%29 = icmp ne i32* %28, null
br i1 %29, label %30, label %50
30: ; preds = %26
%31 = load i32*, i32** %12
%32 = call i32 @fscanf(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%33 = icmp ne i32 %32, 1
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 0, i32* %4
br label %35
35: ; preds = %34, %30
%36 = load i32, i32* %2
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load i32, i32* %4
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %4
%43 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %42)
br label %46
44: ; preds = %38
%45 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
br label %46
46: ; preds = %44, %41
br label %47
47: ; preds = %46, %35
%48 = load i32*, i32** %12
%49 = call i32 @pclose(i32* %48)
br label %51
50: ; preds = %26
store i32 0, i32* %4
br label %51
51: ; preds = %50, %47
%52 = call i32* @popen(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %52, i32** %12
%53 = load i32*, i32** %12
%54 = icmp ne i32* %53, null
br i1 %54, label %55, label %75
55: ; preds = %51
%56 = load i32*, i32** %12
%57 = call i32 @fscanf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%58 = icmp ne i32 %57, 1
br i1 %58, label %59, label %60
59: ; preds = %55
store i32 0, i32* %5
br label %60
60: ; preds = %59, %55
%61 = load i32, i32* %2
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %72
63: ; preds = %60
%64 = load i32, i32* %5
%65 = icmp sgt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i32, i32* %5
%68 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i32 %67)
br label %71
69: ; preds = %63
%70 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %71
71: ; preds = %69, %66
br label %72
72: ; preds = %71, %60
%73 = load i32*, i32** %12
%74 = call i32 @pclose(i32* %73)
br label %76
75: ; preds = %51
store i32 0, i32* %5
br label %76
76: ; preds = %75, %72
%77 = load i32, i32* %4
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %96
79: ; preds = %76
%80 = load i32, i32* %5
%81 = icmp sgt i32 %80, 0
br i1 %81, label %82, label %96
82: ; preds = %79
%83 = load i32, i32* %4
%84 = load i32, i32* %5
%85 = mul nsw i32 %83, %84
store i32 %85, i32* %6
%86 = icmp sgt i32 %85, 0
br i1 %86, label %87, label %96
87: ; preds = %82
%88 = load i32, i32* %2
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %87
%91 = load i32, i32* %6
%92 = load i32, i32* %4
%93 = load i32, i32* %5
%94 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0), i32 %91, i32 %92, i32 %93)
br label %95
95: ; preds = %90, %87
br label %97
96: ; preds = %82, %79, %76
store i32 0, i32* %6
br label %97
97: ; preds = %96, %95
store i32 0, i32* %8
store i32 0, i32* %7
%98 = load i32, i32* %6
%99 = icmp sgt i32 %98, 0
br i1 %99, label %100, label %110
100: ; preds = %97
%101 = load i32, i32* %6
%102 = load i32, i32* %3
%103 = icmp eq i32 %101, %102
br i1 %103, label %104, label %110
104: ; preds = %100
%105 = load i32, i32* %2
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %104
%108 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0))
br label %109
109: ; preds = %107, %104
store i32 1, i32* %7
br label %205
110: ; preds = %100, %97
%111 = load i32, i32* %6
%112 = icmp sgt i32 %111, 0
br i1 %112, label %113, label %122
113: ; preds = %110
%114 = load i32, i32* %3
%115 = icmp sle i32 %114, 0
br i1 %115, label %116, label %122
116: ; preds = %113
%117 = load i32, i32* %2
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %116
%120 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
br label %121
121: ; preds = %119, %116
store i32 1, i32* %8
br label %204
122: ; preds = %113, %110
%123 = load i32, i32* %6
%124 = icmp sle i32 %123, 0
br i1 %124, label %125, label %134
125: ; preds = %122
%126 = load i32, i32* %3
%127 = icmp sgt i32 %126, 0
br i1 %127, label %128, label %134
128: ; preds = %125
%129 = load i32, i32* %2
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %133
131: ; preds = %128
%132 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0))
br label %133
133: ; preds = %131, %128
store i32 1, i32* %7
br label %203
134: ; preds = %125, %122
%135 = call i32 @system(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.14, i64 0, i64 0))
%136 = icmp ne i32 %135, 0
%137 = xor i1 %136, true
%138 = zext i1 %137 to i32
store i32 %138, i32* %10
%139 = load i32, i32* %10
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %146
141: ; preds = %134
%142 = load i32, i32* %2
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %146
144: ; preds = %141
%145 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
br label %146
146: ; preds = %144, %141, %134
%147 = call i32 @system(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.16, i64 0, i64 0))
%148 = icmp ne i32 %147, 0
%149 = xor i1 %148, true
%150 = zext i1 %149 to i32
store i32 %150, i32* %9
%151 = load i32, i32* %9
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %158
153: ; preds = %146
%154 = load i32, i32* %2
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %158
156: ; preds = %153
%157 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0))
br label %158
158: ; preds = %156, %153, %146
%159 = load i32, i32* %3
%160 = icmp sgt i32 %159, 0
%161 = zext i1 %160 to i32
%162 = call i32 @assert(i32 %161)
%163 = load i32, i32* %6
%164 = icmp sgt i32 %163, 0
%165 = zext i1 %164 to i32
%166 = call i32 @assert(i32 %165)
%167 = load i32, i32* %3
%168 = load i32, i32* %6
%169 = icmp ne i32 %167, %168
%170 = zext i1 %169 to i32
%171 = call i32 @assert(i32 %170)
%172 = load i32, i32* %9
%173 = icmp ne i32 %172, 0
br i1 %173, label %174, label %180
174: ; preds = %158
%175 = load i32, i32* %2
%176 = icmp ne i32 %175, 0
br i1 %176, label %177, label %179
177: ; preds = %174
%178 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0))
br label %179
179: ; preds = %177, %174
store i32 1, i32* %7
br label %202
180: ; preds = %158
%181 = load i32, i32* %10
%182 = icmp ne i32 %181, 0
br i1 %182, label %183, label %195
183: ; preds = %180
%184 = load i32, i32* %2
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %194
186: ; preds = %183
%187 = load i32, i32* %3
%188 = sitofp i32 %187 to double
%189 = load i32, i32* %6
%190 = sitofp i32 %189 to double
%191 = fdiv double %188, %190
%192 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.19, i64 0, i64 0), double %191)
%193 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0))
br label %194
194: ; preds = %186, %183
store i32 1, i32* %8
br label %201
195: ; preds = %180
%196 = load i32, i32* %2
%197 = icmp ne i32 %196, 0
br i1 %197, label %198, label %200
198: ; preds = %195
%199 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.21, i64 0, i64 0))
br label %200
200: ; preds = %198, %195
store i32 1, i32* %7
br label %201
201: ; preds = %200, %194
br label %202
202: ; preds = %201, %179
br label %203
203: ; preds = %202, %133
br label %204
204: ; preds = %203, %121
br label %205
205: ; preds = %204, %109
%206 = load i32, i32* %8
%207 = icmp ne i32 %206, 0
br i1 %207, label %208, label %216
208: ; preds = %205
%209 = load i32, i32* %2
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %214
211: ; preds = %208
%212 = load i32, i32* %6
%213 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 0, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i32 %212)
br label %214
214: ; preds = %211, %208
%215 = load i32, i32* %6
store i32 %215, i32* %11
br label %234
216: ; preds = %205
%217 = load i32, i32* %7
%218 = icmp ne i32 %217, 0
br i1 %218, label %219, label %227
219: ; preds = %216
%220 = load i32, i32* %2
%221 = icmp ne i32 %220, 0
br i1 %221, label %222, label %225
222: ; preds = %219
%223 = load i32, i32* %3
%224 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.23, i64 0, i64 0), i32 %223)
br label %225
225: ; preds = %222, %219
%226 = load i32, i32* %3
store i32 %226, i32* %11
br label %233
227: ; preds = %216
%228 = load i32, i32* %2
%229 = icmp ne i32 %228, 0
br i1 %229, label %230, label %232
230: ; preds = %227
%231 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.24, i64 0, i64 0), i32 8)
br label %232
232: ; preds = %230, %227
store i32 8, i32* %11
br label %233
233: ; preds = %232, %225
br label %234
234: ; preds = %233, %214
%235 = load i32, i32* %11
ret i32 %235
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
@.str = [39 x i8] c"'sysconf' reports %d processors online\00"
@.str.1 = [57 x i8] c"'sysconf' fails to determine number of online processors\00"
@.str.2 = [58 x i8] c"grep '^core id' /proc/cpuinfo 2>/dev/null|sort|uniq|wc -l\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [44 x i8] c"found %d unique core ids in '/proc/cpuinfo'\00"
@.str.6 = [48 x i8] c"failed to extract core ids from '/proc/cpuinfo'\00"
@.str.7 = [62 x i8] c"grep '^physical id' /proc/cpuinfo 2>/dev/null|sort|uniq|wc -l\00"
@.str.8 = [48 x i8] c"found %d unique physical ids in '/proc/cpuinfo'\00"
@.str.9 = [52 x i8] c"failed to extract physical ids from '/proc/cpuinfo'\00"
@.str.10 = [60 x i8] c"%d cores = %d core times %d physical ids in '/proc/cpuinfo'\00"
@.str.11 = [44 x i8] c"'sysconf' and '/proc/cpuinfo' results match\00"
@.str.12 = [34 x i8] c"only '/proc/cpuinfo' result valid\00"
@.str.13 = [28 x i8] c"only 'sysconf' result valid\00"
@.str.14 = [52 x i8] c"grep vendor /proc/cpuinfo 2>/dev/null|grep -q Intel\00"
@.str.15 = [41 x i8] c"found Intel as vendor in '/proc/cpuinfo'\00"
@.str.16 = [50 x i8] c"grep vendor /proc/cpuinfo 2>/dev/null|grep -q AMD\00"
@.str.17 = [39 x i8] c"found AMD as vendor in '/proc/cpuinfo'\00"
@.str.18 = [26 x i8] c"trusting 'sysconf' on AMD\00"
@.str.19 = [48 x i8] c"'sysconf' result off by a factor of %f on Intel\00"
@.str.20 = [34 x i8] c"trusting '/proc/cpuinfo' on Intel\00"
@.str.21 = [45 x i8] c"trusting 'sysconf' on unknown vendor machine\00"
@.str.22 = [61 x i8] c"assuming cores = core * physical ids in '/proc/cpuinfo' = %d\00"
@.str.23 = [65 x i8] c"assuming cores = number of processors reported by 'sysconf' = %d\00"
define i32 @getsystemcores(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = load i32, i32* @_SC_NPROCESSORS_ONLN
%7 = tail call i32 @sysconf(i32 %6)
%8 = icmp ne i32 %0, 0
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = icmp sgt i32 %7, 0
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %15
13: ; preds = %9
%14 = tail call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %11, %13, %1
%16 = tail call i32* @popen(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %32, label %18
18: ; preds = %15
%19 = call i32 @fscanf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%20 = icmp eq i32 %19, 1
br i1 %20, label %22, label %21
21: ; preds = %18
store i32 0, i32* %2
br label %22
22: ; preds = %21, %18
br i1 %8, label %23, label %30
23: ; preds = %22
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %24)
br label %30
28: ; preds = %23
%29 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
br label %30
30: ; preds = %26, %28, %22
%31 = call i32 @pclose(i32* %16)
br label %33
32: ; preds = %15
store i32 0, i32* %2
br label %33
33: ; preds = %32, %30
%34 = call i32* @popen(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %48, label %36
36: ; preds = %33
%37 = call i32 @fscanf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%38 = icmp eq i32 %37, 1
br i1 %38, label %40, label %39
39: ; preds = %36
store i32 0, i32* %3
br label %40
40: ; preds = %39, %36
br i1 %8, label %41, label %49
41: ; preds = %40
%42 = load i32, i32* %3
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i32 %42)
br label %49
46: ; preds = %41
%47 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %49
48: ; preds = %33
store i32 0, i32* %3
br label %74
49: ; preds = %40, %46, %44
%50 = call i32 @pclose(i32* %34)
%51 = load i32, i32* %3
%52 = load i32, i32* %2
%53 = icmp sgt i32 %52, 0
%54 = icmp sgt i32 %51, 0
%55 = select i1 %53, i1 %54, i1 false
br i1 %55, label %56, label %74
56: ; preds = %49
%57 = mul nsw i32 %51, %52
%58 = icmp slt i32 %57, 1
%59 = xor i1 %8, true
%60 = or i1 %58, %59
%61 = select i1 %58, i32 0, i32 %57
br i1 %60, label %64, label %62
62: ; preds = %56
%63 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0), i32 %57, i32 %52, i32 %51)
br label %64
64: ; preds = %56, %62
%65 = phi i32 [ %57, %62 ], [ %61, %56 ]
%66 = icmp ne i32 %65, 0
%67 = icmp eq i32 %65, %7
%68 = select i1 %66, i1 %67, i1 false
br i1 %68, label %69, label %70
69: ; preds = %64
br i1 %8, label %115, label %119
70: ; preds = %64
%71 = icmp slt i32 %7, 1
%72 = select i1 %66, i1 %71, i1 false
br i1 %72, label %73, label %74
73: ; preds = %70
br i1 %8, label %110, label %119
74: ; preds = %48, %49, %70
%75 = phi i32 [ %65, %70 ], [ 0, %49 ], [ 0, %48 ]
%76 = phi i1 [ %66, %70 ], [ false, %49 ], [ false, %48 ]
%77 = icmp eq i32 %75, 0
%78 = icmp sgt i32 %7, 0
%79 = select i1 %77, i1 %78, i1 false
br i1 %79, label %80, label %81
80: ; preds = %74
br i1 %8, label %115, label %119
81: ; preds = %74
%82 = call i32 @system(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.14, i64 0, i64 0))
%83 = icmp eq i32 %82, 0
%84 = and i1 %8, %83
br i1 %84, label %85, label %87
85: ; preds = %81
%86 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
br label %87
87: ; preds = %85, %81
%88 = call i32 @system(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.16, i64 0, i64 0))
%89 = icmp eq i32 %88, 0
%90 = and i1 %8, %89
br i1 %90, label %91, label %93
91: ; preds = %87
%92 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0))
br label %93
93: ; preds = %91, %87
%94 = zext i1 %78 to i32
%95 = call i32 @assert(i32 %94)
%96 = zext i1 %76 to i32
%97 = call i32 @assert(i32 %96)
%98 = icmp ne i32 %7, %75
%99 = zext i1 %98 to i32
%100 = call i32 @assert(i32 %99)
br i1 %89, label %101, label %102
101: ; preds = %93
br i1 %8, label %115, label %119
102: ; preds = %93
br i1 %83, label %103, label %109
103: ; preds = %102
br i1 %8, label %104, label %119
104: ; preds = %103
%105 = sitofp i32 %7 to double
%106 = sitofp i32 %75 to double
%107 = fdiv double %105, %106
%108 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.19, i64 0, i64 0), double %107)
br label %110
109: ; preds = %102
br i1 %8, label %115, label %119
110: ; preds = %73, %104
%111 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0), %104 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), %73 ]
%112 = phi i32 [ %75, %104 ], [ %65, %73 ]
%113 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* %111)
%114 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 0, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i32 %112)
br label %119
115: ; preds = %109, %101, %80, %69
%116 = phi i8* [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), %69 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), %80 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), %101 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.21, i64 0, i64 0), %109 ]
%117 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 1, i8* %116)
%118 = call i32 (i32, i32, i8*, ...) @msg(i32 -1, i32 0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.23, i64 0, i64 0), i32 %7)
br label %119
119: ; preds = %69, %80, %101, %109, %103, %73, %115, %110
%120 = phi i32 [ %112, %110 ], [ %7, %115 ], [ %65, %73 ], [ %75, %103 ], [ %7, %109 ], [ %7, %101 ], [ %7, %80 ], [ %7, %69 ]
ret i32 %120
}