#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 */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sky_webradio_close();
int /*<<< orphan*/ sky_webradio_init();
int /*<<< orphan*/ sky_webradio_parse_xml();
long strtol(char *, char **, int);
int main(int argc, char *argv[]) {
  int i;
  long int test_num = 0;
  char *endptr = NULL;
  if (argc == 2) {
    test_num = strtol(argv[1], &endptr, 10);
    if (*endptr) {
      printf("Invalid argument!\n");
      exit(1);
    }
  }
  sky_webradio_init();
  if (argc == 2) {
    for (i = 0; i < test_num; i++) {
      printf("--------------------------------------------- TEST %d "
             "----------------------------------------\n",
             i);
      sky_webradio_parse_xml();
    }
  } else {
    for (i = 0; i < 1000; i++) {
      printf("--------------------------------------------- TEST %d "
             "----------------------------------------\n",
             i);
      sky_webradio_parse_xml();
    }
  }
  sky_webradio_close();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11d4 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     11cf <main+0x6f>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    11d4 <main+0x74>
mov    $0x0,%al
call   1040 <sky_webradio_init@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1225 <main+0xc5>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1220 <main+0xc0>
mov    -0x14(%rbp),%esi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <sky_webradio_parse_xml@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ec <main+0x8c>
jmp    1264 <main+0x104>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    125f <main+0xff>
mov    -0x14(%rbp),%esi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <sky_webradio_parse_xml@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    122c <main+0xcc>
jmp    1264 <main+0x104>
mov    $0x0,%al
call   1070 <sky_webradio_close@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
cmp    $0x2,%edi
jne    11de <main+0x6e>
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%r15
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
jne    1222 <main+0xb2>
xor    %eax,%eax
call   1050 <sky_webradio_init@plt>
test   %r15,%r15
jle    120e <main+0x9e>
lea    0xe48(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <sky_webradio_parse_xml@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11c0 <main+0x50>
jmp    120e <main+0x9e>
xor    %eax,%eax
call   1050 <sky_webradio_init@plt>
lea    0xe14(%rip),%rbx
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <sky_webradio_parse_xml@plt>
add    $0x1,%ebp
cmp    $0x3e8,%ebp
jne    11f0 <main+0x80>
xor    %eax,%eax
call   1080 <sky_webradio_close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe37(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Invalid argument!\0A\00"
@.str.1 = [96 x i8] c"--------------------------------------------- TEST %d ----------------------------------------\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
store i8* null, i8** %8
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strtol(i8* %14, i8** %8, i32 10)
store i64 %15, i64* %7
%16 = load i8*, i8** %8
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %11
br label %23
23: ; preds = %22, %2
%24 = call i32 (...) @sky_webradio_init()
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %41
27: ; preds = %23
store i32 0, i32* %6
br label %28
28: ; preds = %37, %27
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = load i64, i64* %7
%32 = icmp slt i64 %30, %31
br i1 %32, label %33, label %40
33: ; preds = %28
%34 = load i32, i32* %6
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i32 (...) @sky_webradio_parse_xml()
br label %37
37: ; preds = %33
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %28
40: ; preds = %28
br label %53
41: ; preds = %23
store i32 0, i32* %6
br label %42
42: ; preds = %49, %41
%43 = load i32, i32* %6
%44 = icmp slt i32 %43, 1000
br i1 %44, label %45, label %52
45: ; preds = %42
%46 = load i32, i32* %6
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = call i32 (...) @sky_webradio_parse_xml()
br label %49
49: ; preds = %45
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %42
52: ; preds = %42
br label %53
53: ; preds = %52, %40
%54 = call i32 (...) @sky_webradio_close()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [96 x i8] c"--------------------------------------------- TEST %d ----------------------------------------\0A\00"
@str = [18 x i8] c"Invalid argument!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %16
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @strtol(i8* %8, i8** %3, i32 10)
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %6
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = tail call i32 (...) @sky_webradio_init()
br label %28
18: ; preds = %6
%19 = tail call i32 (...) @sky_webradio_init()
%20 = icmp sgt i64 %9, 0
br i1 %20, label %21, label %34
21: ; preds = %18, %21
%22 = phi i64 [ %26, %21 ], [ 0, %18 ]
%23 = trunc i64 %22 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = tail call i32 (...) @sky_webradio_parse_xml()
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %34, label %21
28: ; preds = %16, %28
%29 = phi i32 [ %32, %28 ], [ 0, %16 ]
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = tail call i32 (...) @sky_webradio_parse_xml()
%32 = add nuw nsw i32 %29, 1
%33 = icmp eq i32 %32, 1000
br i1 %33, label %34, label %28
34: ; preds = %28, %21, %18
%35 = tail call i32 (...) @sky_webradio_close()
ret i32 0
}