#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*/ create_label(char *, unsigned short);
int get_memory_type(int);
unsigned short get_word(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ stack_address(unsigned short);
void set_starting_address(int vector, char *lab) {
  unsigned short addr;
  if (get_memory_type(vector) != 4) {
    char vecLab[512];
    addr = get_word(vector);
    snprintf(vecLab, 512 - 1, "%sVector", lab);
    create_label(vecLab, vector);
  }
  if (addr != 0xffff) {
    stack_address(addr);
    create_label(lab, addr);
  }
}


x86 assembly (clang, -O0):
<set_starting_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <get_memory_type@plt>
cmp    $0x4,%eax
je     11ad <set_starting_address+0x5d>
mov    -0x4(%rbp),%edi
call   1070 <get_word@plt>
mov    %ax,-0x12(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1ff,%esi
lea    0xe6a(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rdi
mov    -0x4(%rbp),%eax
movzwl %ax,%esi
call   1040 <create_label@plt>
movzwl -0x12(%rbp),%eax
cmp    $0xffff,%eax
je     11d2 <set_starting_address+0x82>
movzwl -0x12(%rbp),%edi
call   1030 <stack_address@plt>
mov    -0x10(%rbp),%rdi
movzwl -0x12(%rbp),%esi
call   1040 <create_label@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_starting_address>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
call   1060 <get_memory_type@plt>
cmp    $0x4,%eax
je     11a0 <set_starting_address+0x50>
mov    %ebp,%edi
call   1070 <get_word@plt>
mov    %eax,%ebx
lea    0xe84(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x1ff,%esi
mov    %r14,%rcx
call   1050 <snprintf@plt>
movzwl %bp,%esi
mov    %r15,%rdi
call   1040 <create_label@plt>
cmp    $0xffff,%bx
je     11b4 <set_starting_address+0x64>
movzwl %bx,%ebx
mov    %ebx,%edi
call   1030 <stack_address@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <create_label@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%sVector\00"
define void @set_starting_address(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i16
%6 = alloca [512 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i32, i32* %3
%8 = call i32 @get_memory_type(i32 %7)
%9 = icmp ne i32 %8, 4
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = load i32, i32* %3
%12 = call zeroext i16 @get_word(i32 %11)
store i16 %12, i16* %5
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = call i32 @snprintf(i8* %13, i32 511, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%17 = load i32, i32* %3
%18 = trunc i32 %17 to i16
%19 = call i32 @create_label(i8* %16, i16 zeroext %18)
br label %20
20: ; preds = %10, %2
%21 = load i16, i16* %5
%22 = zext i16 %21 to i32
%23 = icmp ne i32 %22, 65535
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i16, i16* %5
%26 = call i32 @stack_address(i16 zeroext %25)
%27 = load i8*, i8** %4
%28 = load i16, i16* %5
%29 = call i32 @create_label(i8* %27, i16 zeroext %28)
br label %30
30: ; preds = %24, %20
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%sVector\00"
define void @set_starting_address(i32 %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = tail call i32 @get_memory_type(i32 %0)
%5 = icmp eq i32 %4, 4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%8 = tail call zeroext i16 @get_word(i32 %0)
%9 = call i32 @snprintf(i8* %7, i32 511, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1)
%10 = trunc i32 %0 to i16
%11 = call i32 @create_label(i8* %7, i16 zeroext %10)
%12 = icmp eq i16 %8, -1
br i1 %12, label %17, label %13
13: ; preds = %2, %6
%14 = phi i16 [ %8, %6 ], [ undef, %2 ]
%15 = call i32 @stack_address(i16 zeroext %14)
%16 = call i32 @create_label(i8* %1, i16 zeroext %14)
br label %17
17: ; preds = %13, %6
ret void
}