#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 */
scalar_t__ strcmp(char const *, char const *);
int cities_match(const char **actual, const char **expected) {
  for (; *actual != NULL && *expected != NULL; ++actual, ++expected) {
    if (strcmp(*actual, *expected) != 0) {
      return 0;
    }
  }
  return (*actual == NULL && *expected == NULL);
}


x86 assembly (clang, -O0):
<cities_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x19(%rbp)
je     1141 <cities_match+0x31>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1151 <cities_match+0x41>
jmp    119c <cities_match+0x8c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     117a <cities_match+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <cities_match+0xb8>
jmp    117f <cities_match+0x6f>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <cities_match+0x10>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x1a(%rbp)
jne    11bd <cities_match+0xad>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cities_match>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1152 <cities_match+0x42>
add    $0x8,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r14),%rsi
test   %rsi,%rsi
je     115c <cities_match+0x4c>
call   1030 <strcmp@plt>
test   %rax,%rax
jne    115c <cities_match+0x4c>
add    $0x8,%r14
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <cities_match+0x20>
xor    %ebp,%ebp
cmpq   $0x0,(%r14)
sete   %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cities_match(i8** %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
store i8** %0, i8*** %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %25, %2
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
br i1 %15, label %16, label %30
16: ; preds = %14
%17 = load i8**, i8*** %4
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %18, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 0, i32* %3
br label %41
24: ; preds = %16
br label %25
25: ; preds = %24
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %4
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i32 1
store i8** %29, i8*** %5
br label %6
30: ; preds = %14
%31 = load i8**, i8*** %4
%32 = load i8*, i8** %31
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i8**, i8*** %5
%36 = load i8*, i8** %35
%37 = icmp eq i8* %36, null
br label %38
38: ; preds = %34, %30
%39 = phi i1 [ false, %30 ], [ %37, %34 ]
%40 = zext i1 %39 to i32
store i32 %40, i32* %3
br label %41
41: ; preds = %38, %23
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
define i32 @cities_match(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %19, label %5
5: ; preds = %2, %14
%6 = phi i8* [ %17, %14 ], [ %3, %2 ]
%7 = phi i8** [ %16, %14 ], [ %1, %2 ]
%8 = phi i8** [ %15, %14 ], [ %0, %2 ]
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %24, label %11
11: ; preds = %5
%12 = tail call i64 @strcmp(i8* %6, i8* %9)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = getelementptr inbounds i8*, i8** %8, i64 1
%16 = getelementptr inbounds i8*, i8** %7, i64 1
%17 = load i8*, i8** %15
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %5
19: ; preds = %14, %2
%20 = phi i8** [ %1, %2 ], [ %16, %14 ]
%21 = load i8*, i8** %20
%22 = icmp eq i8* %21, null
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %5, %11, %19
%25 = phi i32 [ %23, %19 ], [ 0, %11 ], [ 0, %5 ]
ret i32 %25
}