#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*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ send(int, char *, int, int /*<<< orphan*/);
int sprintf(char *, char *, long long);
scalar_t__ time(int /*<<< orphan*/ *);
void server_job(int sd) {
  char buf[1024];
  int len;
  len = sprintf(buf, "%lld", (long long)time(NULL));
  if (send(sd, buf, len, 0) < 0) {
    perror("send()");
    exit(1);
  }
  return;
}


x86 assembly (clang, -O0):
<server_job>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x420(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    -0x420(%rbp),%rdi
mov    %rax,%rdx
lea    0xe7a(%rip),%rsi
call   1060 <sprintf@plt>
mov    %eax,-0x414(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    -0x414(%rbp),%edx
xor    %ecx,%ecx
call   1030 <send@plt>
cmp    $0x0,%rax
jge    11c8 <server_job+0x78>
lea    0xe4c(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_job>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <time@plt>
lea    0xe96(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rax,%rdx
call   1060 <sprintf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
test   %rax,%rax
js     1196 <server_job+0x46>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe68(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [7 x i8] c"send()\00"
define void @server_job(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i64 @time(i32* null)
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i64 @send(i32 %8, i8* %9, i32 %10, i32 0)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [7 x i8] c"send()\00"
define void @server_job(i32 %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @time(i32* null)
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = call i64 @send(i32 %0, i8* %3, i32 %5, i32 0)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
ret void
}