#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 */
struct per_cpu_info {
  int dummy;
};
struct blk_io_trace {
  int dummy;
};

/* Variables and functions */
scalar_t__ isdigit(char);
int /*<<< orphan*/ print_field(char *, struct per_cpu_info *,
                               struct blk_io_trace *, unsigned long long, int,
                               unsigned char *, int /*<<< orphan*/, int, int,
                               int);
char *parse_field(char *act, struct per_cpu_info *pci, struct blk_io_trace *t,
                  unsigned long long elapsed, int pdu_len,
                  unsigned char *pdu_buf, char *master_format) {
  int minus = 0;
  int has_w = 0;
  int width = 0;
  char *p = master_format;
  if (*p == '-') {
    minus = 1;
    p++;
  }
  if (isdigit(*p)) {
    has_w = 1;
    do {
      width = (width * 10) + (*p++ - '0');
    } while ((*p) && (isdigit(*p)));
  }
  if (*p) {
    print_field(act, pci, t, elapsed, pdu_len, pdu_buf, *p++, minus, has_w,
                width);
  }
  return p;
}


x86 assembly (clang, -O0):
<parse_field>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x78,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1185 <parse_field+0x65>
movl   $0x1,-0x3c(%rbp)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11fb <parse_field+0xdb>
movl   $0x1,-0x40(%rbp)
imul   $0xa,-0x44(%rbp),%eax
mov    -0x50(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x50(%rbp)
movsbl (%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x50(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x51(%rbp)
je     11eb <parse_field+0xcb>
mov    -0x50(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    11a2 <parse_field+0x82>
jmp    11fb <parse_field+0xdb>
mov    -0x50(%rbp),%rax
cmpb   $0x0,(%rax)
je     1253 <parse_field+0x133>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    -0x38(%rbp),%r9
mov    -0x50(%rbp),%rax
mov    %rax,%r10
add    $0x1,%r10
mov    %r10,-0x50(%rbp)
movsbl (%rax),%ebx
mov    -0x3c(%rbp),%r11d
mov    -0x40(%rbp),%r10d
mov    -0x44(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <print_field@plt>
mov    -0x50(%rbp),%rax
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_field>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x8(%rsp)
mov    %r8d,%r13d
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,0x10(%rsp)
mov    0x60(%rsp),%rbx
xor    %r15d,%r15d
cmpb   $0x2d,(%rbx)
sete   %r15b
movsbl (%rbx,%r15,1),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
mov    %r12,0x20(%rsp)
mov    %rbp,0x18(%rsp)
je     11b6 <parse_field+0x96>
add    %r15,%rbx
add    $0x1,%rbx
xor    %r12d,%r12d
mov    0x8(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
test   %al,%al
je     11f2 <parse_field+0xd2>
lea    (%r12,%r12,4),%ecx
movsbl -0x1(%rbx),%edx
lea    (%rdx,%rcx,2),%r12d
add    $0xffffffd0,%r12d
movsbl %al,%edi
call   1030 <isdigit@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1180 <parse_field+0x60>
mov    %rbp,%r9
add    $0xffffffffffffffff,%rbx
mov    $0x1,%eax
jmp    11c3 <parse_field+0xa3>
mov    0x8(%rsp),%r9
add    %r15,%rbx
xor    %eax,%eax
xor    %r12d,%r12d
movsbl (%rbx),%ebp
test   %ebp,%ebp
je     11f2 <parse_field+0xd2>
add    $0x1,%rbx
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x20(%rsp),%rdx
mov    %r14,%rcx
mov    %r13d,%r8d
push   %r12
push   %rax
push   %r15
push   %rbp
call   1040 <print_field@plt>
add    $0x20,%rsp
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.per_cpu_info = type { i32 }
%struct.blk_io_trace = type { i32 }
define i8* @parse_field(i8* %0, %struct.per_cpu_info* %1, %struct.blk_io_trace* %2, i64 %3, i32 %4, i8* %5, i8* %6) {
%8 = alloca i8*
%9 = alloca %struct.per_cpu_info*
%10 = alloca %struct.blk_io_trace*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
store i8* %0, i8** %8
store %struct.per_cpu_info* %1, %struct.per_cpu_info** %9
store %struct.blk_io_trace* %2, %struct.blk_io_trace** %10
store i64 %3, i64* %11
store i32 %4, i32* %12
store i8* %5, i8** %13
store i8* %6, i8** %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
%19 = load i8*, i8** %14
store i8* %19, i8** %18
%20 = load i8*, i8** %18
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %27
24: ; preds = %7
store i32 1, i32* %15
%25 = load i8*, i8** %18
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %18
br label %27
27: ; preds = %24, %7
%28 = load i8*, i8** %18
%29 = load i8, i8* %28
%30 = call i64 @isdigit(i8 signext %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %55
32: ; preds = %27
store i32 1, i32* %16
br label %33
33: ; preds = %52, %32
%34 = load i32, i32* %17
%35 = mul nsw i32 %34, 10
%36 = load i8*, i8** %18
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %18
%38 = load i8, i8* %36
%39 = sext i8 %38 to i32
%40 = sub nsw i32 %39, 48
%41 = add nsw i32 %35, %40
store i32 %41, i32* %17
br label %42
42: ; preds = %33
%43 = load i8*, i8** %18
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %42
%48 = load i8*, i8** %18
%49 = load i8, i8* %48
%50 = call i64 @isdigit(i8 signext %49)
%51 = icmp ne i64 %50, 0
br label %52
52: ; preds = %47, %42
%53 = phi i1 [ false, %42 ], [ %51, %47 ]
br i1 %53, label %33, label %54
54: ; preds = %52
br label %55
55: ; preds = %54, %27
%56 = load i8*, i8** %18
%57 = load i8, i8* %56
%58 = icmp ne i8 %57, 0
br i1 %58, label %59, label %74
59: ; preds = %55
%60 = load i8*, i8** %8
%61 = load %struct.per_cpu_info*, %struct.per_cpu_info** %9
%62 = load %struct.blk_io_trace*, %struct.blk_io_trace** %10
%63 = load i64, i64* %11
%64 = load i32, i32* %12
%65 = load i8*, i8** %13
%66 = load i8*, i8** %18
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %18
%68 = load i8, i8* %66
%69 = sext i8 %68 to i32
%70 = load i32, i32* %15
%71 = load i32, i32* %16
%72 = load i32, i32* %17
%73 = call i32 @print_field(i8* %60, %struct.per_cpu_info* %61, %struct.blk_io_trace* %62, i64 %63, i32 %64, i8* %65, i32 %69, i32 %70, i32 %71, i32 %72)
br label %74
74: ; preds = %59, %55
%75 = load i8*, i8** %18
ret i8* %75
}

LLVM IR (-O2):
%struct.per_cpu_info = type { i32 }
%struct.blk_io_trace = type { i32 }
define i8* @parse_field(i8* %0, %struct.per_cpu_info* %1, %struct.blk_io_trace* %2, i64 %3, i32 %4, i8* %5, i8* %6) {
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 45
%10 = zext i1 %9 to i32
%11 = zext i1 %9 to i64
%12 = getelementptr i8, i8* %6, i64 %11
%13 = load i8, i8* %12
%14 = tail call i64 @isdigit(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %30, label %16
16: ; preds = %7, %27
%17 = phi i32 [ %24, %27 ], [ 0, %7 ]
%18 = phi i8* [ %20, %27 ], [ %12, %7 ]
%19 = mul nsw i32 %17, 10
%20 = getelementptr inbounds i8, i8* %18, i64 1
%21 = load i8, i8* %18
%22 = sext i8 %21 to i32
%23 = add i32 %19, -48
%24 = add i32 %23, %22
%25 = load i8, i8* %20
%26 = icmp eq i8 %25, 0
br i1 %26, label %40, label %27
27: ; preds = %16
%28 = tail call i64 @isdigit(i8 signext %25)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %16
30: ; preds = %27, %7
%31 = phi i32 [ 0, %7 ], [ 1, %27 ]
%32 = phi i32 [ 0, %7 ], [ %24, %27 ]
%33 = phi i8* [ %12, %7 ], [ %20, %27 ]
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %30
%37 = getelementptr inbounds i8, i8* %33, i64 1
%38 = sext i8 %34 to i32
%39 = tail call i32 @print_field(i8* %0, %struct.per_cpu_info* %1, %struct.blk_io_trace* %2, i64 %3, i32 %4, i8* %5, i32 %38, i32 %10, i32 %31, i32 %32)
br label %40
40: ; preds = %16, %36, %30
%41 = phi i8* [ %37, %36 ], [ %33, %30 ], [ %20, %16 ]
ret i8* %41
}