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


x86 assembly (clang, -O0):
<match_scc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0xffffffff,-0x138(%rbp)
ff ff ff
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x138(%rbp),%r9
call   1050 <sscanf@plt>
mov    %eax,-0x134(%rbp)
xor    %eax,%eax
cmpl   $0x3,-0x134(%rbp)
mov    %al,-0x139(%rbp)
jl     120c <match_scc+0xcc>
xor    %eax,%eax
cmpl   $0x0,-0x138(%rbp)
mov    %al,-0x139(%rbp)
jle    120c <match_scc+0xcc>
movslq -0x138(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x148(%rbp),%rax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x139(%rbp)
mov    -0x139(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_scc>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rdi,%r14
movl   $0xffffffff,0xc(%rsp)
ff
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0xc(%rsp),%r9
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15,%r8
call   1050 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
jl     11bd <match_scc+0x7d>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
jle    11bd <match_scc+0x7d>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
sete   %al
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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