#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*/ printf(char *, char const *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int strlen(char *);
scalar_t__ strstr(char *, char *);
void print_field(const char *line, const char *field, int start, int len) {
  char data[300 + 1];
  snprintf(data, len + 1, "%s", line + start);
  if (strstr(data, "\n"))
    data[strlen(data) - 1] = '\0';
  printf("\t%-3s = %s\n", field, data);
}


x86 assembly (clang, -O0):
<print_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rax
add    %rax,%rcx
lea    0xe88(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x150(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11b3 <print_field+0x73>
lea    -0x150(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x150(%rbp,%rax,1)
mov    -0x10(%rbp),%rsi
lea    -0x150(%rbp),%rdx
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_field>:
push   %r14
push   %rbx
sub    $0x138,%rsp
mov    %rsi,%r14
lea    0x1(%rcx),%esi
movslq %edx,%rcx
add    %rdi,%rcx
lea    0xea3(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <snprintf@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     118b <print_field+0x4b>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xe71(%rip),%rdi
mov    %rsp,%rdx
mov    %r14,%rsi
call   1040 <printf@plt>
add    $0x138,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [12 x i8] c"\09%-3s = %s\0A\00"
define void @print_field(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [301 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [301 x i8], [301 x i8]* %9, i64 0, i64 0
%11 = load i32, i32* %8
%12 = add nsw i32 %11, 1
%13 = load i8*, i8** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = call i32 @snprintf(i8* %10, i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [301 x i8], [301 x i8]* %9, i64 0, i64 0
%19 = call i64 @strstr(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %4
%22 = getelementptr inbounds [301 x i8], [301 x i8]* %9, i64 0, i64 0
%23 = call i32 @strlen(i8* %22)
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [301 x i8], [301 x i8]* %9, i64 0, i64 %25
store i8 0, i8* %26
br label %27
27: ; preds = %21, %4
%28 = load i8*, i8** %6
%29 = getelementptr inbounds [301 x i8], [301 x i8]* %9, i64 0, i64 0
%30 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %29)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [12 x i8] c"\09%-3s = %s\0A\00"
define void @print_field(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [301 x i8]
%6 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 0
%7 = add nsw i32 %3, 1
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = call i32 @snprintf(i8* %6, i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i64 @strstr(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %4
%14 = call i32 @strlen(i8* %6)
%15 = add nsw i32 %14, -1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %13, %4
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %6)
ret void
}