#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 /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void output_function_json_record(unsigned long int host, int port, time_t time,
                                 char *data, int len) {
  printf("  {'host':'%lu.%lu.%lu.%lu','port':%d,'time':%d,'response':'",
         ((host & 0xFF000000) >> 24), ((host & 0x00FF0000) >> 16),
         ((host & 0x0000FF00) >> 8), ((host & 0x000000FF) >> 0), port, time);
  int i;
  for (i = 0; i < len; ++i) {
    switch (data[i]) {
    case '\'':
      printf("\\'");
      break;
    default:
      printf("%c", data[i]);
      break;
    }
  }
  printf("'},\n");
}


x86 assembly (clang, -O0):
<output_function_json_record>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movabs $0xff000000,%rsi
and    -0x8(%rbp),%rsi
shr    $0x18,%rsi
mov    -0x8(%rbp),%rdx
and    $0xff0000,%rdx
shr    $0x10,%rdx
mov    -0x8(%rbp),%rcx
and    $0xff00,%rcx
shr    $0x8,%rcx
mov    -0x8(%rbp),%r8
and    $0xff,%r8
shr    $0x0,%r8
mov    -0xc(%rbp),%r9d
mov    -0x10(%rbp),%eax
lea    0xe89(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ec <output_function_json_record+0xdc>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
sub    $0x27,%al
jne    11bf <output_function_json_record+0xaf>
jmp    11ac <output_function_json_record+0x9c>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d9 <output_function_json_record+0xc9>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <output_function_json_record+0xce>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1188 <output_function_json_record+0x78>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_function_json_record>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%r15
mov    %esi,%r9d
mov    %rdi,%rax
movzbl %ah,%ecx
movzbl %al,%r8d
mov    %eax,%esi
shr    $0x18,%esi
shr    $0x10,%edi
movzbl %dil,%eax
mov    %edx,(%rsp)
lea    0xea0(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
jle    11a4 <output_function_json_record+0x74>
mov    %ebp,%ebp
lea    0xec6(%rip),%r14
xor    %ebx,%ebx
jmp    118e <output_function_json_record+0x5e>
nopl   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     11a4 <output_function_json_record+0x74>
movsbl (%r15,%rbx,1),%edi
cmp    $0x27,%edi
jne    1180 <output_function_json_record+0x50>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1185 <output_function_json_record+0x55>
lea    0xe95(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [61 x i8] c" {'host':'%lu.%lu.%lu.%lu','port':%d,'time':%d,'response':'\00"
@.str.1 = [3 x i8] c"\\'\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [5 x i8] c"'},\0A\00"
define void @output_function_json_record(i64 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i64 %0, i64* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i64, i64* %6
%13 = and i64 %12, 4278190080
%14 = lshr i64 %13, 24
%15 = load i64, i64* %6
%16 = and i64 %15, 16711680
%17 = lshr i64 %16, 16
%18 = load i64, i64* %6
%19 = and i64 %18, 65280
%20 = lshr i64 %19, 8
%21 = load i64, i64* %6
%22 = and i64 %21, 255
%23 = lshr i64 %22, 0
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i64 %14, i64 %17, i64 %20, i64 %23, i32 %24, i32 %25)
store i32 0, i32* %11
br label %27
27: ; preds = %49, %5
%28 = load i32, i32* %11
%29 = load i32, i32* %10
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %52
31: ; preds = %27
%32 = load i8*, i8** %9
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
switch i32 %37, label %40 [
i32 39, label %38
]
38: ; preds = %31
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %48
40: ; preds = %31
%41 = load i8*, i8** %9
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %40, %38
br label %49
49: ; preds = %48
%50 = load i32, i32* %11
%51 = add nsw i32 %50, 1
store i32 %51, i32* %11
br label %27
52: ; preds = %27
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c" {'host':'%lu.%lu.%lu.%lu','port':%d,'time':%d,'response':'\00"
@.str.1 = [3 x i8] c"\\'\00"
@str = [4 x i8] c"'},\00"
define void @output_function_json_record(i64 %0, i32 %1, i32 %2, i8* nocapture %3, i32 %4) {
%6 = lshr i64 %0, 24
%7 = and i64 %6, 255
%8 = lshr i64 %0, 16
%9 = and i64 %8, 255
%10 = lshr i64 %0, 8
%11 = and i64 %10, 255
%12 = and i64 %0, 255
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i64 %7, i64 %9, i64 %11, i64 %12, i32 %1, i32 %2)
%14 = icmp sgt i32 %4, 0
br i1 %14, label %15, label %30
15: ; preds = %5
%16 = zext i32 %4 to i64
br label %17
17: ; preds = %15, %27
%18 = phi i64 [ 0, %15 ], [ %28, %27 ]
%19 = getelementptr inbounds i8, i8* %3, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 39
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %27
24: ; preds = %17
%25 = sext i8 %20 to i32
%26 = tail call i32 @putchar(i32 %25)
br label %27
27: ; preds = %22, %24
%28 = add nuw nsw i64 %18, 1
%29 = icmp eq i64 %28, %16
br i1 %29, label %30, label %17
30: ; preds = %27, %5
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}