#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*/ add_file(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *gen_cdda_url(char *, int, int);
int /*<<< orphan*/ parse_cdda_url(char const *, char **, int *, int *);
void add_cdda(const char *url) {
  char *disc_id = NULL;
  int start_track = 1, end_track = -1;
  parse_cdda_url(url, &disc_id, &start_track, &end_track);
  if (end_track != -1) {
    int i;
    for (i = start_track; i <= end_track; i++) {
      char *new_url = gen_cdda_url(disc_id, i, -1);
      add_file(new_url, 0);
      free(new_url);
    }
  } else
    add_file(url, 0);
  free(disc_id);
}


x86 assembly (clang, -O0):
<add_cdda>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <parse_cdda_url@plt>
cmpl   $0xffffffff,-0x18(%rbp)
je     11cf <add_cdda+0x8f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11ca <add_cdda+0x8a>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0xffffffff,%edx
call   1060 <gen_cdda_url@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1050 <add_file@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1187 <add_cdda+0x47>
jmp    11da <add_cdda+0x9a>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <add_file@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_cdda>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movq   $0x0,0x10(%rsp)
movl   $0x1,0xc(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <parse_cdda_url@plt>
mov    0x8(%rsp),%eax
cmp    $0xffffffff,%eax
je     11c3 <add_cdda+0x83>
mov    0xc(%rsp),%ebx
cmp    %eax,%ebx
jg     11cd <add_cdda+0x8d>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rdi
mov    %ebx,%esi
mov    $0xffffffff,%edx
call   1060 <gen_cdda_url@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
call   1050 <add_file@plt>
mov    %r14,%rdi
call   1030 <free@plt>
lea    0x1(%rbx),%eax
cmp    0x8(%rsp),%ebx
mov    %eax,%ebx
jl     1190 <add_cdda+0x50>
jmp    11cd <add_cdda+0x8d>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <add_file@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @add_cdda(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
store i32 1, i32* %4
store i32 -1, i32* %5
%8 = load i8*, i8** %2
%9 = call i32 @parse_cdda_url(i8* %8, i8** %3, i32* %4, i32* %5)
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %30
12: ; preds = %1
%13 = load i32, i32* %4
store i32 %13, i32* %6
br label %14
14: ; preds = %26, %12
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = load i32, i32* %6
%21 = call i8* @gen_cdda_url(i8* %19, i32 %20, i32 -1)
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @add_file(i8* %22, i32 0)
%24 = load i8*, i8** %7
%25 = call i32 @free(i8* %24)
br label %26
26: ; preds = %18
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %14
29: ; preds = %14
br label %33
30: ; preds = %1
%31 = load i8*, i8** %2
%32 = call i32 @add_file(i8* %31, i32 0)
br label %33
33: ; preds = %30, %29
%34 = load i8*, i8** %3
%35 = call i32 @free(i8* %34)
ret void
}

LLVM IR (-O2):
define void @add_cdda(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%6 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
%8 = call i32 @parse_cdda_url(i8* %0, i8** %2, i32* %3, i32* %4)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, -1
br i1 %10, label %23, label %11
11: ; preds = %1
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, %9
br i1 %13, label %25, label %14
14: ; preds = %11, %14
%15 = phi i32 [ %20, %14 ], [ %12, %11 ]
%16 = load i8*, i8** %2
%17 = call i8* @gen_cdda_url(i8* %16, i32 %15, i32 -1)
%18 = call i32 @add_file(i8* %17, i32 0)
%19 = call i32 @free(i8* %17)
%20 = add nsw i32 %15, 1
%21 = load i32, i32* %4
%22 = icmp slt i32 %15, %21
br i1 %22, label %14, label %25
23: ; preds = %1
%24 = call i32 @add_file(i8* %0, i32 0)
br label %25
25: ; preds = %14, %11, %23
%26 = load i8*, i8** %2
%27 = call i32 @free(i8* %26)
ret void
}