#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ mpgedit_edit_index(void *);
int /*<<< orphan*/ mpgedit_edit_index_free(void *);
void *mpgedit_edit_index_init(char *);
int /*<<< orphan*/ mpgedit_play_close(void *);
int /*<<< orphan*/ mpgedit_play_current_msec(void *);
long mpgedit_play_current_sec(void *);
scalar_t__ mpgedit_play_frame(void *);
void *mpgedit_play_init(char *, int /*<<< orphan*/);
int /*<<< orphan*/ mpgedit_play_total_msec(void *);
long mpgedit_play_total_sec(void *);
int mpgedit_play_total_size(void *);
int /*<<< orphan*/ mpgedit_play_volume_init(void *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  void *ctx;
  long cur_sec = 0, past_sec = 0;
  if (argc == 1) {
    fprintf(stderr, "usage: %s mp3_file\n", argv[0]);
    return 1;
  }
  ctx = mpgedit_edit_index_init(argv[1]);
  while (!mpgedit_edit_index(ctx))
    ;
  mpgedit_edit_index_free(ctx);
  ctx = mpgedit_play_init(argv[1], 0);
  if (!ctx) {
    return 1;
  }
  mpgedit_play_volume_init(ctx, -1, -1);
  if (mpgedit_play_total_size(ctx) != -1) {
    printf("total file size: %ld | ", mpgedit_play_total_size(ctx));
  }
  if (mpgedit_play_total_sec(ctx) != -1) {
    printf("total play time: %ld.%03lds", mpgedit_play_total_sec(ctx),
           mpgedit_play_total_msec(ctx));
  }
  printf("\n");
  while (mpgedit_play_frame(ctx)) {
    cur_sec = mpgedit_play_current_sec(ctx);
    if (cur_sec != past_sec) {
      past_sec = cur_sec;
      printf("%ld.%03lds\n", cur_sec, mpgedit_play_current_msec(ctx));
    }
  }
  printf("%ld.%03lds\n", mpgedit_play_current_sec(ctx),
         mpgedit_play_current_msec(ctx));
  mpgedit_play_close(ctx);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1238 <main+0x58>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd9(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13bf <main+0x1df>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <mpgedit_edit_index_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <mpgedit_edit_index@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1267 <main+0x87>
jmp    126c <main+0x8c>
jmp    1249 <main+0x69>
mov    -0x18(%rbp),%rdi
call   10b0 <mpgedit_edit_index_free@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
call   1030 <mpgedit_play_init@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    129f <main+0xbf>
movl   $0x1,-0x4(%rbp)
jmp    13bf <main+0x1df>
mov    -0x18(%rbp),%rdi
mov    $0xffffffff,%edx
mov    %edx,%esi
call   1040 <mpgedit_play_volume_init@plt>
mov    -0x18(%rbp),%rdi
call   1050 <mpgedit_play_total_size@plt>
cmp    $0xffffffff,%eax
je     12da <main+0xfa>
mov    -0x18(%rbp),%rdi
call   1050 <mpgedit_play_total_size@plt>
mov    %eax,%esi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <mpgedit_play_total_sec@plt>
cmp    $0xffffffffffffffff,%rax
je     1317 <main+0x137>
mov    -0x18(%rbp),%rdi
call   10d0 <mpgedit_play_total_sec@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <mpgedit_play_total_msec@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1090 <mpgedit_play_frame@plt>
cmp    $0x0,%rax
je     1385 <main+0x1a5>
mov    -0x18(%rbp),%rdi
call   10f0 <mpgedit_play_current_sec@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1380 <main+0x1a0>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <mpgedit_play_current_msec@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1325 <main+0x145>
mov    -0x18(%rbp),%rdi
call   10f0 <mpgedit_play_current_sec@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <mpgedit_play_current_msec@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <mpgedit_play_close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jne    121c <main+0x2c>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdee(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1329 <main+0x139>
mov    0x8(%rbx),%rdi
call   1110 <mpgedit_edit_index_init@plt>
mov    %rax,%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1070 <mpgedit_edit_index@plt>
test   %eax,%eax
je     1230 <main+0x40>
mov    %rbp,%rdi
call   10c0 <mpgedit_edit_index_free@plt>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
call   1040 <mpgedit_play_init@plt>
test   %rax,%rax
je     1329 <main+0x139>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
call   1050 <mpgedit_play_volume_init@plt>
mov    %r15,%rdi
call   1060 <mpgedit_play_total_size@plt>
cmp    $0xffffffff,%eax
je     1292 <main+0xa2>
mov    %r15,%rdi
call   1060 <mpgedit_play_total_size@plt>
lea    0xd8b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
call   10e0 <mpgedit_play_total_sec@plt>
cmp    $0xffffffffffffffff,%rax
je     12c6 <main+0xd6>
mov    %r15,%rdi
call   10e0 <mpgedit_play_total_sec@plt>
mov    %rax,%rbp
mov    %r15,%rdi
call   1090 <mpgedit_play_total_msec@plt>
lea    0xd72(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   10a0 <mpgedit_play_frame@plt>
test   %rax,%rax
je     1330 <main+0x140>
lea    0xd64(%rip),%r14
xor    %ebx,%ebx
jmp    12fd <main+0x10d>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   10a0 <mpgedit_play_frame@plt>
test   %rax,%rax
je     1330 <main+0x140>
mov    %r15,%rdi
call   1100 <mpgedit_play_current_sec@plt>
cmp    %rbx,%rax
je     12f0 <main+0x100>
mov    %rax,%rbp
mov    %r15,%rdi
call   10f0 <mpgedit_play_current_msec@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,%rbx
jmp    12f0 <main+0x100>
mov    $0x1,%ebp
jmp    1360 <main+0x170>
mov    %r15,%rdi
call   1100 <mpgedit_play_current_sec@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   10f0 <mpgedit_play_current_msec@plt>
lea    0xcfe(%rip),%rdi
xor    %ebp,%ebp
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
call   10d0 <mpgedit_play_close@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"usage: %s mp3_file\0A\00"
@.str.1 = [24 x i8] c"total file size: %ld | \00"
@.str.2 = [28 x i8] c"total play time: %ld.%03lds\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [12 x i8] c"%ld.%03lds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
store i64 0, i64* %8
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %85
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i8* @mpgedit_edit_index_init(i8* %20)
store i8* %21, i8** %6
br label %22
22: ; preds = %27, %17
%23 = load i8*, i8** %6
%24 = call i32 @mpgedit_edit_index(i8* %23)
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
br i1 %26, label %27, label %28
27: ; preds = %22
br label %22
28: ; preds = %22
%29 = load i8*, i8** %6
%30 = call i32 @mpgedit_edit_index_free(i8* %29)
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i8* @mpgedit_play_init(i8* %33, i32 0)
store i8* %34, i8** %6
%35 = load i8*, i8** %6
%36 = icmp ne i8* %35, null
br i1 %36, label %38, label %37
37: ; preds = %28
store i32 1, i32* %3
br label %85
38: ; preds = %28
%39 = load i8*, i8** %6
%40 = call i32 @mpgedit_play_volume_init(i8* %39, i32 -1, i32 -1)
%41 = load i8*, i8** %6
%42 = call i32 @mpgedit_play_total_size(i8* %41)
%43 = icmp ne i32 %42, -1
br i1 %43, label %44, label %48
44: ; preds = %38
%45 = load i8*, i8** %6
%46 = call i32 @mpgedit_play_total_size(i8* %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %44, %38
%49 = load i8*, i8** %6
%50 = call i64 @mpgedit_play_total_sec(i8* %49)
%51 = icmp ne i64 %50, -1
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = load i8*, i8** %6
%54 = call i64 @mpgedit_play_total_sec(i8* %53)
%55 = load i8*, i8** %6
%56 = call i32 @mpgedit_play_total_msec(i8* %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %54, i32 %56)
br label %58
58: ; preds = %52, %48
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %76, %58
%61 = load i8*, i8** %6
%62 = call i64 @mpgedit_play_frame(i8* %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %77
64: ; preds = %60
%65 = load i8*, i8** %6
%66 = call i64 @mpgedit_play_current_sec(i8* %65)
store i64 %66, i64* %7
%67 = load i64, i64* %7
%68 = load i64, i64* %8
%69 = icmp ne i64 %67, %68
br i1 %69, label %70, label %76
70: ; preds = %64
%71 = load i64, i64* %7
store i64 %71, i64* %8
%72 = load i64, i64* %7
%73 = load i8*, i8** %6
%74 = call i32 @mpgedit_play_current_msec(i8* %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %72, i32 %74)
br label %76
76: ; preds = %70, %64
br label %60
77: ; preds = %60
%78 = load i8*, i8** %6
%79 = call i64 @mpgedit_play_current_sec(i8* %78)
%80 = load i8*, i8** %6
%81 = call i32 @mpgedit_play_current_msec(i8* %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %79, i32 %81)
%83 = load i8*, i8** %6
%84 = call i32 @mpgedit_play_close(i8* %83)
store i32 0, i32* %3
br label %85
85: ; preds = %77, %37, %11
%86 = load i32, i32* %3
ret i32 %86
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"usage: %s mp3_file\0A\00"
@.str.1 = [24 x i8] c"total file size: %ld | \00"
@.str.2 = [28 x i8] c"total play time: %ld.%03lds\00"
@.str.4 = [12 x i8] c"%ld.%03lds\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %54
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i8* @mpgedit_edit_index_init(i8* %10)
br label %12
12: ; preds = %12, %8
%13 = tail call i32 @mpgedit_edit_index(i8* %11)
%14 = icmp eq i32 %13, 0
br i1 %14, label %12, label %15
15: ; preds = %12
%16 = tail call i32 @mpgedit_edit_index_free(i8* %11)
%17 = load i8*, i8** %9
%18 = tail call i8* @mpgedit_play_init(i8* %17, i32 0)
%19 = icmp eq i8* %18, null
br i1 %19, label %54, label %20
20: ; preds = %15
%21 = tail call i32 @mpgedit_play_volume_init(i8* %18, i32 -1, i32 -1)
%22 = tail call i32 @mpgedit_play_total_size(i8* %18)
%23 = icmp eq i32 %22, -1
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = tail call i32 @mpgedit_play_total_size(i8* %18)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24, %20
%28 = tail call i64 @mpgedit_play_total_sec(i8* %18)
%29 = icmp eq i64 %28, -1
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = tail call i64 @mpgedit_play_total_sec(i8* %18)
%32 = tail call i32 @mpgedit_play_total_msec(i8* %18)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %31, i32 %32)
br label %34
34: ; preds = %30, %27
%35 = tail call i32 @putchar(i32 10)
%36 = tail call i64 @mpgedit_play_frame(i8* %18)
%37 = icmp eq i64 %36, 0
br i1 %37, label %49, label %38
38: ; preds = %34, %45
%39 = phi i64 [ %46, %45 ], [ 0, %34 ]
%40 = tail call i64 @mpgedit_play_current_sec(i8* %18)
%41 = icmp eq i64 %40, %39
br i1 %41, label %45, label %42
42: ; preds = %38
%43 = tail call i32 @mpgedit_play_current_msec(i8* %18)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %40, i32 %43)
br label %45
45: ; preds = %42, %38
%46 = phi i64 [ %40, %42 ], [ %39, %38 ]
%47 = tail call i64 @mpgedit_play_frame(i8* %18)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %38
49: ; preds = %45, %34
%50 = tail call i64 @mpgedit_play_current_sec(i8* %18)
%51 = tail call i32 @mpgedit_play_current_msec(i8* %18)
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %50, i32 %51)
%53 = tail call i32 @mpgedit_play_close(i8* %18)
br label %54
54: ; preds = %15, %49, %4
%55 = phi i32 [ 1, %4 ], [ 0, %49 ], [ 1, %15 ]
ret i32 %55
}