#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 */
scalar_t__ extract_xml_value(char *, char *, char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  FILE *fp;
  char line[1024];
  char lat[16], lon[16], id[16];
  char city[128], country[128], sponsor[128];
  char url[256];
  int count = 0;
  fp = fopen(filename, "r");
  if (fp == NULL) {
    return 1;
  }
  while (fgets(line, 1024, fp) != NULL) {
    if (strncmp(line, "<server", 7) != 0)
      continue;
    if (extract_xml_value(line, url, " url=") != 0)
      continue;
    if (extract_xml_value(line, lat, " lat=") != 0)
      continue;
    if (extract_xml_value(line, lon, " lon=") != 0)
      continue;
    if (extract_xml_value(line, city, " name=") != 0)
      continue;
    if (extract_xml_value(line, country, " country=") != 0)
      continue;
    if (extract_xml_value(line, sponsor, " sponsor=") != 0)
      continue;
    if (extract_xml_value(line, id, " id=") != 0)
      continue;
    printf("server:\n\turl: %s, lat: %s, lon: %s, country: %s, city: %s, "
           "sponsor: %s, id: %s\n",
           url, lat, lon, country, city, sponsor, id);
    count++;
  }
  printf("Number of server: %d\n", count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x6d4(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11aa <main+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1384 <main+0x234>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1370 <main+0x220>
lea    -0x420(%rbp),%rdi
lea    0xe24(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11f5 <main+0xa5>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x6d0(%rbp),%rsi
lea    0xdfe(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     121e <main+0xce>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x430(%rbp),%rsi
lea    0xddb(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     1247 <main+0xf7>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x440(%rbp),%rsi
lea    0xdb8(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     1270 <main+0x120>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x4d0(%rbp),%rsi
lea    0xd95(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     1299 <main+0x149>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x550(%rbp),%rsi
lea    0xd73(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     12c2 <main+0x172>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x5d0(%rbp),%rsi
lea    0xd54(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     12eb <main+0x19b>
jmp    11af <main+0x5f>
lea    -0x420(%rbp),%rdi
lea    -0x450(%rbp),%rsi
lea    0xd35(%rip),%rdx
call   1060 <extract_xml_value@plt>
cmp    $0x0,%rax
je     1314 <main+0x1c4>
jmp    11af <main+0x5f>
lea    -0x6d0(%rbp),%rsi
lea    -0x430(%rbp),%rdx
lea    -0x440(%rbp),%rcx
lea    -0x550(%rbp),%r8
lea    -0x4d0(%rbp),%r9
lea    -0x5d0(%rbp),%r10
lea    -0x450(%rbp),%rax
lea    0xcee(%rip),%rdi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6d4(%rbp)
jmp    11af <main+0x5f>
mov    -0x6d4(%rbp),%esi
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x6f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6c8,%rsp
mov    0x8(%rsi),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1318 <main+0x1c8>
mov    %rax,%r14
lea    0x2c0(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
xor    %ebx,%ebx
movl   $0x0,0xc(%rsp)
test   %rax,%rax
je     1304 <main+0x1b4>
lea    0xe54(%rip),%r15
lea    0x2c0(%rsp),%rbp
lea    0xe4d(%rip),%r12
lea    0x1c0(%rsp),%r13
movl   $0x0,0xc(%rsp)
jmp    11e9 <main+0x99>
nopl   (%rax)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1304 <main+0x1b4>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
lea    0x30(%rsp),%rsi
lea    0xdee(%rip),%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
lea    0x20(%rsp),%rsi
lea    0xddb(%rip),%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
lea    0x140(%rsp),%rsi
lea    0xdc5(%rip),%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
lea    0xc0(%rsp),%rsi
lea    0xdac(%rip),%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
lea    0x40(%rsp),%rsi
lea    0xd99(%rip),%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0xd86(%rip),%rdx
call   1060 <extract_xml_value@plt>
test   %rax,%rax
jne    11d0 <main+0x80>
lea    0xd76(%rip),%rdi
mov    %r13,%rsi
lea    0x30(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0xc0(%rsp),%r8
lea    0x140(%rsp),%r9
xor    %eax,%eax
lea    0x10(%rsp),%rbx
push   %rbx
lea    0x48(%rsp),%rbx
push   %rbx
xor    %ebx,%ebx
call   1040 <printf@plt>
add    $0x10,%rsp
addl   $0x1,0xc(%rsp)
jmp    11d0 <main+0x80>
lea    0xd7f(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    131d <main+0x1cd>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x6c8,%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 = [8 x i8] c"<server\00"
@.str.2 = [6 x i8] c" url=\00"
@.str.3 = [6 x i8] c" lat=\00"
@.str.4 = [6 x i8] c" lon=\00"
@.str.5 = [7 x i8] c" name=\00"
@.str.6 = [10 x i8] c" country=\00"
@.str.7 = [10 x i8] c" sponsor=\00"
@.str.8 = [5 x i8] c" id=\00"
@.str.9 = [80 x i8] c"server:\0A\09url: %s, lat: %s, lon: %s, country: %s, city: %s, sponsor: %s, id: %s\0A\00"
@.str.10 = [22 x i8] c"Number of server: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca [16 x i8]
%10 = alloca [16 x i8]
%11 = alloca [16 x i8]
%12 = alloca [128 x i8]
%13 = alloca [128 x i8]
%14 = alloca [128 x i8]
%15 = alloca [256 x i8]
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
store i32 0, i32* %16
%20 = load i8*, i8** %6
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %7
%22 = load i32*, i32** %7
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %2
store i32 1, i32* %3
br label %92
25: ; preds = %2
br label %26
26: ; preds = %78, %77, %71, %65, %59, %53, %47, %41, %35, %25
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%28 = load i32*, i32** %7
%29 = call i32* @fgets(i8* %27, i32 1024, i32* %28)
%30 = icmp ne i32* %29, null
br i1 %30, label %31, label %89
31: ; preds = %26
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%33 = call i64 @strncmp(i8* %32, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
br label %26
36: ; preds = %31
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%39 = call i64 @extract_xml_value(i8* %37, i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %36
br label %26
42: ; preds = %36
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%44 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%45 = call i64 @extract_xml_value(i8* %43, i8* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %42
br label %26
48: ; preds = %42
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%51 = call i64 @extract_xml_value(i8* %49, i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %48
br label %26
54: ; preds = %48
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%57 = call i64 @extract_xml_value(i8* %55, i8* %56, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %54
br label %26
60: ; preds = %54
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%62 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%63 = call i64 @extract_xml_value(i8* %61, i8* %62, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %60
br label %26
66: ; preds = %60
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%69 = call i64 @extract_xml_value(i8* %67, i8* %68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %66
br label %26
72: ; preds = %66
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%74 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%75 = call i64 @extract_xml_value(i8* %73, i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %72
br label %26
78: ; preds = %72
%79 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%80 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%81 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%82 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%83 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%84 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%85 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.9, i64 0, i64 0), i8* %79, i8* %80, i8* %81, i8* %82, i8* %83, i8* %84, i8* %85)
%87 = load i32, i32* %16
%88 = add nsw i32 %87, 1
store i32 %88, i32* %16
br label %26
89: ; preds = %26
%90 = load i32, i32* %16
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %90)
br label %92
92: ; preds = %89, %24
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [8 x i8] c"<server\00"
@.str.2 = [6 x i8] c" url=\00"
@.str.3 = [6 x i8] c" lat=\00"
@.str.4 = [6 x i8] c" lon=\00"
@.str.5 = [7 x i8] c" name=\00"
@.str.6 = [10 x i8] c" country=\00"
@.str.7 = [10 x i8] c" sponsor=\00"
@.str.8 = [5 x i8] c" id=\00"
@.str.9 = [80 x i8] c"server:\0A\09url: %s, lat: %s, lon: %s, country: %s, city: %s, sponsor: %s, id: %s\0A\00"
@.str.10 = [22 x i8] c"Number of server: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = alloca [128 x i8]
%10 = alloca [256 x i8]
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%21 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %61, label %23
23: ; preds = %2
%24 = call i32* @fgets(i8* %13, i32 1024, i32* %21)
%25 = icmp eq i32* %24, null
br i1 %25, label %58, label %26
26: ; preds = %23, %54
%27 = phi i32 [ %55, %54 ], [ 0, %23 ]
%28 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %54
30: ; preds = %26
%31 = call i64 @extract_xml_value(i8* %13, i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %54
33: ; preds = %30
%34 = call i64 @extract_xml_value(i8* %13, i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %54
36: ; preds = %33
%37 = call i64 @extract_xml_value(i8* %13, i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %54
39: ; preds = %36
%40 = call i64 @extract_xml_value(i8* %13, i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %54
42: ; preds = %39
%43 = call i64 @extract_xml_value(i8* %13, i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = call i64 @extract_xml_value(i8* %13, i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = call i64 @extract_xml_value(i8* %13, i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.9, i64 0, i64 0), i8* %20, i8* %14, i8* %15, i8* %18, i8* %17, i8* %19, i8* %16)
%53 = add nsw i32 %27, 1
br label %54
54: ; preds = %51, %26, %30, %33, %36, %39, %42, %45, %48
%55 = phi i32 [ %27, %26 ], [ %27, %30 ], [ %27, %33 ], [ %27, %36 ], [ %27, %39 ], [ %27, %42 ], [ %27, %45 ], [ %27, %48 ], [ %53, %51 ]
%56 = call i32* @fgets(i8* %13, i32 1024, i32* %21)
%57 = icmp eq i32* %56, null
br i1 %57, label %58, label %26
58: ; preds = %54, %23
%59 = phi i32 [ 0, %23 ], [ %55, %54 ]
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %2, %58
%62 = phi i32 [ 0, %58 ], [ 1, %2 ]
ret i32 %62
}