#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 */
scalar_t__ a8hz_mp3_read_stat(int *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_msg(int, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(double);
int main(int argc, char **argv) {
  int begin, length;
  int current;
  if (argc != 3) {
    fprintf(stderr,
            "This is ripperX plugin for 8hz-mp3. Syntax is\n"
            "ripperX_plugin-8hz-mp3 beginning_sector length_in_sector\n");
    exit(1);
  }
  sscanf(argv[1], "%d", &begin);
  sscanf(argv[2], "%d", &length);
  while (1) {
    if (a8hz_mp3_read_stat(&current) == 0)
      print_msg(length, current);
    usleep(0.5 * 1000000);
  }
}


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)
cmpl   $0x3,-0x8(%rbp)
je     119f <main+0x3f>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xec2(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xeaa(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
lea    -0x1c(%rbp),%rdi
call   1060 <a8hz_mp3_read_stat@plt>
cmp    $0x0,%rax
jne    11ed <main+0x8d>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <print_msg@plt>
movsd  0xe0b(%rip),%xmm0
call   1080 <usleep@plt>
jmp    11cf <main+0x6f>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
cmp    $0x3,%edi
jne    11c9 <main+0x69>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xef6(%rip),%r14
lea    0x14(%rsp),%rdx
mov    %r14,%rsi
call   1040 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0x10(%rsp),%rdx
mov    %r14,%rsi
call   1040 <sscanf@plt>
lea    0xc(%rsp),%rbx
jmp    11ad <main+0x4d>
nop
movsd  0xe58(%rip),%xmm0
call   1080 <usleep@plt>
mov    %rbx,%rdi
call   1060 <a8hz_mp3_read_stat@plt>
test   %rax,%rax
jne    11a0 <main+0x40>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <print_msg@plt>
jmp    11a0 <main+0x40>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [104 x i8] c"This is ripperX plugin for 8hz-mp3. Syntax is\0AripperX_plugin-8hz-mp3 beginning_sector length_in_sector\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
br label %24
24: ; preds = %15, %31
%25 = call i64 @a8hz_mp3_read_stat(i32* %8)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = call i32 @print_msg(i32 %28, i32 %29)
br label %31
31: ; preds = %27, %24
%32 = call i32 @usleep(double 5.000000e+05)
br label %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [104 x i8] c"This is ripperX plugin for 8hz-mp3. Syntax is\0AripperX_plugin-8hz-mp3 beginning_sector length_in_sector\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = icmp eq i32 %0, 3
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %21
21: ; preds = %28, %14
%22 = call i64 @a8hz_mp3_read_stat(i32* %5)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @print_msg(i32 %25, i32 %26)
br label %28
28: ; preds = %24, %21
%29 = call i32 @usleep(double 5.000000e+05)
br label %21
}