#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 uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fill_ipv4_lpm_table(int *, int, int);
int /*<<< orphan*/ fill_macfwd_table(int *);
int /*<<< orphan*/ fill_nexthops_table(int, int, int *, int *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, char *, int *, int *, int *, int *, int *, int *,
           ...);
int strlen(char *);
int read_config_from_file(char *filename) {
  FILE *f;
  char line[100];
  uint8_t smac[6];
  uint8_t dmac[6];
  uint8_t ip[4];
  uint8_t port;
  uint8_t prefix;
  uint32_t nhgrp;
  char dummy;
  f = fopen(filename, "r");
  if (f == NULL)
    return -1;
  int line_index = 0;
  while (fgets(line, sizeof(line), f)) {
    line[strlen(line) - 1] = '\0';
    line_index++;
    printf("Sor: %d.", line_index);
    if (line[0] == 'M') {
      if (7 == sscanf(line, "%c %hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &dummy,
                      &dmac[0], &dmac[1], &dmac[2], &dmac[3], &dmac[4],
                      &dmac[5])) {
        fill_macfwd_table(dmac);
      } else {
        printf("Wrong format error in line\n");
        fclose(f);
        return -1;
      }
    } else if (line[0] == 'E') {
      if (7 == sscanf(line, "%c %hhd.%hhd.%hhd.%hhd %hhd %d", &dummy, &ip[0],
                      &ip[1], &ip[2], &ip[3], &prefix, &nhgrp)) {
        fill_ipv4_lpm_table(ip, prefix, nhgrp);
      } else {
        printf("Wrong format error in line\n");
        fclose(f);
        return -1;
      }
    } else if (line[0] == 'N') {
      char dummy2;
      if (15 == sscanf(line,
                       "%c %d %hhd %hhx:%hhx:%hhx:%hhx:%hhx:%hhx "
                       "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
                       &dummy2, &nhgrp, &port, &smac[0], &smac[1], &smac[2],
                       &smac[3], &smac[4], &smac[5], &dmac[0], &dmac[1],
                       &dmac[2], &dmac[3], &dmac[4], &dmac[5])) {
        printf("%s\n", line);
        printf("%c %d %d %hhx:%hhx:%hhx:%hhx:%hhx:%hhx "
               "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
               dummy, nhgrp, port, smac[0], smac[1], smac[2], smac[3], smac[4],
               smac[5], dmac[0], dmac[1], dmac[2], dmac[3], dmac[4], dmac[5]);
        fill_nexthops_table(nhgrp, port, smac, dmac);
      } else {
        printf("Wrong format error in line\n");
        fclose(f);
        return -1;
      }
    } else {
      printf("Wrong format error in line\n");
      fclose(f);
      return -1;
    }
  }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<read_config_from_file>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rdi,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11d3 <read_config_from_file+0x43>
movl   $0xffffffff,-0x2c(%rbp)
jmp    163a <read_config_from_file+0x4aa>
movl   $0x0,-0x114(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    $0x64,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     162a <read_config_from_file+0x49a>
lea    -0xb0(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0xb0(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
mov    -0x114(%rbp),%esi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x4d,%eax
jne    12f8 <read_config_from_file+0x168>
lea    -0xb0(%rbp),%rdi
lea    -0xf0(%rbp),%rcx
lea    -0xf0(%rbp),%r8
add    $0x4,%r8
lea    -0xf0(%rbp),%r9
add    $0x8,%r9
lea    -0xf0(%rbp),%r11
add    $0xc,%r11
lea    -0xf0(%rbp),%r10
add    $0x10,%r10
lea    -0xf0(%rbp),%rax
add    $0x14,%rax
lea    0xd77(%rip),%rsi
lea    -0x10d(%rbp),%rdx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0x7,%eax
cmp    %ecx,%eax
jne    12d0 <read_config_from_file+0x140>
lea    -0xf0(%rbp),%rdi
call   1090 <fill_macfwd_table@plt>
jmp    12f3 <read_config_from_file+0x163>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    163a <read_config_from_file+0x4aa>
jmp    1625 <read_config_from_file+0x495>
movsbl -0xb0(%rbp),%eax
cmp    $0x45,%eax
jne    13bc <read_config_from_file+0x22c>
lea    -0xb0(%rbp),%rdi
lea    -0x100(%rbp),%rcx
lea    -0x100(%rbp),%r8
add    $0x4,%r8
lea    -0x100(%rbp),%r9
add    $0x8,%r9
lea    -0x100(%rbp),%r11
add    $0xc,%r11
lea    0xd0a(%rip),%rsi
lea    -0x10d(%rbp),%rdx
lea    -0x108(%rbp),%r10
lea    -0x10c(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0x7,%eax
cmp    %ecx,%eax
jne    1394 <read_config_from_file+0x204>
lea    -0x100(%rbp),%rdi
mov    -0x108(%rbp),%esi
mov    -0x10c(%rbp),%edx
call   10b0 <fill_ipv4_lpm_table@plt>
jmp    13b7 <read_config_from_file+0x227>
lea    0xc91(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    163a <read_config_from_file+0x4aa>
jmp    1620 <read_config_from_file+0x490>
movsbl -0xb0(%rbp),%eax
cmp    $0x4e,%eax
jne    15f8 <read_config_from_file+0x468>
lea    -0xb0(%rbp),%rdi
lea    -0xd0(%rbp),%r9
lea    -0xd0(%rbp),%rax
add    $0x4,%rax
lea    -0xd0(%rbp),%rcx
add    $0x8,%rcx
mov    %rcx,-0x130(%rbp)
lea    -0xd0(%rbp),%rcx
add    $0xc,%rcx
mov    %rcx,-0x128(%rbp)
lea    -0xd0(%rbp),%r13
add    $0x10,%r13
lea    -0xd0(%rbp),%r12
add    $0x14,%r12
lea    -0xf0(%rbp),%r15
lea    -0xf0(%rbp),%r14
add    $0x4,%r14
lea    -0xf0(%rbp),%rbx
add    $0x8,%rbx
lea    -0xf0(%rbp),%r11
add    $0xc,%r11
lea    -0xf0(%rbp),%r10
add    $0x10,%r10
lea    -0xf0(%rbp),%rcx
add    $0x14,%rcx
mov    %rcx,-0x120(%rbp)
lea    0xbfc(%rip),%rsi
lea    -0x115(%rbp),%rdx
lea    -0x10c(%rbp),%rcx
lea    -0x104(%rbp),%r8
mov    %rax,(%rsp)
mov    -0x130(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x128(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x120(%rbp),%rax
mov    %r13,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
mov    %rbx,0x38(%rsp)
mov    %r11,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    $0xf,%eax
cmp    %ecx,%eax
jne    15d0 <read_config_from_file+0x440>
lea    -0xb0(%rbp),%rsi
lea    0xbbf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsbl -0x10d(%rbp),%esi
mov    -0x10c(%rbp),%edx
mov    -0x104(%rbp),%ecx
mov    -0xd0(%rbp),%r8d
mov    -0xcc(%rbp),%r9d
mov    -0xc8(%rbp),%eax
mov    -0xc4(%rbp),%edi
mov    %edi,-0x138(%rbp)
mov    -0xc0(%rbp),%r13d
mov    -0xbc(%rbp),%r12d
mov    -0xf0(%rbp),%r15d
mov    -0xec(%rbp),%r14d
mov    -0xe8(%rbp),%ebx
mov    -0xe4(%rbp),%r11d
mov    -0xe0(%rbp),%r10d
mov    -0xdc(%rbp),%edi
mov    %edi,-0x134(%rbp)
lea    0xb46(%rip),%rdi
mov    %eax,(%rsp)
mov    -0x138(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x134(%rbp),%eax
mov    %r13d,0x10(%rsp)
mov    %r12d,0x18(%rsp)
mov    %r15d,0x20(%rsp)
mov    %r14d,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11d,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10c(%rbp),%edi
mov    -0x104(%rbp),%esi
lea    -0xd0(%rbp),%rdx
lea    -0xf0(%rbp),%rcx
call   1030 <fill_nexthops_table@plt>
jmp    15f3 <read_config_from_file+0x463>
lea    0xa55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    163a <read_config_from_file+0x4aa>
jmp    161b <read_config_from_file+0x48b>
lea    0xa2d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    163a <read_config_from_file+0x4aa>
jmp    1620 <read_config_from_file+0x490>
jmp    1625 <read_config_from_file+0x495>
jmp    11dd <read_config_from_file+0x4d>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_config_from_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xe48(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
mov    %rcx,0x10(%rsp)
test   %rcx,%rcx
je     14a5 <read_config_from_file+0x305>
lea    0xa0(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x64,%esi
mov    0x10(%rsp),%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     147c <read_config_from_file+0x2dc>
lea    0x2c(%rsp),%r14
lea    0x30(%rsp),%r12
mov    $0x1,%r13d
lea    0x60(%rsp),%r15
jmp    1234 <read_config_from_file+0x94>
nopl   (%rax)
lea    0x60(%rsp),%r15
mov    %rbp,%rdi
mov    $0x64,%esi
mov    0x10(%rsp),%rdx
call   1080 <fgets@plt>
add    $0x1,%r13d
test   %rax,%rax
je     147c <read_config_from_file+0x2dc>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
lea    0xdb8(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movzbl 0xa0(%rsp),%eax
cmp    $0x45,%al
je     12c0 <read_config_from_file+0x120>
cmp    $0x4e,%al
je     1320 <read_config_from_file+0x180>
cmp    $0x4d,%al
lea    0x20(%rsp),%r15
jne    148a <read_config_from_file+0x2ea>
sub    $0x8,%rsp
mov    %rbp,%rdi
lea    0xd88(%rip),%rsi
lea    0x13(%rsp),%rdx
mov    %r15,%rcx
lea    0x2c(%rsp),%r8
lea    0x30(%rsp),%r9
xor    %eax,%eax
lea    0x3c(%rsp),%rbx
push   %rbx
push   %r12
push   %r14
call   1090 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    148a <read_config_from_file+0x2ea>
mov    %r15,%rdi
call   10a0 <fill_macfwd_table@plt>
jmp    1210 <read_config_from_file+0x70>
sub    $0x8,%rsp
mov    %rbp,%rdi
lea    0xd5e(%rip),%rsi
lea    0x13(%rsp),%rdx
mov    %r15,%rcx
lea    0x6c(%rsp),%r8
lea    0x70(%rsp),%r9
xor    %eax,%eax
lea    0x14(%rsp),%rbx
push   %rbx
lea    0x6c(%rsp),%rbx
push   %rbx
lea    0x84(%rsp),%rbx
push   %rbx
call   1090 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    148a <read_config_from_file+0x2ea>
mov    0x5c(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %r15,%rdi
call   10c0 <fill_ipv4_lpm_table@plt>
jmp    1215 <read_config_from_file+0x75>
xchg   %ax,%ax
sub    $0x8,%rsp
mov    %rbp,%rdi
lea    0xd1d(%rip),%rsi
lea    0x27(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x44(%rsp),%r8
lea    0x48(%rsp),%r9
xor    %eax,%eax
lea    0x3c(%rsp),%rbx
push   %rbx
push   %r12
push   %r14
lea    0x48(%rsp),%rbx
push   %rbx
lea    0x4c(%rsp),%rbx
push   %rbx
lea    0x50(%rsp),%rbx
push   %rbx
lea    0x8c(%rsp),%rbx
push   %rbx
lea    0x90(%rsp),%rbx
push   %rbx
lea    0x94(%rsp),%rbx
push   %rbx
lea    0x98(%rsp),%rbx
push   %rbx
lea    0x9c(%rsp),%rbx
push   %rbx
call   1090 <sscanf@plt>
add    $0x60,%rsp
cmp    $0xf,%eax
jne    148a <read_config_from_file+0x2ea>
mov    %rbp,%rdi
call   1030 <puts@plt>
movsbl 0xb(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x3c(%rsp),%ecx
mov    0x40(%rsp),%r8d
mov    0x44(%rsp),%r9d
mov    0x48(%rsp),%eax
mov    %rax,0x98(%rsp)
mov    0x4c(%rsp),%eax
mov    %rax,0x90(%rsp)
mov    0x50(%rsp),%eax
mov    %rax,0x88(%rsp)
mov    0x54(%rsp),%eax
mov    %rax,0x80(%rsp)
mov    0x20(%rsp),%eax
mov    %rax,0x78(%rsp)
mov    0x24(%rsp),%eax
mov    %rax,0x70(%rsp)
mov    0x28(%rsp),%r14d
mov    0x2c(%rsp),%r10d
mov    0x30(%rsp),%r11d
mov    0x34(%rsp),%ebx
lea    0xc78(%rip),%rdi
xor    %eax,%eax
push   %rbx
push   %r11
push   %r10
push   %r14
lea    0x50(%rsp),%r12
lea    0x4c(%rsp),%r14
push   0x90(%rsp)
push   0xa0(%rsp)
push   0xb0(%rsp)
push   0xc0(%rsp)
push   0xd0(%rsp)
push   0xe0(%rsp)
call   1070 <printf@plt>
add    $0x50,%rsp
mov    0xc(%rsp),%edi
mov    0x3c(%rsp),%esi
lea    0x40(%rsp),%rdx
lea    0x20(%rsp),%rcx
call   1040 <fill_nexthops_table@plt>
jmp    1210 <read_config_from_file+0x70>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    14a5 <read_config_from_file+0x305>
lea    0xc46(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
mov    $0xffffffff,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [9 x i8] c"Sor: %d.\00"
@.str.2 = [33 x i8] c"%c %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\00"
@.str.3 = [28 x i8] c"Wrong format error in line\0A\00"
@.str.4 = [31 x i8] c"%c %hhd.%hhd.%hhd.%hhd %hhd %d\00"
@.str.5 = [71 x i8] c"%c %d %hhd %hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [69 x i8] c"%c %d %d %hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\00"
define i32 @read_config_from_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [100 x i8]
%6 = alloca [6 x i32]
%7 = alloca [6 x i32]
%8 = alloca [4 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i32
%14 = alloca i8
store i8* %0, i8** %3
%15 = load i8*, i8** %3
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %4
%17 = load i32*, i32** %4
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %20
19: ; preds = %1
store i32 -1, i32* %2
br label %154
20: ; preds = %1
store i32 0, i32* %13
br label %21
21: ; preds = %150, %20
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%23 = load i32*, i32** %4
%24 = call i64 @fgets(i8* %22, i32 100, i32* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %151
26: ; preds = %21
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %30
store i8 0, i8* %31
%32 = load i32, i32* %13
%33 = add nsw i32 %32, 1
store i32 %33, i32* %13
%34 = load i32, i32* %13
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 77
br i1 %39, label %40, label %58
40: ; preds = %26
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%42 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%43 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 1
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 2
%45 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 3
%46 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 4
%47 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 5
%48 = call i32 (i8*, i8*, i8*, i32*, i32*, i32*, i32*, i32*, i32*, ...) @sscanf(i8* %41, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %12, i32* %42, i32* %43, i32* %44, i32* %45, i32* %46, i32* %47)
%49 = icmp eq i32 7, %48
br i1 %49, label %50, label %53
50: ; preds = %40
%51 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%52 = call i32 @fill_macfwd_table(i32* %51)
br label %57
53: ; preds = %40
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%55 = load i32*, i32** %4
%56 = call i32 @fclose(i32* %55)
store i32 -1, i32* %2
br label %154
57: ; preds = %50
br label %150
58: ; preds = %26
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 69
br i1 %62, label %63, label %81
63: ; preds = %58
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%65 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%66 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 1
%67 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 2
%68 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 3
%69 = call i32 (i8*, i8*, i8*, i32*, i32*, i32*, i32*, i32*, i32*, ...) @sscanf(i8* %64, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %12, i32* %65, i32* %66, i32* %67, i32* %68, i32* %10, i32* %11)
%70 = icmp eq i32 7, %69
br i1 %70, label %71, label %76
71: ; preds = %63
%72 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%73 = load i32, i32* %10
%74 = load i32, i32* %11
%75 = call i32 @fill_ipv4_lpm_table(i32* %72, i32 %73, i32 %74)
br label %80
76: ; preds = %63
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%78 = load i32*, i32** %4
%79 = call i32 @fclose(i32* %78)
store i32 -1, i32* %2
br label %154
80: ; preds = %71
br label %149
81: ; preds = %58
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 78
br i1 %85, label %86, label %144
86: ; preds = %81
%87 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%88 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%89 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 1
%90 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 2
%91 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 3
%92 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 4
%93 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 5
%94 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%95 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 1
%96 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 2
%97 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 3
%98 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 4
%99 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 5
%100 = call i32 (i8*, i8*, i8*, i32*, i32*, i32*, i32*, i32*, i32*, ...) @sscanf(i8* %87, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0), i8* %14, i32* %11, i32* %9, i32* %88, i32* %89, i32* %90, i32* %91, i32* %92, i32* %93, i32* %94, i32* %95, i32* %96, i32* %97, i32* %98, i32* %99)
%101 = icmp eq i32 15, %100
br i1 %101, label %102, label %139
102: ; preds = %86
%103 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %103)
%105 = load i8, i8* %12
%106 = sext i8 %105 to i32
%107 = load i32, i32* %11
%108 = load i32, i32* %9
%109 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%110 = load i32, i32* %109
%111 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 1
%112 = load i32, i32* %111
%113 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 2
%114 = load i32, i32* %113
%115 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 3
%116 = load i32, i32* %115
%117 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 4
%118 = load i32, i32* %117
%119 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 5
%120 = load i32, i32* %119
%121 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%122 = load i32, i32* %121
%123 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 1
%124 = load i32, i32* %123
%125 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 2
%126 = load i32, i32* %125
%127 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 3
%128 = load i32, i32* %127
%129 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 4
%130 = load i32, i32* %129
%131 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 5
%132 = load i32, i32* %131
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.7, i64 0, i64 0), i32 %106, i32 %107, i32 %108, i32 %110, i32 %112, i32 %114, i32 %116, i32 %118, i32 %120, i32 %122, i32 %124, i32 %126, i32 %128, i32 %130, i32 %132)
%134 = load i32, i32* %11
%135 = load i32, i32* %9
%136 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%137 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%138 = call i32 @fill_nexthops_table(i32 %134, i32 %135, i32* %136, i32* %137)
br label %143
139: ; preds = %86
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%141 = load i32*, i32** %4
%142 = call i32 @fclose(i32* %141)
store i32 -1, i32* %2
br label %154
143: ; preds = %102
br label %148
144: ; preds = %81
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%146 = load i32*, i32** %4
%147 = call i32 @fclose(i32* %146)
store i32 -1, i32* %2
br label %154
148: ; preds = %143
br label %149
149: ; preds = %148, %80
br label %150
150: ; preds = %149, %57
br label %21
151: ; preds = %21
%152 = load i32*, i32** %4
%153 = call i32 @fclose(i32* %152)
store i32 0, i32* %2
br label %154
154: ; preds = %151, %144, %139, %76, %53, %19
%155 = load i32, i32* %2
ret i32 %155
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [9 x i8] c"Sor: %d.\00"
@.str.2 = [33 x i8] c"%c %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\00"
@.str.4 = [31 x i8] c"%c %hhd.%hhd.%hhd.%hhd %hhd %d\00"
@.str.5 = [71 x i8] c"%c %d %hhd %hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\00"
@.str.7 = [69 x i8] c"%c %d %d %hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\00"
@str.10 = [27 x i8] c"Wrong format error in line\00"
define i32 @read_config_from_file(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = alloca [6 x i32]
%4 = alloca [6 x i32]
%5 = alloca [4 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%12 = bitcast [6 x i32]* %3 to i8*
%13 = bitcast [6 x i32]* %4 to i8*
%14 = bitcast [4 x i32]* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = bitcast i32* %8 to i8*
%18 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %103, label %20
20: ; preds = %1
%21 = call i64 @fgets(i8* %11, i32 100, i32* %18)
%22 = icmp eq i64 %21, 0
br i1 %22, label %101, label %23
23: ; preds = %20
%24 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 3
%28 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 4
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 5
%30 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%31 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 1
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 2
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 3
%34 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 4
%35 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 5
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 1
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
br label %40
40: ; preds = %23, %98
%41 = phi i32 [ 0, %23 ], [ %46, %98 ]
%42 = call i32 @strlen(i8* %11)
%43 = add nsw i32 %42, -1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %44
store i8 0, i8* %45
%46 = add nuw nsw i32 %41, 1
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i8, i8* %11
switch i8 %48, label %95 [
i8 77, label %49
i8 69, label %57
i8 78, label %67
]
49: ; preds = %40
%50 = call i32 (i8*, i8*, i8*, i32*, i32*, i32*, i32*, i32*, i32*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %9, i32* %30, i32* %31, i32* %32, i32* %33, i32* %34, i32* %35)
%51 = icmp eq i32 %50, 7
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @fill_macfwd_table(i32* %30)
br label %98
54: ; preds = %49
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%56 = call i32 @fclose(i32* %18)
br label %103
57: ; preds = %40
%58 = call i32 (i8*, i8*, i8*, i32*, i32*, i32*, i32*, i32*, i32*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %9, i32* %36, i32* %37, i32* %38, i32* %39, i32* %7, i32* %8)
%59 = icmp eq i32 %58, 7
br i1 %59, label %60, label %64
60: ; preds = %57
%61 = load i32, i32* %7
%62 = load i32, i32* %8
%63 = call i32 @fill_ipv4_lpm_table(i32* %36, i32 %61, i32 %62)
br label %98
64: ; preds = %57
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%66 = call i32 @fclose(i32* %18)
br label %103
67: ; preds = %40
%68 = call i32 (i8*, i8*, i8*, i32*, i32*, i32*, i32*, i32*, i32*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0), i8* %10, i32* %8, i32* %6, i32* %24, i32* %25, i32* %26, i32* %27, i32* %28, i32* %29, i32* %30, i32* %31, i32* %32, i32* %33, i32* %34, i32* %35)
%69 = icmp eq i32 %68, 15
br i1 %69, label %70, label %92
70: ; preds = %67
%71 = call i32 @puts(i8* %11)
%72 = load i8, i8* %9
%73 = sext i8 %72 to i32
%74 = load i32, i32* %8
%75 = load i32, i32* %6
%76 = load i32, i32* %24
%77 = load i32, i32* %25
%78 = load i32, i32* %26
%79 = load i32, i32* %27
%80 = load i32, i32* %28
%81 = load i32, i32* %29
%82 = load i32, i32* %30
%83 = load i32, i32* %31
%84 = load i32, i32* %32
%85 = load i32, i32* %33
%86 = load i32, i32* %34
%87 = load i32, i32* %35
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.7, i64 0, i64 0), i32 %73, i32 %74, i32 %75, i32 %76, i32 %77, i32 %78, i32 %79, i32 %80, i32 %81, i32 %82, i32 %83, i32 %84, i32 %85, i32 %86, i32 %87)
%89 = load i32, i32* %8
%90 = load i32, i32* %6
%91 = call i32 @fill_nexthops_table(i32 %89, i32 %90, i32* %24, i32* %30)
br label %98
92: ; preds = %67
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%94 = call i32 @fclose(i32* %18)
br label %103
95: ; preds = %40
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%97 = call i32 @fclose(i32* %18)
br label %103
98: ; preds = %70, %60, %52
%99 = call i64 @fgets(i8* %11, i32 100, i32* %18)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %40
101: ; preds = %98, %20
%102 = call i32 @fclose(i32* %18)
br label %103
103: ; preds = %92, %54, %64, %95, %101, %1
%104 = phi i32 [ -1, %1 ], [ -1, %54 ], [ -1, %64 ], [ -1, %92 ], [ -1, %95 ], [ 0, %101 ]
ret i32 %104
}