#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 */
char *cityvector(int);
int /*<<< orphan*/ printf(char *, ...);
void checkedcities(int checked_city[6]) {
  int i;
  printf("Visited city: ");
  for (i = 0; i < 6; i++) {
    if (checked_city[i] != -1)
      printf(" %s (%d)", cityvector(checked_city[i]), checked_city[i]);
  }
  printf("\n");
  printf("------------------\n");
}


x86 assembly (clang, -O0):
<checkedcities>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    119c <checkedcities+0x7c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1189 <checkedcities+0x69>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <cityvector@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <checkedcities+0x6e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <checkedcities+0x21>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkedcities>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
cmp    $0xffffffff,%edi
je     1171 <checkedcities+0x31>
call   1060 <cityvector@plt>
mov    (%rbx),%edx
lea    0xea8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%edi
cmp    $0xffffffff,%edi
je     1192 <checkedcities+0x52>
call   1060 <cityvector@plt>
mov    0x4(%rbx),%edx
lea    0xe87(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%edi
cmp    $0xffffffff,%edi
je     11b3 <checkedcities+0x73>
call   1060 <cityvector@plt>
mov    0x8(%rbx),%edx
lea    0xe66(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbx),%edi
cmp    $0xffffffff,%edi
je     11d4 <checkedcities+0x94>
call   1060 <cityvector@plt>
mov    0xc(%rbx),%edx
lea    0xe45(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%edi
cmp    $0xffffffff,%edi
je     11f5 <checkedcities+0xb5>
call   1060 <cityvector@plt>
mov    0x10(%rbx),%edx
lea    0xe24(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rbx),%edi
cmp    $0xffffffff,%edi
je     1216 <checkedcities+0xd6>
call   1060 <cityvector@plt>
mov    0x14(%rbx),%edx
lea    0xe03(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdf1(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Visited city: \00"
@.str.1 = [9 x i8] c" %s (%d)\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [20 x i8] c"------------------\0A\00"
define void @checkedcities(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 6
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %28
15: ; preds = %8
%16 = load i32*, i32** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = call i8* @cityvector(i32 %20)
%22 = load i32*, i32** %2
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %26)
br label %28
28: ; preds = %15, %8
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %5
32: ; preds = %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Visited city: \00"
@.str.1 = [9 x i8] c" %s (%d)\00"
@str = [19 x i8] c"------------------\00"
define void @checkedcities(i32* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i8* @cityvector(i32 %3)
%7 = load i32, i32* %0
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32 %7)
br label %9
9: ; preds = %1, %5
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, -1
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = tail call i8* @cityvector(i32 %11)
%15 = load i32, i32* %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %15)
br label %17
17: ; preds = %13, %9
%18 = getelementptr inbounds i32, i32* %0, i64 2
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, -1
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = tail call i8* @cityvector(i32 %19)
%23 = load i32, i32* %18
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %23)
br label %25
25: ; preds = %21, %17
%26 = getelementptr inbounds i32, i32* %0, i64 3
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, -1
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = tail call i8* @cityvector(i32 %27)
%31 = load i32, i32* %26
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %30, i32 %31)
br label %33
33: ; preds = %29, %25
%34 = getelementptr inbounds i32, i32* %0, i64 4
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, -1
br i1 %36, label %41, label %37
37: ; preds = %33
%38 = tail call i8* @cityvector(i32 %35)
%39 = load i32, i32* %34
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %38, i32 %39)
br label %41
41: ; preds = %37, %33
%42 = getelementptr inbounds i32, i32* %0, i64 5
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, -1
br i1 %44, label %49, label %45
45: ; preds = %41
%46 = tail call i8* @cityvector(i32 %43)
%47 = load i32, i32* %42
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %46, i32 %47)
br label %49
49: ; preds = %45, %41
%50 = tail call i32 @putchar(i32 10)
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}