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


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)
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    0xec8(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xeb0(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <sscanf@plt>
lea    -0x1c(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <cdparanoia_read_stat@plt>
cmp    $0x0,%rax
jne    11f8 <main+0x98>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1060 <print_msg@plt>
movsd  0xe00(%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    11e5 <main+0x85>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xefc(%rip),%r14
lea    0xc(%rsp),%rdx
mov    %r14,%rsi
call   1050 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0x8(%rsp),%rdx
mov    %r14,%rsi
call   1050 <sscanf@plt>
lea    0x4(%rsp),%r14
lea    0x10(%rsp),%rbx
jmp    11bd <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0xe48(%rip),%xmm0
call   1080 <usleep@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <cdparanoia_read_stat@plt>
test   %rax,%rax
jne    11b0 <main+0x50>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    0x10(%rsp),%rcx
call   1060 <print_msg@plt>
jmp    11b0 <main+0x50>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [110 x i8] c"This is ripperX plugin for cdparanoia. Syntax is\0AripperX_plugin-cdparanoia 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
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%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* %6)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
br label %25
25: ; preds = %16, %34
%26 = call i64 @cdparanoia_read_stat(i32* %8, i8** %9)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = load i8*, i8** %9
%33 = call i32 @print_msg(i32 %29, i32 %30, i32 %31, i8* %32)
br label %34
34: ; preds = %28, %25
%35 = call i32 @usleep(double 5.000000e+05)
br label %25
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [110 x i8] c"This is ripperX plugin for cdparanoia. Syntax is\0AripperX_plugin-cdparanoia 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 = alloca i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i8** %6 to i8*
%11 = icmp eq i32 %0, 3
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, 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* %3)
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %23
23: ; preds = %32, %16
%24 = call i64 @cdparanoia_read_stat(i32* %5, i8** %6)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = load i8*, i8** %6
%31 = call i32 @print_msg(i32 %27, i32 %28, i32 %29, i8* %30)
br label %32
32: ; preds = %26, %23
%33 = call i32 @usleep(double 5.000000e+05)
br label %23
}