// File: /workspace/github_c_makefile_star2_O2/xapi-project[P]rrd-client-lib/rrdclient.c
// Function: main
int
main(int argc, char **argv)
{
    char            line[256];
    struct sigaction sigact;
    plugin = NULL;

    if (argc != 2) {
        fprintf(stderr, "usage: %s file.rrd\n", basename(argv[0]));
        exit(1);
    }

    sigact.sa_handler = cleanup;
    sigemptyset(&sigact.sa_mask);
    sigact.sa_flags = 0;
    sigaction(SIGINT, &sigact, (struct sigaction *) NULL);

    plugin = rrd_open(argv[0], RRD_LOCAL_DOMAIN, argv[1]);
    if (!plugin) {
        fprintf(stderr, "can't open %s\n", argv[1]);
        exit(1);
    }
    rrd_add_src(plugin, &src);

    src.name = "stdin";
    src.description = "integers read from stdin";
    src.owner = RRD_VM;
    src.owner_uuid = "931388d6-559e-11e6-ab0a-73658ca1c515";
    src.rrd_units = "numbers";
    src.type = RRD_INT64;
    src.scale = RRD_ABSOLUTE;
    src.min = "-inf";
    src.max = "inf";
    src.rrd_default = 0;
    src.sample = sample;
    src.userdata = NULL;

    int             rc;
    while (fgets(line, sizeof(line), stdin) != NULL) {
        v.int64 = (int64_t) atol(line);
        rc = rrd_sample(plugin, NULL);
        assert(rc == RRD_OK);
    }

    rrd_del_src(plugin, &src);
    rrd_close(plugin);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %rbx
andq $0x0, 0x7daf(%rip)      # 0x9190
cmpl $0x2, %edi
jne 0x154c
leaq 0x1a0(%rip), %rax       # 0x1591
leaq 0x10(%rsp), %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
callq 0x11f0
andl $0x0, 0x80(%r14)
pushq $0x2
popq %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x10a0
movq (%rbx), %rdi
movq 0x8(%rbx), %rdx
xorl %esi, %esi
callq 0x1619
movq %rax, 0x7d62(%rip)      # 0x9190
testq %rax, %rax
je 0x156d
leaq 0x7d5a(%rip), %rsi      # 0x9198
movq %rax, %rdi
callq 0x1c4d
leaq 0x3c09(%rip), %rax      # 0x5056
movq %rax, 0x7d44(%rip)      # 0x9198
leaq 0x3be8(%rip), %rax      # 0x5043
movq %rax, 0x7d3e(%rip)      # 0x91a0
leaq 0x3bf3(%rip), %rax      # 0x505c
movq %rax, 0x7d38(%rip)      # 0x91a8
leaq 0x3c0a(%rip), %rax      # 0x5081
movq %rax, 0x7d32(%rip)      # 0x91b0
leaq 0x3c04(%rip), %rax      # 0x5089
movq %rax, 0x7d2c(%rip)      # 0x91b8
leaq 0x3bf7(%rip), %rax      # 0x508a
movq %rax, 0x7d26(%rip)      # 0x91c0
movaps 0x3b6f(%rip), %xmm0     # 0x5010
movups %xmm0, 0x7d30(%rip)     # 0x91d8
leaq 0x116(%rip), %rax       # 0x15c5
movq %rax, 0x7d12(%rip)      # 0x91c8
andq $0x0, 0x7d12(%rip)      # 0x91d0
movq 0x7b13(%rip), %r14      # 0x8fd8
leaq 0xa0(%rsp), %rbx
movq (%r14), %rdx
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x11b0
testq %rax, %rax
je 0x1520
movq %rbx, %rdi
callq 0x1260
movq %rax, 0x7cf7(%rip)      # 0x91e8
movq 0x7c98(%rip), %rdi      # 0x9190
xorl %esi, %esi
callq 0x1d11
testl %eax, %eax
je 0x14cd
leaq 0x3b84(%rip), %rdi      # 0x508e
leaq 0x3b8a(%rip), %rsi      # 0x509b
leaq 0x3b8f(%rip), %rcx      # 0x50a7
pushq $0x61
popq %rdx
callq 0x1180
movq 0x7c69(%rip), %rdi      # 0x9190
leaq 0x7c6a(%rip), %rsi      # 0x9198
callq 0x1cc1
movq 0x7c56(%rip), %rdi      # 0x9190
callq 0x1be3
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
retq
movq 0x7aa5(%rip), %rax      # 0x8ff8
movq (%rax), %r14
movq (%rbx), %rdi
callq 0x1220
leaq 0x3abb(%rip), %rsi      # 0x5020
movq %r14, %rdi
movq %rax, %rdx
jmp 0x1582
movq 0x7a84(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq 0x8(%rbx), %rdx
leaq 0x3ab2(%rip), %rsi      # 0x5034
xorl %eax, %eax
callq 0x11e0
pushq $0x1
popq %rdi
callq 0x12a0