#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 atoi(char *);
int /*<<< orphan*/ check_strcncpy(char *, char *, char, int);
int /*<<< orphan*/ skip_spaces(char *);
scalar_t__ strlen(char *);
char *strstr(char *, char *);
int extract_opcode_info(char *src, char *name, int *size, char *spec_proc,
                        char *spec_ea) {
  char *ptr = strstr(src, "M68KMAKE"
                          "_OP");
  if (ptr == NULL)
    return 0;
  ptr += strlen("M68KMAKE"
                "_OP") +
         1;
  ptr += check_strcncpy(name, ptr, ',', 30);
  if (*ptr != ',')
    return 0;
  ptr++;
  ptr += skip_spaces(ptr);
  *size = atoi(ptr);
  ptr = strstr(ptr, ",");
  if (ptr == NULL)
    return 0;
  ptr++;
  ptr += skip_spaces(ptr);
  ptr += check_strcncpy(spec_proc, ptr, ',', 4);
  if (*ptr != ',')
    return 0;
  ptr++;
  ptr += skip_spaces(ptr);
  ptr += check_strcncpy(spec_ea, ptr, ')', 5);
  if (*ptr != ')')
    return 0;
  ptr++;
  ptr += skip_spaces(ptr);
  return 1;
}


x86 assembly (clang, -O0):
<extract_opcode_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1197 <extract_opcode_info+0x47>
movl   $0x0,-0x4(%rbp)
jmp    134f <extract_opcode_info+0x1ff>
lea    0xe62(%rip),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    $0x2c,%edx
mov    $0x1e,%ecx
call   1040 <check_strcncpy@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     11f2 <extract_opcode_info+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    134f <extract_opcode_info+0x1ff>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <skip_spaces@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1253 <extract_opcode_info+0x103>
movl   $0x0,-0x4(%rbp)
jmp    134f <extract_opcode_info+0x1ff>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <skip_spaces@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    $0x2c,%edx
mov    $0x4,%ecx
call   1040 <check_strcncpy@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     12bb <extract_opcode_info+0x16b>
movl   $0x0,-0x4(%rbp)
jmp    134f <extract_opcode_info+0x1ff>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <skip_spaces@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    $0x29,%edx
mov    $0x5,%ecx
call   1040 <check_strcncpy@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x29,%eax
je     1323 <extract_opcode_info+0x1d3>
movl   $0x0,-0x4(%rbp)
jmp    134f <extract_opcode_info+0x1ff>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <skip_spaces@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_opcode_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r13
mov    %rsi,%rbx
lea    0xe92(%rip),%rsi
call   1070 <strstr@plt>
xor    %r12d,%r12d
test   %rax,%rax
je     1256 <extract_opcode_info+0x106>
mov    %rax,%rbp
lea    0xc(%rax),%rsi
mov    %rbx,%rdi
mov    $0x2c,%edx
mov    $0x1e,%ecx
call   1040 <check_strcncpy@plt>
cltq
cmpb   $0x2c,0xc(%rbp,%rax,1)
jne    1256 <extract_opcode_info+0x106>
lea    (%rax,%rbp,1),%rbx
add    $0xc,%rbx
lea    0x1(%rbx),%rdi
call   1050 <skip_spaces@plt>
cltq
add    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1060 <atoi@plt>
mov    %eax,0x0(%r13)
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1256 <extract_opcode_info+0x106>
mov    %rax,%rbx
lea    0x1(%rax),%rdi
call   1050 <skip_spaces@plt>
cltq
add    %rax,%rbx
add    $0x1,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x2c,%edx
mov    $0x4,%ecx
call   1040 <check_strcncpy@plt>
cltq
cmpb   $0x2c,(%rax,%rbx,1)
jne    1256 <extract_opcode_info+0x106>
add    %rax,%rbx
lea    0x1(%rbx),%rdi
call   1050 <skip_spaces@plt>
cltq
add    %rax,%rbx
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x29,%edx
mov    $0x5,%ecx
call   1040 <check_strcncpy@plt>
cltq
cmpb   $0x29,(%rax,%rbx,1)
jne    1256 <extract_opcode_info+0x106>
add    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <skip_spaces@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"M68KMAKE_OP\00"
@.str.1 = [2 x i8] c",\00"
define i32 @extract_opcode_info(i8* %0, i8* %1, i32* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%13 = load i8*, i8** %7
%14 = call i8* @strstr(i8* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %12
%15 = load i8*, i8** %12
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %5
store i32 0, i32* %6
br label %96
18: ; preds = %5
%19 = call i64 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%20 = add nsw i64 %19, 1
%21 = load i8*, i8** %12
%22 = getelementptr inbounds i8, i8* %21, i64 %20
store i8* %22, i8** %12
%23 = load i8*, i8** %8
%24 = load i8*, i8** %12
%25 = call i32 @check_strcncpy(i8* %23, i8* %24, i8 signext 44, i32 30)
%26 = load i8*, i8** %12
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %26, i64 %27
store i8* %28, i8** %12
%29 = load i8*, i8** %12
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 44
br i1 %32, label %33, label %34
33: ; preds = %18
store i32 0, i32* %6
br label %96
34: ; preds = %18
%35 = load i8*, i8** %12
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %12
%37 = load i8*, i8** %12
%38 = call i32 @skip_spaces(i8* %37)
%39 = load i8*, i8** %12
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds i8, i8* %39, i64 %40
store i8* %41, i8** %12
%42 = load i8*, i8** %12
%43 = call i32 @atoi(i8* %42)
%44 = load i32*, i32** %9
store i32 %43, i32* %44
%45 = load i8*, i8** %12
%46 = call i8* @strstr(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %46, i8** %12
%47 = load i8*, i8** %12
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %50
49: ; preds = %34
store i32 0, i32* %6
br label %96
50: ; preds = %34
%51 = load i8*, i8** %12
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %12
%53 = load i8*, i8** %12
%54 = call i32 @skip_spaces(i8* %53)
%55 = load i8*, i8** %12
%56 = sext i32 %54 to i64
%57 = getelementptr inbounds i8, i8* %55, i64 %56
store i8* %57, i8** %12
%58 = load i8*, i8** %10
%59 = load i8*, i8** %12
%60 = call i32 @check_strcncpy(i8* %58, i8* %59, i8 signext 44, i32 4)
%61 = load i8*, i8** %12
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds i8, i8* %61, i64 %62
store i8* %63, i8** %12
%64 = load i8*, i8** %12
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp ne i32 %66, 44
br i1 %67, label %68, label %69
68: ; preds = %50
store i32 0, i32* %6
br label %96
69: ; preds = %50
%70 = load i8*, i8** %12
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %12
%72 = load i8*, i8** %12
%73 = call i32 @skip_spaces(i8* %72)
%74 = load i8*, i8** %12
%75 = sext i32 %73 to i64
%76 = getelementptr inbounds i8, i8* %74, i64 %75
store i8* %76, i8** %12
%77 = load i8*, i8** %11
%78 = load i8*, i8** %12
%79 = call i32 @check_strcncpy(i8* %77, i8* %78, i8 signext 41, i32 5)
%80 = load i8*, i8** %12
%81 = sext i32 %79 to i64
%82 = getelementptr inbounds i8, i8* %80, i64 %81
store i8* %82, i8** %12
%83 = load i8*, i8** %12
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp ne i32 %85, 41
br i1 %86, label %87, label %88
87: ; preds = %69
store i32 0, i32* %6
br label %96
88: ; preds = %69
%89 = load i8*, i8** %12
%90 = getelementptr inbounds i8, i8* %89, i32 1
store i8* %90, i8** %12
%91 = load i8*, i8** %12
%92 = call i32 @skip_spaces(i8* %91)
%93 = load i8*, i8** %12
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds i8, i8* %93, i64 %94
store i8* %95, i8** %12
store i32 1, i32* %6
br label %96
96: ; preds = %88, %87, %68, %49, %33, %17
%97 = load i32, i32* %6
ret i32 %97
}

LLVM IR (-O2):
@.str = [12 x i8] c"M68KMAKE_OP\00"
define i32 @extract_opcode_info(i8* %0, i8* %1, i32* nocapture writeonly %2, i8* %3, i8* %4) {
%6 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %46, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 12
%10 = tail call i32 @check_strcncpy(i8* %1, i8* %9, i8 signext 44, i32 30)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 44
br i1 %14, label %15, label %46
15: ; preds = %8
%16 = getelementptr inbounds i8, i8* %12, i64 1
%17 = tail call i32 @skip_spaces(i8* %16)
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = tail call i32 @atoi(i8* %19)
store i32 %20, i32* %2
%21 = tail call i8* @strchr(i8* %19, i32 44)
%22 = icmp eq i8* %21, null
br i1 %22, label %46, label %23
23: ; preds = %15
%24 = getelementptr inbounds i8, i8* %21, i64 1
%25 = tail call i32 @skip_spaces(i8* %24)
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = tail call i32 @check_strcncpy(i8* %3, i8* %27, i8 signext 44, i32 4)
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 44
br i1 %32, label %33, label %46
33: ; preds = %23
%34 = getelementptr inbounds i8, i8* %30, i64 1
%35 = tail call i32 @skip_spaces(i8* %34)
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = tail call i32 @check_strcncpy(i8* %4, i8* %37, i8 signext 41, i32 5)
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = icmp eq i8 %41, 41
br i1 %42, label %43, label %46
43: ; preds = %33
%44 = getelementptr inbounds i8, i8* %40, i64 1
%45 = tail call i32 @skip_spaces(i8* %44)
br label %46
46: ; preds = %33, %23, %15, %8, %5, %43
%47 = phi i32 [ 1, %43 ], [ 0, %5 ], [ 0, %8 ], [ 0, %15 ], [ 0, %23 ], [ 0, %33 ]
ret i32 %47
}