#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__ calloc(int, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *Get_Location_Name(int location) {
  char *my_string;
  my_string = (char *)calloc(64, sizeof(char));
  if (!my_string)
    return NULL;
  switch (location) {
  case 0:
    free(my_string);
    my_string = NULL;
    break;
  case 1:
    strcpy(my_string, "Los Angeles Airport");
    break;
  case 2:
    strcpy(my_string, "Santa Monica Airport");
    break;
  case 3:
    strcpy(my_string, "UCLA Hospital");
    break;
  case 4:
    strcpy(my_string, "Catalina Airport");
    break;
  case 5:
    strcpy(my_string, "US Coast Guard ship");
    break;
  case 6:
    strcpy(my_string, "a nearby victim");
    break;
  }
  return my_string;
}


x86 assembly (clang, -O0):
<Get_Location_Name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    $0x40,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1166 <Get_Location_Name+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1222 <Get_Location_Name+0xf2>
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x6,%rax
ja     121a <Get_Location_Name+0xea>
mov    -0x20(%rbp),%rax
lea    0xe7e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
jmp    121a <Get_Location_Name+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcpy@plt>
jmp    121a <Get_Location_Name+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcpy@plt>
jmp    121a <Get_Location_Name+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcpy@plt>
jmp    121a <Get_Location_Name+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1040 <strcpy@plt>
jmp    121a <Get_Location_Name+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <strcpy@plt>
jmp    121a <Get_Location_Name+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_Location_Name>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x40,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
test   %rax,%rax
je     116b <Get_Location_Name+0x3b>
mov    %rax,%rbx
cmp    $0x6,%ebp
ja     11ab <Get_Location_Name+0x7b>
mov    %ebp,%eax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
jmp    11ab <Get_Location_Name+0x7b>
lea    0xea6(%rip),%rsi
jmp    11a3 <Get_Location_Name+0x73>
lea    0xeb1(%rip),%rsi
jmp    11a3 <Get_Location_Name+0x73>
lea    0xebd(%rip),%rsi
jmp    11a3 <Get_Location_Name+0x73>
lea    0xec2(%rip),%rsi
jmp    11a3 <Get_Location_Name+0x73>
lea    0xeca(%rip),%rsi
jmp    11a3 <Get_Location_Name+0x73>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Los Angeles Airport\00"
@.str.1 = [21 x i8] c"Santa Monica Airport\00"
@.str.2 = [14 x i8] c"UCLA Hospital\00"
@.str.3 = [17 x i8] c"Catalina Airport\00"
@.str.4 = [20 x i8] c"US Coast Guard ship\00"
@.str.5 = [16 x i8] c"a nearby victim\00"
define i8* @Get_Location_Name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = call i64 @calloc(i32 64, i32 1)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* null, i8** %2
br label %35
10: ; preds = %1
%11 = load i32, i32* %3
switch i32 %11, label %33 [
i32 0, label %12
i32 1, label %15
i32 2, label %18
i32 3, label %21
i32 4, label %24
i32 5, label %27
i32 6, label %30
]
12: ; preds = %10
%13 = load i8*, i8** %4
%14 = call i32 @free(i8* %13)
store i8* null, i8** %4
br label %33
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %33
18: ; preds = %10
%19 = load i8*, i8** %4
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %33
21: ; preds = %10
%22 = load i8*, i8** %4
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %33
24: ; preds = %10
%25 = load i8*, i8** %4
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %33
27: ; preds = %10
%28 = load i8*, i8** %4
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %33
30: ; preds = %10
%31 = load i8*, i8** %4
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %33
33: ; preds = %10, %30, %27, %24, %21, %18, %15, %12
%34 = load i8*, i8** %4
store i8* %34, i8** %2
br label %35
35: ; preds = %33, %9
%36 = load i8*, i8** %2
ret i8* %36
}

LLVM IR (-O2):
@.str = [20 x i8] c"Los Angeles Airport\00"
@.str.1 = [21 x i8] c"Santa Monica Airport\00"
@.str.2 = [14 x i8] c"UCLA Hospital\00"
@.str.3 = [17 x i8] c"Catalina Airport\00"
@.str.4 = [20 x i8] c"US Coast Guard ship\00"
@.str.5 = [16 x i8] c"a nearby victim\00"
define i8* @Get_Location_Name(i32 %0) {
%2 = tail call i64 @calloc(i32 64, i32 1)
%3 = inttoptr i64 %2 to i8*
%4 = icmp eq i64 %2, 0
br i1 %4, label %20, label %5
5: ; preds = %1
switch i32 %0, label %20 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 5, label %16
i32 6, label %18
]
6: ; preds = %5
%7 = tail call i32 @free(i8* %3)
br label %20
8: ; preds = %5
%9 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %20
10: ; preds = %5
%11 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %20
12: ; preds = %5
%13 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %20
14: ; preds = %5
%15 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %20
16: ; preds = %5
%17 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %20
18: ; preds = %5
%19 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %20
20: ; preds = %6, %8, %10, %12, %14, %16, %18, %5, %1
%21 = phi i8* [ null, %1 ], [ %3, %5 ], [ %3, %18 ], [ %3, %16 ], [ %3, %14 ], [ %3, %12 ], [ %3, %10 ], [ %3, %8 ], [ null, %6 ]
ret i8* %21
}