#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*/ printf(char *, char const *, int);
int main() {
  typedef enum direcao { Norte, Sul, Leste, Oeste, DirecaoLast } Direcao;
  const char *DirecaoNames[] = {"Norte", "Sul", "Leste", "Oeste"};
  for (int i = 0; i < DirecaoLast; i++) {
    Direcao direcao = i;
    printf("%s = %d\n", DirecaoNames[i], direcao);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    1188 <main+0x78>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
mov    -0x38(%rbp),%edx
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1152 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xefe(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1030 <printf@plt>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <printf@plt>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <printf@plt>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Norte\00"
@.str.1 = [4 x i8] c"Sul\00"
@.str.2 = [6 x i8] c"Leste\00"
@.str.3 = [6 x i8] c"Oeste\00"
@__const.main.DirecaoNames = [4 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [9 x i8] c"%s = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i8*]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = load i32, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %14, i32 %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [6 x i8] c"Norte\00"
@.str.1 = [4 x i8] c"Sul\00"
@.str.2 = [6 x i8] c"Leste\00"
@.str.3 = [6 x i8] c"Oeste\00"
@.str.4 = [9 x i8] c"%s = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 3)
ret i32 0
}