// File: /workspace/github_c_makefile_star2_O0/xapi-project[P]rrd-client-lib/librrd.c
// Function: json_for_source
static JSON_Value *
json_for_source(RRD_SOURCE * source)
{
    assert(source);

    JSON_Value     *json = json_value_init_object();
    JSON_Object    *src = json_value_get_object(json);

    json_object_set_string(src, "description", source->description);
    json_object_set_string(src, "units", source->rrd_units);
    json_object_set_string(src, "min", source->min);
    json_object_set_string(src, "max", source->max);
    json_object_set_string(src, "default",
                           source->rrd_default ? "true" : "false");

    char           owner[128] = {0};

    switch (source->owner) {
    case RRD_HOST:
        snprintf(owner, sizeof owner, "host");
        break;
    case RRD_VM:
        snprintf(owner, sizeof owner, "vm %s", source->owner_uuid);
        break;
    case RRD_SR:
        snprintf(owner, sizeof owner, "sr %s", source->owner_uuid);
        break;
    default:
        abort();
    }
    json_object_set_string(src, "owner", owner);

    char           *value_type = NULL;
    switch (source->type) {
    case RRD_INT64:
        value_type = "int64";
        break;
    case RRD_FLOAT64:
        value_type = "float";
        break;
    default:
        abort();
    }
    json_object_set_string(src, "value_type", value_type);

#define RRD_TRANSPORT_1_1_0
#ifdef RRD_TRANSPORT_1_1_0
#define GAUGE "gauge"
#define ABSOLUTE "absolute"
#define DERIVE "derive"
#else
#define GAUGE "absolute"
#define ABSOLUTE "rate"
#define DERIVE "absolute_to_rate"
#endif

    char           *scale = NULL;
    switch (source->scale) {
    case RRD_GAUGE:
        scale = GAUGE;
        break;
    case RRD_ABSOLUTE:
        scale = ABSOLUTE;
        break;
    case RRD_DERIVE:
        scale = DERIVE;
        break;
    default:
        abort();
    }
    json_object_set_string(src, "type", scale);

    return json;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2358
jmp 0x2377
leaq 0x6e16(%rip), %rdi      # 0x9175
leaq 0x6d7f(%rip), %rsi      # 0x90e5
movl $0x7d, %edx
leaq 0x6f42(%rip), %rcx      # 0x92b4
callq 0x1170
callq 0x3640
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2e10
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x6f3e(%rip), %rsi      # 0x92de
callq 0x5620
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x6f32(%rip), %rsi      # 0x92ea
callq 0x5620
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x6f20(%rip), %rsi      # 0x92f0
callq 0x5620
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0x6f0c(%rip), %rsi      # 0x92f4
callq 0x5620
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x44(%rax), %eax
testl %eax, %eax
leaq 0x6eff(%rip), %rax      # 0x9300
leaq 0x6efd(%rip), %rdx      # 0x9305
cmovneq %rax, %rdx
leaq 0x6ee5(%rip), %rsi      # 0x92f8
callq 0x5620
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0xb4(%rbp)
testl %eax, %eax
je 0x2475
jmp 0x245b
movl -0xb4(%rbp), %eax
subl $0x1, %eax
je 0x2491
jmp 0x2468
movl -0xb4(%rbp), %eax
subl $0x2, %eax
je 0x24b5
jmp 0x24d9
leaq -0xa0(%rbp), %rdi
movl $0x80, %esi
leaq 0x6e83(%rip), %rdx      # 0x930b
movb $0x0, %al
callq 0x1140
jmp 0x24de
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x80, %esi
leaq 0x6e64(%rip), %rdx      # 0x9310
movb $0x0, %al
callq 0x1140
jmp 0x24de
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x80, %esi
leaq 0x6e46(%rip), %rdx      # 0x9316
movb $0x0, %al
callq 0x1140
jmp 0x24de
callq 0x1040
movq -0x18(%rbp), %rdi
leaq 0x6e33(%rip), %rsi      # 0x931c
leaq -0xa0(%rbp), %rdx
callq 0x5620
movq $0x0, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0xd4(%rbp)
testl %eax, %eax
je 0x2530
jmp 0x2513
movl -0xd4(%rbp), %eax
subl $0x1, %eax
jne 0x2540
jmp 0x2520
leaq 0x6dfb(%rip), %rax      # 0x9322
movq %rax, -0xa8(%rbp)
jmp 0x2545
leaq 0x6df1(%rip), %rax      # 0x9328
movq %rax, -0xa8(%rbp)
jmp 0x2545
callq 0x1040
movq -0x18(%rbp), %rdi
movq -0xa8(%rbp), %rdx
leaq 0x6dd7(%rip), %rsi      # 0x932e
callq 0x5620
movq $0x0, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
movl %eax, -0xd8(%rbp)
testl %eax, %eax
je 0x2594
jmp 0x257a
movl -0xd8(%rbp), %eax
subl $0x1, %eax
je 0x25a4
jmp 0x2587
movl -0xd8(%rbp), %eax
subl $0x2, %eax
je 0x25b4
jmp 0x25c4
leaq 0x6d9e(%rip), %rax      # 0x9339
movq %rax, -0xb0(%rbp)
jmp 0x25c9
leaq 0x6d94(%rip), %rax      # 0x933f
movq %rax, -0xb0(%rbp)
jmp 0x25c9
leaq 0x6d8d(%rip), %rax      # 0x9348
movq %rax, -0xb0(%rbp)
jmp 0x25c9
callq 0x1040
movq -0x18(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0x6d59(%rip), %rsi      # 0x9334
callq 0x5620
movq -0x10(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)