#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 sscanf(char const *, char *, char *, char *, int *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
int match_cc(const char *src, const char *o_fmt, char *c0, char *c1) {
  char fmt[256];
  int r;
  int len = 0;
  strcpy(fmt, o_fmt);
  strcat(fmt, "%n");
  r = sscanf(src, fmt, c0, c1, &len);
  return (r >= 2) && (len > 0) && ((size_t)len == strlen(src));
}


x86 assembly (clang, -O0):
<match_cc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x128(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x128(%rbp),%r8
call   1050 <sscanf@plt>
mov    %eax,-0x124(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x124(%rbp)
mov    %al,-0x129(%rbp)
jl     1204 <match_cc+0xc4>
xor    %eax,%eax
cmpl   $0x0,-0x128(%rbp)
mov    %al,-0x129(%rbp)
jle    1204 <match_cc+0xc4>
movslq -0x128(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x138(%rbp),%rax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x129(%rbp)
mov    -0x129(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_cc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rdi,%r14
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0xc(%rsp),%r8
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1050 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
jl     11b5 <match_cc+0x75>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
jle    11b5 <match_cc+0x75>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
sete   %al
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%n\00"
define i32 @match_cc(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i32 0, i32* %11
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%16 = call i32 @strcat(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %5
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%19 = load i8*, i8** %7
%20 = load i8*, i8** %8
%21 = call i32 @sscanf(i8* %17, i8* %18, i8* %19, i8* %20, i32* %11)
store i32 %21, i32* %10
%22 = load i32, i32* %10
%23 = icmp sge i32 %22, 2
br i1 %23, label %24, label %33
24: ; preds = %4
%25 = load i32, i32* %11
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = load i8*, i8** %5
%31 = call i64 @strlen(i8* %30)
%32 = icmp eq i64 %29, %31
br label %33
33: ; preds = %27, %24, %4
%34 = phi i1 [ false, %24 ], [ false, %4 ], [ %32, %27 ]
%35 = zext i1 %34 to i32
ret i32 %35
}

LLVM IR (-O2):
@.str = [3 x i8] c"%n\00"
define i32 @match_cc(i8* nocapture %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%9 = call i32 @strcpy(i8* %7, i8* %1)
%10 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @sscanf(i8* %0, i8* %7, i8* %2, i8* %3, i32* %6)
%12 = icmp sgt i32 %11, 1
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 0
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %16, label %21
16: ; preds = %4
%17 = zext i32 %13 to i64
%18 = call i64 @strlen(i8* dereferenceable(1) %0)
%19 = icmp eq i64 %18, %17
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %16, %4
%22 = phi i32 [ 0, %4 ], [ %20, %16 ]
ret i32 %22
}