#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 scalar_t__ ssize_t;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
void *bytes_to_int32(unsigned char *);
long long bytes_to_int64(unsigned char *);
int /*<<< orphan*/ bzero(unsigned char *, int);
int /*<<< orphan*/ printf(char *, int, int, int, long long, unsigned int, int);
scalar_t__ read(int, unsigned char *, int);
void process_conn_server(int s) {
  ssize_t size = 0;
  unsigned char buffer[50];
  int hour, min, sec;
  long long ts_sec;
  unsigned int ts_nsec;
  int count = 0;
  for (;;) {
    bzero(buffer, sizeof(buffer));
    size = read(s, buffer, 60);
    if (size == 0) {
      return;
    }
    hour = bytes_to_int32(buffer);
    min = bytes_to_int32(&buffer[4]);
    sec = bytes_to_int32(&buffer[8]);
    ts_sec = bytes_to_int64(&buffer[12]);
    ts_nsec = bytes_to_int32(&buffer[20]);
    printf("%02d:%02d:%02d offset is %lld(s).%09u(ns), (%d)\n", hour, min, sec,
           ts_sec, ts_nsec, ++count);
  }
}


x86 assembly (clang, -O0):
<process_conn_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x70(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x32,%esi
call   1070 <bzero@plt>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x3c,%edx
call   1060 <read@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a4 <process_conn_server+0x54>
add    $0x80,%rsp
pop    %rbp
ret
lea    -0x50(%rbp),%rdi
call   1040 <bytes_to_int32@plt>
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x4,%rdi
call   1040 <bytes_to_int32@plt>
mov    %eax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x8,%rdi
call   1040 <bytes_to_int32@plt>
mov    %eax,-0x5c(%rbp)
lea    -0x50(%rbp),%rdi
add    $0xc,%rdi
call   1030 <bytes_to_int64@plt>
mov    %rax,-0x68(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x14,%rdi
call   1040 <bytes_to_int32@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x5c(%rbp),%ecx
mov    -0x68(%rbp),%r8
mov    -0x6c(%rbp),%r9d
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
lea    0xdee(%rip),%rdi
mov    %eax,(%rsp)
call   1050 <printf@plt>
jmp    116d <process_conn_server+0x1d>

x86 assembly (clang, -O2):
<process_conn_server>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edi,%ebp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1070 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3c,%edx
call   1060 <read@plt>
test   %rax,%rax
je     1219 <process_conn_server+0xc9>
mov    $0x1,%ebx
nop
lea    0x10(%rsp),%rdi
call   1040 <bytes_to_int32@plt>
mov    %rax,%r15
lea    0x14(%rsp),%rdi
call   1040 <bytes_to_int32@plt>
mov    %rax,%r12
lea    0x18(%rsp),%rdi
call   1040 <bytes_to_int32@plt>
mov    %rax,%r13
lea    0x1c(%rsp),%rdi
call   1030 <bytes_to_int64@plt>
mov    %rax,%r14
lea    0x24(%rsp),%rdi
call   1040 <bytes_to_int32@plt>
mov    %ebx,(%rsp)
lea    0xe28(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %r14,%r8
mov    %eax,%r9d
call   1050 <printf@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x32,%esi
call   1070 <bzero@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x3c,%edx
call   1060 <read@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1190 <process_conn_server+0x40>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"%02d:%02d:%02d offset is %lld(s).%09u(ns), (%d)\0A\00"
define void @process_conn_server(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca [50 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %2
store i64 0, i64* %3
store i32 0, i32* %10
br label %11
11: ; preds = %20, %1
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%13 = call i32 @bzero(i8* %12, i32 50)
%14 = load i32, i32* %2
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%16 = call i64 @read(i32 %14, i8* %15, i32 60)
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %11
ret void
20: ; preds = %11
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%22 = call i8* @bytes_to_int32(i8* %21)
%23 = ptrtoint i8* %22 to i32
store i32 %23, i32* %5
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 4
%25 = call i8* @bytes_to_int32(i8* %24)
%26 = ptrtoint i8* %25 to i32
store i32 %26, i32* %6
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 8
%28 = call i8* @bytes_to_int32(i8* %27)
%29 = ptrtoint i8* %28 to i32
store i32 %29, i32* %7
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 12
%31 = call i64 @bytes_to_int64(i8* %30)
store i64 %31, i64* %8
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 20
%33 = call i8* @bytes_to_int32(i8* %32)
%34 = ptrtoint i8* %33 to i32
store i32 %34, i32* %9
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = load i64, i64* %8
%39 = load i32, i32* %9
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
%42 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36, i32 %37, i64 %38, i32 %39, i32 %41)
br label %11
}

LLVM IR (-O2):
@.str = [49 x i8] c"%02d:%02d:%02d offset is %lld(s).%09u(ns), (%d)\0A\00"
define void @process_conn_server(i32 %0) {
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = call i32 @bzero(i8* %3, i32 50)
%5 = call i64 @read(i32 %0, i8* %3, i32 60)
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 4
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 8
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 12
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 20
br label %13
12: ; preds = %13, %1
ret void
13: ; preds = %7, %13
%14 = phi i32 [ 0, %7 ], [ %28, %13 ]
%15 = call i8* @bytes_to_int32(i8* %3)
%16 = ptrtoint i8* %15 to i64
%17 = trunc i64 %16 to i32
%18 = call i8* @bytes_to_int32(i8* %8)
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = call i8* @bytes_to_int32(i8* %9)
%22 = ptrtoint i8* %21 to i64
%23 = trunc i64 %22 to i32
%24 = call i64 @bytes_to_int64(i8* %10)
%25 = call i8* @bytes_to_int32(i8* %11)
%26 = ptrtoint i8* %25 to i64
%27 = trunc i64 %26 to i32
%28 = add nuw nsw i32 %14, 1
%29 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %20, i32 %23, i64 %24, i32 %27, i32 %28)
%30 = call i32 @bzero(i8* %3, i32 50)
%31 = call i64 @read(i32 %0, i8* %3, i32 60)
%32 = icmp eq i64 %31, 0
br i1 %32, label %12, label %13
}