#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*/ download_track_audio(int);
int /*<<< orphan*/ generate_all_tracks_page();
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ prepare_upload_audio(int);
int sscanf(int /*<<< orphan*/, char *, int *);
int main(int argc, char **argv) {
  int i;
  if (sscanf(getenv("QUERY_STRING"), "download=%d", &i) == 1 && i >= 1 &&
      i <= 8) {
    download_track_audio(i);
  }
  if (sscanf(getenv("QUERY_STRING"), "upload=%d", &i) == 1 && i >= 1 &&
      i <= 8) {
    prepare_upload_audio(i);
  } else
    generate_all_tracks_page();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
lea    0xe92(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    11a9 <main+0x59>
cmpl   $0x1,-0x14(%rbp)
jl     11a9 <main+0x59>
cmpl   $0x8,-0x14(%rbp)
jg     11a9 <main+0x59>
mov    -0x14(%rbp),%edi
call   1070 <download_track_audio@plt>
lea    0xe50(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
lea    0xe5b(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    11f1 <main+0xa1>
cmpl   $0x1,-0x14(%rbp)
jl     11f1 <main+0xa1>
cmpl   $0x8,-0x14(%rbp)
jg     11f1 <main+0xa1>
mov    -0x14(%rbp),%edi
call   1040 <prepare_upload_audio@plt>
jmp    11f8 <main+0xa8>
mov    $0x0,%al
call   1050 <generate_all_tracks_page@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <getenv@plt>
lea    0xea9(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %eax,%edi
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    1187 <main+0x37>
mov    0x4(%rsp),%edi
test   %edi,%edi
jle    1187 <main+0x37>
cmp    $0x8,%edi
jg     1187 <main+0x37>
call   1070 <download_track_audio@plt>
lea    0xe72(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe7f(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %eax,%edi
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    11bf <main+0x6f>
mov    0x4(%rsp),%edi
test   %edi,%edi
jle    11bf <main+0x6f>
cmp    $0x8,%edi
jg     11bf <main+0x6f>
call   1040 <prepare_upload_audio@plt>
jmp    11c6 <main+0x76>
xor    %eax,%eax
call   1050 <generate_all_tracks_page@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"QUERY_STRING\00"
@.str.1 = [12 x i8] c"download=%d\00"
@.str.2 = [10 x i8] c"upload=%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @sscanf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i32, i32* %6
%12 = icmp sge i32 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load i32, i32* %6
%15 = icmp sle i32 %14, 8
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %6
%18 = call i32 @download_track_audio(i32 %17)
br label %19
19: ; preds = %16, %13, %10, %2
%20 = call i32 @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @sscanf(i32 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = load i32, i32* %6
%25 = icmp sge i32 %24, 1
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i32, i32* %6
%28 = icmp sle i32 %27, 8
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %6
%31 = call i32 @prepare_upload_audio(i32 %30)
br label %34
32: ; preds = %26, %23, %19
%33 = call i32 (...) @generate_all_tracks_page()
br label %34
34: ; preds = %32, %29
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"QUERY_STRING\00"
@.str.1 = [12 x i8] c"download=%d\00"
@.str.2 = [10 x i8] c"upload=%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @sscanf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = icmp eq i32 %6, 1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
%10 = select i1 %7, i1 %9, i1 false
%11 = icmp slt i32 %8, 9
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @download_track_audio(i32 %8)
br label %15
15: ; preds = %13, %2
%16 = call i32 @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @sscanf(i32 %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%18 = icmp eq i32 %17, 1
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
%22 = icmp slt i32 %19, 9
%23 = select i1 %21, i1 %22, i1 false
br i1 %23, label %24, label %26
24: ; preds = %15
%25 = call i32 @prepare_upload_audio(i32 %19)
br label %28
26: ; preds = %15
%27 = call i32 (...) @generate_all_tracks_page()
br label %28
28: ; preds = %26, %24
ret i32 0
}