#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 fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int input_assign_inv(FILE *finassign, char *inassignname, int nvtxs,
                     int *assignment) {
  extern int DEBUG_TRACE;
  int set;
  int size;
  int total;
  int done;
  int end_flag;
  int i, j, k;
  int read_int();
  if (DEBUG_TRACE > 0) {
    printf("<Entering input_assign_inv>\n");
  }
  for (i = 0; i < nvtxs; i++) {
    assignment[i] = -1;
  }
  total = 0;
  set = 0;
  end_flag = 1;
  while (end_flag == 1) {
    size = read_int(finassign, &end_flag);
  }
  if (end_flag == -1) {
    printf("ERROR: In assignment file `%s'\n", inassignname);
    printf("       No values found\n");
    return (1);
  }
  if (size < 0) {
    printf("ERROR: In assignment file `%s'\n", inassignname);
    printf("       Size of set %d less than zero (%d)\n", set, size);
    return (1);
  }
  if (total + size > nvtxs) {
    printf("ERROR: In assignment file `%s'\n", inassignname);
    printf("       Total set sizes greater than nvtxs (%d)\n", nvtxs);
    return (1);
  }
  done = 0;
  while (!done && total < nvtxs) {
    for (i = 1; i <= size; i++) {
      j = fscanf(finassign, "%d", &k);
      if (j != 1) {
        printf("ERROR: Too few values in assignment file `%s'.\n",
               inassignname);
        return (1);
      }
      if (k <= 0 || k > nvtxs) {
        printf("ERROR: In assignment file `%s'\n", inassignname);
        printf("       Entry %d of set %d invalid (%d)\n", total + i, set, k);
        return (1);
      }
      if (assignment[k - 1] != -1) {
        printf("ERROR: In assignment file `%s'\n", inassignname);
        printf("       Vertex %d assigned to multiple sets\n", k);
        return (1);
      }
      assignment[k - 1] = set;
    }
    total += size;
    j = fscanf(finassign, "%d", &size);
    ++set;
    if (j != 1) {
      if (total != nvtxs) {
        printf("ERROR: Too few values in assignment file `%s'.\n",
               inassignname);
        return (1);
      }
      done = 1;
      size = 0;
    }
    if (size < 0) {
      printf("ERROR: In assignment file `%s'\n", inassignname);
      printf("       Size of set %d less than zero (%d)\n", set, size);
      return (1);
    }
    if (total + size > nvtxs) {
      printf("ERROR: In assignment file `%s'\n", inassignname);
      printf("       Total set sizes greater than nvtxs (%d)\n", nvtxs);
      return (1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<input_assign_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2e8a(%rip),%rax
cmpl   $0x0,(%rax)
jle    1165 <input_assign_inv+0x35>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1195 <input_assign_inv+0x65>
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    116c <input_assign_inv+0x3c>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x1,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jne    11cb <input_assign_inv+0x9b>
mov    -0x10(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
mov    $0x0,%al
call   1050 <read_int@plt>
mov    %eax,-0x30(%rbp)
jmp    11aa <input_assign_inv+0x7a>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1201 <input_assign_inv+0xd1>
mov    -0x18(%rbp),%rsi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
cmpl   $0x0,-0x30(%rbp)
jge    123d <input_assign_inv+0x10d>
mov    -0x18(%rbp),%rsi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
mov    -0x34(%rbp),%eax
add    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    127b <input_assign_inv+0x14b>
mov    -0x18(%rbp),%rsi
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
movl   $0x0,-0x38(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x49(%rbp)
jne    129d <input_assign_inv+0x16d>
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    12ad <input_assign_inv+0x17d>
jmp    149e <input_assign_inv+0x36e>
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     13b4 <input_assign_inv+0x284>
mov    -0x10(%rbp),%rdi
lea    0xde5(%rip),%rsi
lea    -0x48(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x1,-0x44(%rbp)
je     12ff <input_assign_inv+0x1cf>
mov    -0x18(%rbp),%rsi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
cmpl   $0x0,-0x48(%rbp)
jle    1315 <input_assign_inv+0x1e5>
mov    -0x48(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    134d <input_assign_inv+0x21d>
mov    -0x18(%rbp),%rsi
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
add    -0x40(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x48(%rbp),%ecx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1393 <input_assign_inv+0x263>
mov    -0x18(%rbp),%rsi
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12b4 <input_assign_inv+0x184>
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xce8(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x44(%rbp)
je     141f <input_assign_inv+0x2ef>
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1411 <input_assign_inv+0x2e1>
mov    -0x18(%rbp),%rsi
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    145b <input_assign_inv+0x32b>
mov    -0x18(%rbp),%rsi
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xc0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
mov    -0x34(%rbp),%eax
add    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1499 <input_assign_inv+0x369>
mov    -0x18(%rbp),%rsi
lea    0xba8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xbfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14a5 <input_assign_inv+0x375>
jmp    1282 <input_assign_inv+0x152>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_assign_inv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r15
mov    %edx,%r13d
mov    %rsi,%r12
mov    %rdi,%rbx
mov    0x2e67(%rip),%rax
cmpl   $0x0,(%rax)
jle    1182 <input_assign_inv+0x32>
lea    0xf9c(%rip),%rdi
call   1030 <puts@plt>
test   %r13d,%r13d
jle    119b <input_assign_inv+0x4b>
mov    %r13d,%edx
shl    $0x2,%rdx
mov    %r15,%rdi
mov    $0xff,%esi
call   1050 <memset@plt>
movl   $0x1,0x1c(%rsp)
mov    $0x1,%eax
lea    0x1c(%rsp),%rbp
cmp    $0x1,%eax
jne    11dd <input_assign_inv+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <read_int@plt>
mov    %eax,%r14d
mov    %eax,0x4(%rsp)
mov    0x1c(%rsp),%eax
cmp    $0x1,%eax
je     11c0 <input_assign_inv+0x70>
cmp    $0xffffffff,%eax
jne    1204 <input_assign_inv+0xb4>
lea    0xe17(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
jmp    13c4 <input_assign_inv+0x274>
test   %r14d,%r14d
js     122e <input_assign_inv+0xde>
cmp    %r13d,%r14d
jle    1257 <input_assign_inv+0x107>
lea    0xdeb(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe25(%rip),%rdi
mov    %r13d,%esi
jmp    13bd <input_assign_inv+0x26d>
lea    0xdcb(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdda(%rip),%rdi
xor    %esi,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13c4 <input_assign_inv+0x274>
mov    %r12,0x10(%rsp)
xor    %r12d,%r12d
movl   $0x0,0x8(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
test   %eax,%eax
jne    13ca <input_assign_inv+0x27a>
cmp    %r13d,%ebp
jge    13ca <input_assign_inv+0x27a>
test   %r14d,%r14d
mov    %rbp,0x20(%rsp)
je     12e1 <input_assign_inv+0x191>
xor    %ebp,%ebp
mov    0x8(%rsp),%r14d
nopl   (%rax)
mov    %rbx,%rdi
lea    0xde1(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <fscanf@plt>
cmp    $0x1,%eax
jne    1355 <input_assign_inv+0x205>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    136a <input_assign_inv+0x21a>
cmp    %r13d,%eax
jg     136a <input_assign_inv+0x21a>
add    $0xffffffff,%eax
cmpl   $0xffffffff,(%r15,%rax,4)
jne    139f <input_assign_inv+0x24f>
mov    %r14d,(%r15,%rax,4)
mov    0x4(%rsp),%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1290 <input_assign_inv+0x140>
jmp    12e8 <input_assign_inv+0x198>
xor    %eax,%eax
mov    0x8(%rsp),%r14d
mov    0x20(%rsp),%rbp
add    %eax,%ebp
mov    %rbx,%rdi
lea    0xd82(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1060 <fscanf@plt>
add    $0x1,%r14d
cmp    $0x1,%eax
mov    %r14d,0x8(%rsp)
jne    1322 <input_assign_inv+0x1d2>
mov    0x4(%rsp),%r14d
xor    %eax,%eax
test   %r14d,%r14d
jns    1337 <input_assign_inv+0x1e7>
jmp    13dc <input_assign_inv+0x28c>
cmp    %r13d,%ebp
jne    1355 <input_assign_inv+0x205>
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
mov    $0x1,%eax
lea    (%r14,%rbp,1),%ecx
cmp    %r13d,%ecx
jle    126b <input_assign_inv+0x11b>
lea    0xcb5(%rip),%rdi
mov    0x10(%rsp),%rsi
jmp    1218 <input_assign_inv+0xc8>
lea    0xd22(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13c4 <input_assign_inv+0x274>
lea    0xc8f(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%rax
lea    (%rax,%rbp,1),%esi
add    $0x1,%esi
mov    0xc(%rsp),%ecx
lea    0xd1b(%rip),%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13c4 <input_assign_inv+0x274>
lea    0xc5a(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xd19(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc1d(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
lea    0xc26(%rip),%rdi
mov    0x8(%rsp),%esi
jmp    124b <input_assign_inv+0xfb>

LLVM IR (-O0):
@DEBUG_TRACE = external global i32
@.str = [29 x i8] c"<Entering input_assign_inv>\0A\00"
@.str.1 = [32 x i8] c"ERROR: In assignment file `%s'\0A\00"
@.str.2 = [24 x i8] c" No values found\0A\00"
@.str.3 = [43 x i8] c" Size of set %d less than zero (%d)\0A\00"
@.str.4 = [48 x i8] c" Total set sizes greater than nvtxs (%d)\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [48 x i8] c"ERROR: Too few values in assignment file `%s'.\0A\00"
@.str.7 = [40 x i8] c" Entry %d of set %d invalid (%d)\0A\00"
@.str.8 = [44 x i8] c" Vertex %d assigned to multiple sets\0A\00"
define i32 @input_assign_inv(i32* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%18 = load i32, i32* @DEBUG_TRACE
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %4
store i32 0, i32* %15
br label %23
23: ; preds = %32, %22
%24 = load i32, i32* %15
%25 = load i32, i32* %8
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %35
27: ; preds = %23
%28 = load i32*, i32** %9
%29 = load i32, i32* %15
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 -1, i32* %31
br label %32
32: ; preds = %27
%33 = load i32, i32* %15
%34 = add nsw i32 %33, 1
store i32 %34, i32* %15
br label %23
35: ; preds = %23
store i32 0, i32* %12
store i32 0, i32* %10
store i32 1, i32* %14
br label %36
36: ; preds = %39, %35
%37 = load i32, i32* %14
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32*, i32** %6
%41 = call i32 (i32*, i32*, ...) bitcast (i32 (...)* @read_int to i32 (i32*, i32*, ...)*)(i32* %40, i32* %14)
store i32 %41, i32* %11
br label %36
42: ; preds = %36
%43 = load i32, i32* %14
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i8*, i8** %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %5
br label %171
49: ; preds = %42
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %49
%53 = load i8*, i8** %7
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = load i32, i32* %10
%56 = load i32, i32* %11
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56)
store i32 1, i32* %5
br label %171
58: ; preds = %49
%59 = load i32, i32* %12
%60 = load i32, i32* %11
%61 = add nsw i32 %59, %60
%62 = load i32, i32* %8
%63 = icmp sgt i32 %61, %62
br i1 %63, label %64, label %69
64: ; preds = %58
%65 = load i8*, i8** %7
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %65)
%67 = load i32, i32* %8
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %67)
store i32 1, i32* %5
br label %171
69: ; preds = %58
store i32 0, i32* %13
br label %70
70: ; preds = %169, %69
%71 = load i32, i32* %13
%72 = icmp ne i32 %71, 0
br i1 %72, label %77, label %73
73: ; preds = %70
%74 = load i32, i32* %12
%75 = load i32, i32* %8
%76 = icmp slt i32 %74, %75
br label %77
77: ; preds = %73, %70
%78 = phi i1 [ false, %70 ], [ %76, %73 ]
br i1 %78, label %79, label %170
79: ; preds = %77
store i32 1, i32* %15
br label %80
80: ; preds = %128, %79
%81 = load i32, i32* %15
%82 = load i32, i32* %11
%83 = icmp sle i32 %81, %82
br i1 %83, label %84, label %131
84: ; preds = %80
%85 = load i32*, i32** %6
%86 = call i32 @fscanf(i32* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %17)
store i32 %86, i32* %16
%87 = load i32, i32* %16
%88 = icmp ne i32 %87, 1
br i1 %88, label %89, label %92
89: ; preds = %84
%90 = load i8*, i8** %7
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i8* %90)
store i32 1, i32* %5
br label %171
92: ; preds = %84
%93 = load i32, i32* %17
%94 = icmp sle i32 %93, 0
br i1 %94, label %99, label %95
95: ; preds = %92
%96 = load i32, i32* %17
%97 = load i32, i32* %8
%98 = icmp sgt i32 %96, %97
br i1 %98, label %99, label %108
99: ; preds = %95, %92
%100 = load i8*, i8** %7
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %100)
%102 = load i32, i32* %12
%103 = load i32, i32* %15
%104 = add nsw i32 %102, %103
%105 = load i32, i32* %10
%106 = load i32, i32* %17
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %104, i32 %105, i32 %106)
store i32 1, i32* %5
br label %171
108: ; preds = %95
%109 = load i32*, i32** %9
%110 = load i32, i32* %17
%111 = sub nsw i32 %110, 1
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %109, i64 %112
%114 = load i32, i32* %113
%115 = icmp ne i32 %114, -1
br i1 %115, label %116, label %121
116: ; preds = %108
%117 = load i8*, i8** %7
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %117)
%119 = load i32, i32* %17
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i32 %119)
store i32 1, i32* %5
br label %171
121: ; preds = %108
%122 = load i32, i32* %10
%123 = load i32*, i32** %9
%124 = load i32, i32* %17
%125 = sub nsw i32 %124, 1
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %123, i64 %126
store i32 %122, i32* %127
br label %128
128: ; preds = %121
%129 = load i32, i32* %15
%130 = add nsw i32 %129, 1
store i32 %130, i32* %15
br label %80
131: ; preds = %80
%132 = load i32, i32* %11
%133 = load i32, i32* %12
%134 = add nsw i32 %133, %132
store i32 %134, i32* %12
%135 = load i32*, i32** %6
%136 = call i32 @fscanf(i32* %135, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %11)
store i32 %136, i32* %16
%137 = load i32, i32* %10
%138 = add nsw i32 %137, 1
store i32 %138, i32* %10
%139 = load i32, i32* %16
%140 = icmp ne i32 %139, 1
br i1 %140, label %141, label %149
141: ; preds = %131
%142 = load i32, i32* %12
%143 = load i32, i32* %8
%144 = icmp ne i32 %142, %143
br i1 %144, label %145, label %148
145: ; preds = %141
%146 = load i8*, i8** %7
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i8* %146)
store i32 1, i32* %5
br label %171
148: ; preds = %141
store i32 1, i32* %13
store i32 0, i32* %11
br label %149
149: ; preds = %148, %131
%150 = load i32, i32* %11
%151 = icmp slt i32 %150, 0
br i1 %151, label %152, label %158
152: ; preds = %149
%153 = load i8*, i8** %7
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %153)
%155 = load i32, i32* %10
%156 = load i32, i32* %11
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %155, i32 %156)
store i32 1, i32* %5
br label %171
158: ; preds = %149
%159 = load i32, i32* %12
%160 = load i32, i32* %11
%161 = add nsw i32 %159, %160
%162 = load i32, i32* %8
%163 = icmp sgt i32 %161, %162
br i1 %163, label %164, label %169
164: ; preds = %158
%165 = load i8*, i8** %7
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %165)
%167 = load i32, i32* %8
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %167)
store i32 1, i32* %5
br label %171
169: ; preds = %158
br label %70
170: ; preds = %77
store i32 0, i32* %5
br label %171
171: ; preds = %170, %164, %152, %145, %116, %99, %89, %64, %52, %45
%172 = load i32, i32* %5
ret i32 %172
}

LLVM IR (-O2):
@DEBUG_TRACE = external global i32
@.str.1 = [32 x i8] c"ERROR: In assignment file `%s'\0A\00"
@.str.3 = [43 x i8] c" Size of set %d less than zero (%d)\0A\00"
@.str.4 = [48 x i8] c" Total set sizes greater than nvtxs (%d)\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [48 x i8] c"ERROR: Too few values in assignment file `%s'.\0A\00"
@.str.7 = [40 x i8] c" Entry %d of set %d invalid (%d)\0A\00"
@.str.8 = [44 x i8] c" Vertex %d assigned to multiple sets\0A\00"
@str = [23 x i8] c" No values found\00"
@str.9 = [28 x i8] c"<Entering input_assign_inv>\00"
define i32 @input_assign_inv(i32* %0, i8* %1, i32 %2, i32* nocapture %3) {
%5 = bitcast i32* %3 to i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %6 to i8*
%10 = bitcast i32* %7 to i8*
%11 = bitcast i32* %8 to i8*
%12 = load i32, i32* @DEBUG_TRACE
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.9, i64 0, i64 0))
br label %16
16: ; preds = %14, %4
%17 = icmp sgt i32 %2, 0
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = zext i32 %2 to i64
%20 = shl nuw nsw i64 %19, 2
br label %21
21: ; preds = %18, %16
store i32 1, i32* %7
br label %22
22: ; preds = %25, %21
%23 = phi i32 [ %26, %25 ], [ undef, %21 ]
%24 = phi i32 [ %27, %25 ], [ 1, %21 ]
switch i32 %24, label %31 [
i32 1, label %25
i32 -1, label %28
]
25: ; preds = %22
%26 = call i32 (i32*, i32*, ...) bitcast (i32 (...)* @read_int to i32 (i32*, i32*, ...)*)(i32* %0, i32* %7)
store i32 %26, i32* %6
%27 = load i32, i32* %7
br label %22
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %107
31: ; preds = %22
%32 = icmp slt i32 %23, 0
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %23)
br label %107
36: ; preds = %31
%37 = icmp sgt i32 %23, %2
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %2)
br label %107
41: ; preds = %36, %99
%42 = phi i32 [ %101, %99 ], [ %23, %36 ]
%43 = phi i32 [ %85, %99 ], [ 0, %36 ]
%44 = phi i32 [ %83, %99 ], [ 0, %36 ]
%45 = phi i32 [ %100, %99 ], [ 0, %36 ]
%46 = icmp eq i32 %45, 0
%47 = icmp slt i32 %44, %2
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %49, label %107
49: ; preds = %41
%50 = icmp eq i32 %42, 0
br i1 %50, label %81, label %51
51: ; preds = %49, %77
%52 = phi i32 [ %78, %77 ], [ 1, %49 ]
%53 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %8)
%54 = icmp eq i32 %53, 1
br i1 %54, label %57, label %55
55: ; preds = %51
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i8* %1)
br label %107
57: ; preds = %51
%58 = load i32, i32* %8
%59 = icmp slt i32 %58, 1
%60 = icmp sgt i32 %58, %2
%61 = or i1 %59, %60
br i1 %61, label %62, label %67
62: ; preds = %57
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%64 = add nsw i32 %52, %44
%65 = load i32, i32* %8
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %64, i32 %43, i32 %65)
br label %107
67: ; preds = %57
%68 = add nsw i32 %58, -1
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %3, i64 %69
%71 = load i32, i32* %70
%72 = icmp eq i32 %71, -1
br i1 %72, label %77, label %73
73: ; preds = %67
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%75 = load i32, i32* %8
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i32 %75)
br label %107
77: ; preds = %67
store i32 %43, i32* %70
%78 = add nuw nsw i32 %52, 1
%79 = load i32, i32* %6
%80 = icmp slt i32 %52, %79
br i1 %80, label %51, label %81
81: ; preds = %77, %49
%82 = phi i32 [ 0, %49 ], [ %79, %77 ]
%83 = add nsw i32 %82, %44
%84 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %6)
%85 = add nuw nsw i32 %43, 1
%86 = icmp eq i32 %84, 1
br i1 %86, label %92, label %87
87: ; preds = %81
%88 = icmp eq i32 %83, %2
br i1 %88, label %91, label %89
89: ; preds = %87
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i8* %1)
br label %107
91: ; preds = %87
store i32 0, i32* %6
br label %99
92: ; preds = %81
%93 = load i32, i32* %6
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %99
95: ; preds = %92
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%97 = load i32, i32* %6
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %85, i32 %97)
br label %107
99: ; preds = %91, %92
%100 = phi i32 [ 1, %91 ], [ 0, %92 ]
%101 = phi i32 [ 0, %91 ], [ %93, %92 ]
%102 = add nsw i32 %101, %83
%103 = icmp sgt i32 %102, %2
br i1 %103, label %104, label %41
104: ; preds = %99
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %2)
br label %107
107: ; preds = %41, %104, %95, %89, %73, %62, %55, %38, %33, %28
%108 = phi i32 [ 1, %28 ], [ 1, %33 ], [ 1, %38 ], [ 1, %55 ], [ 1, %62 ], [ 1, %73 ], [ 1, %89 ], [ 1, %95 ], [ 1, %104 ], [ 0, %41 ]
ret i32 %108
}