#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*/ print_channel(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
int track_get_frame();
int track_is_new_data_available();
int /*<<< orphan*/ track_update();
int main(int argc, char **argv) {
  while (1) {
    int channel;
    printf("is_new_data_available()=%d\n", track_is_new_data_available());
    track_update();
    printf("frame=%d\n", track_get_frame());
    for (channel = 0; channel < 4; channel++) {
      int max_blobs = 3;
      print_channel(channel, max_blobs);
    }
    sleep(1);
  }
}


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)
mov    $0x0,%al
call   1070 <track_is_new_data_available@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <track_update@plt>
mov    $0x0,%al
call   1030 <track_get_frame@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    11d8 <main+0x78>
movl   $0x3,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <print_channel@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <main+0x4e>
mov    $0x1,%edi
call   1080 <sleep@plt>
jmp    1176 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%r14
lea    0xeaa(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <track_is_new_data_available@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <track_update@plt>
xor    %eax,%eax
call   1030 <track_get_frame@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1060 <print_channel@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1060 <print_channel@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1060 <print_channel@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1060 <print_channel@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
jmp    1180 <main+0x20>

LLVM IR (-O0):
@.str = [28 x i8] c"is_new_data_available()=%d\0A\00"
@.str.1 = [10 x i8] c"frame=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %2, %24
%9 = call i32 (...) @track_is_new_data_available()
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @track_update()
%12 = call i32 (...) @track_get_frame()
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 0, i32* %6
br label %14
14: ; preds = %21, %8
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %24
17: ; preds = %14
store i32 3, i32* %7
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @print_channel(i32 %18, i32 %19)
br label %21
21: ; preds = %17
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %14
24: ; preds = %14
%25 = call i32 @sleep(i32 1)
br label %8
}

LLVM IR (-O2):
@.str = [28 x i8] c"is_new_data_available()=%d\0A\00"
@.str.1 = [10 x i8] c"frame=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = tail call i32 (...) @track_is_new_data_available()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (...) @track_update()
%7 = tail call i32 (...) @track_get_frame()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @print_channel(i32 0, i32 3)
%10 = tail call i32 @print_channel(i32 1, i32 3)
%11 = tail call i32 @print_channel(i32 2, i32 3)
%12 = tail call i32 @print_channel(i32 3, i32 3)
%13 = tail call i32 @sleep(i32 1)
br label %3
}