#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 */
typedef int uint32_t;
typedef scalar_t__ time_t;
typedef int /*<<< orphan*/ out_msg;

/* Variables and functions */
scalar_t__ _xmit(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, ...);
scalar_t__ time(int /*<<< orphan*/ *);
void _get_jobs(void) {
  time_t now = time(NULL);
  char out_msg[128];
  snprintf(out_msg, sizeof(out_msg), "TS=%u AUTH=root DT=%s", (uint32_t)now,
           "CMD=GETJOBS ARG=0:ALL");
  if (_xmit(out_msg))
    exit(1);
  snprintf(out_msg, sizeof(out_msg),
           "TS=%u AUTH=root DT=CMD=GETJOBS ARG=%u:ALL", (uint32_t)now,
           (uint32_t)1);
  if (_xmit(out_msg))
    exit(1);
  snprintf(out_msg, sizeof(out_msg),
           "TS=%u AUTH=root DT=CMD=GETJOBS ARG=%u:ALL", (uint32_t)now,
           (uint32_t)(now + 2));
  if (_xmit(out_msg))
    exit(1);
}


x86 assembly (clang, -O0):
<_get_jobs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    $0x80,%esi
lea    0xe8f(%rip),%rdx
lea    0xe9e(%rip),%r8
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <_xmit@plt>
cmp    $0x0,%rax
je     119f <_get_jobs+0x5f>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    $0x80,%esi
lea    0xe74(%rip),%rdx
mov    $0x1,%r8d
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <_xmit@plt>
cmp    $0x0,%rax
je     11e5 <_get_jobs+0xa5>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %eax,%r8d
mov    $0x80,%esi
lea    0xe23(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <_xmit@plt>
cmp    $0x0,%rax
je     1230 <_get_jobs+0xf0>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_jobs>:
push   %r14
push   %rbx
sub    $0x88,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%rbx
lea    0xea5(%rip),%rdx
lea    0xeb4(%rip),%r8
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1040 <_xmit@plt>
test   %rax,%rax
jne    11e8 <_get_jobs+0xa8>
lea    0xea2(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
mov    %ebx,%ecx
mov    $0x1,%r8d
xor    %eax,%eax
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1040 <_xmit@plt>
test   %rax,%rax
jne    11e8 <_get_jobs+0xa8>
lea    0x2(%rbx),%r8d
lea    0xe70(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1040 <_xmit@plt>
test   %rax,%rax
jne    11e8 <_get_jobs+0xa8>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"TS=%u AUTH=root DT=%s\00"
@.str.1 = [22 x i8] c"CMD=GETJOBS ARG=0:ALL\00"
@.str.2 = [42 x i8] c"TS=%u AUTH=root DT=CMD=GETJOBS ARG=%u:ALL\00"
define void @_get_jobs() {
%1 = alloca i64
%2 = alloca [128 x i8]
%3 = call i64 @time(i32* null)
store i64 %3, i64* %1
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = load i64, i64* %1
%6 = trunc i64 %5 to i32
%7 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%9 = call i64 @_xmit(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%15 = load i64, i64* %1
%16 = trunc i64 %15 to i32
%17 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %14, i32 128, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 1)
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%19 = call i64 @_xmit(i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %13
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%25 = load i64, i64* %1
%26 = trunc i64 %25 to i32
%27 = load i64, i64* %1
%28 = add nsw i64 %27, 2
%29 = trunc i64 %28 to i32
%30 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %24, i32 128, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %29)
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%32 = call i64 @_xmit(i8* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %23
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"TS=%u AUTH=root DT=%s\00"
@.str.1 = [22 x i8] c"CMD=GETJOBS ARG=0:ALL\00"
@.str.2 = [42 x i8] c"TS=%u AUTH=root DT=CMD=GETJOBS ARG=%u:ALL\00"
define void @_get_jobs() {
%1 = alloca [128 x i8]
%2 = tail call i64 @time(i32* null)
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = trunc i64 %2 to i32
%5 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i64 @_xmit(i8* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 1)
%12 = call i64 @_xmit(i8* %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %10
%17 = add i32 %4, 2
%18 = call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %3, i32 128, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %17)
%19 = call i64 @_xmit(i8* %3)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %16
ret void
}