#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*/ strncmp(char *, char *, int);
int br_city(char *s, char *t, int ss, int st) {
  if (ss == st && !strncmp(s, t, ss))
    return 1;
  if (!strncmp(s, t, 2))
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<br_city>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1157 <br_city+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1157 <br_city+0x47>
movl   $0x1,-0x4(%rbp)
jmp    1185 <br_city+0x75>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    117e <br_city+0x6e>
movl   $0x2,-0x4(%rbp)
jmp    1185 <br_city+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<br_city>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    %ecx,%edx
jne    112d <br_city+0x1d>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncmp@plt>
test   %eax,%eax
je     114a <br_city+0x3a>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    %eax,%eax
jmp    114f <br_city+0x3f>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @br_city(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %8
%11 = load i32, i32* %9
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %20
13: ; preds = %4
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @strncmp(i8* %14, i8* %15, i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %13
store i32 1, i32* %5
br label %27
20: ; preds = %13, %4
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i32 @strncmp(i8* %21, i8* %22, i32 2)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %20
store i32 2, i32* %5
br label %27
26: ; preds = %20
store i32 0, i32* %5
br label %27
27: ; preds = %26, %25, %19
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
define i32 @br_city(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, %3
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6, %4
%10 = tail call i32 @strncmp(i8* %0, i8* %1, i32 2)
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 2, i32 0
br label %13
13: ; preds = %9, %6
%14 = phi i32 [ 1, %6 ], [ %12, %9 ]
ret i32 %14
}