#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*/ b(short, short *);
int /*<<< orphan*/ f(char *, char **);
int /*<<< orphan*/ printf(char *, char **, short *);
int main() {
  char *localStrings[] = {"apple",    "banana", "carrot", "daikon",
                          "eggplant", "fig",    "grape",  0};
  static char *staticStrings[] = {
      "STATIC apple",    "STATIC banana", "STATIC carrot", "STATIC daikon",
      "STATIC eggplant", "STATIC fig",    "STATIC grape",  0};
  short localShorts[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
  static short staticShorts[] = {101, 102, 103, 104, 105, 106, 107, 108, 109};
  int i;
  printf("staticStrings = %p, staticShorts = %p\n", staticStrings,
         staticShorts);
  f(localStrings[1], localStrings);
  staticStrings[5] = "MODIFIED STATIC fig";
  f(staticStrings[1], staticStrings);
  staticStrings[7] = "MODIFIED STATIC horseradish";
  b(localShorts[5], localShorts);
  staticShorts[2] = 8192;
  b(staticShorts[5], staticShorts);
  for (i = 0; i < 9; i++)
    staticShorts[i] = 42;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c83(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
mov    0xf42(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xf3f(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xf3d(%rip),%eax
mov    %eax,-0x60(%rbp)
mov    0xf37(%rip),%ax
mov    %ax,-0x5c(%rbp)
lea    0xebc(%rip),%rdi
lea    0x2eb1(%rip),%rsi
lea    0x2eea(%rip),%rdx
call   1050 <printf@plt>
mov    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <f@plt>
lea    0xebc(%rip),%rax
mov    %rax,0x2eb2(%rip)
mov    0x2e8b(%rip),%rdi
lea    0x2e7c(%rip),%rsi
call   1040 <f@plt>
lea    0xeaf(%rip),%rax
mov    %rax,0x2ea1(%rip)
mov    -0x66(%rbp),%ax
lea    -0x70(%rbp),%rsi
movswl %ax,%edi
call   1030 <b@plt>
movw   $0x2000,0x2e94(%rip)
lea    0x2e89(%rip),%rsi
movswl 0x2e8c(%rip),%edi
call   1030 <b@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x9,-0x74(%rbp)
jge    1243 <main+0x103>
movslq -0x74(%rbp),%rcx
lea    0x2e61(%rip),%rax
movw   $0x2a,(%rax,%rcx,2)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    121a <main+0xda>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
movaps 0x2cd2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2cb6(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c9a(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2c7e(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xf60(%rip),%rax
mov    %rax,0xe(%rsp)
movaps 0xf46(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xedf(%rip),%rdi
lea    0x2eb4(%rip),%rbx
lea    0x2eed(%rip),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1040 <f@plt>
lea    0xed5(%rip),%rax
mov    %rax,0x2eab(%rip)
mov    0x2e84(%rip),%rdi
mov    %rbx,%rsi
call   1040 <f@plt>
lea    0xecc(%rip),%rax
mov    %rax,0x2e9e(%rip)
mov    %rsp,%rsi
mov    $0x6,%edi
call   1030 <b@plt>
movw   $0x2000,0x2e94(%rip)
movswl 0x2e93(%rip),%edi
mov    %r14,%rsi
call   1030 <b@plt>
movaps 0xdfa(%rip),%xmm0
movaps %xmm0,0x2e73(%rip)
movw   $0x2a,0x2e7a(%rip)
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"apple\00"
@.str.1 = [7 x i8] c"banana\00"
@.str.2 = [7 x i8] c"carrot\00"
@.str.3 = [7 x i8] c"daikon\00"
@.str.4 = [9 x i8] c"eggplant\00"
@.str.5 = [4 x i8] c"fig\00"
@.str.6 = [6 x i8] c"grape\00"
@__const.main.localStrings = [8 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* null]
@main.staticStrings = internal global [8 x i8*] [i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i32 0, i32 0), i8* null]
@.str.7 = [13 x i8] c"STATIC apple\00"
@.str.8 = [14 x i8] c"STATIC banana\00"
@.str.9 = [14 x i8] c"STATIC carrot\00"
@.str.10 = [14 x i8] c"STATIC daikon\00"
@.str.11 = [16 x i8] c"STATIC eggplant\00"
@.str.12 = [11 x i8] c"STATIC fig\00"
@.str.13 = [13 x i8] c"STATIC grape\00"
@__const.main.localShorts = [11 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11]
@main.staticShorts = internal global [9 x i16] [i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107, i16 108, i16 109]
@.str.14 = [39 x i8] c"staticStrings = %p, staticShorts = %p\0A\00"
@.str.15 = [20 x i8] c"MODIFIED STATIC fig\00"
@.str.16 = [28 x i8] c"MODIFIED STATIC horseradish\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8*]
%3 = alloca [11 x i16]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i8*]* %2 to i8*
%6 = bitcast [11 x i16]* %3 to i8*
%7 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 0), i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 0))
%8 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%11 = call i32 @f(i8* %9, i8** %10)
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 5)
%12 = load i8*, i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 1)
%13 = call i32 @f(i8* %12, i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 0))
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 7)
%14 = getelementptr inbounds [11 x i16], [11 x i16]* %3, i64 0, i64 5
%15 = load i16, i16* %14
%16 = getelementptr inbounds [11 x i16], [11 x i16]* %3, i64 0, i64 0
%17 = call i32 @b(i16 signext %15, i16* %16)
store i16 8192, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 2)
%18 = load i16, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 5)
%19 = call i32 @b(i16 signext %18, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 0))
store i32 0, i32* %4
br label %20
20: ; preds = %27, %0
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 9
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 %25
store i16 42, i16* %26
br label %27
27: ; preds = %23
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %20
30: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"apple\00"
@.str.1 = [7 x i8] c"banana\00"
@.str.2 = [7 x i8] c"carrot\00"
@.str.3 = [7 x i8] c"daikon\00"
@.str.4 = [9 x i8] c"eggplant\00"
@.str.5 = [4 x i8] c"fig\00"
@.str.6 = [6 x i8] c"grape\00"
@__const.main.localStrings = [8 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* null]
@main.staticStrings = internal global [8 x i8*] [i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i32 0, i32 0), i8* null]
@.str.7 = [13 x i8] c"STATIC apple\00"
@.str.8 = [14 x i8] c"STATIC banana\00"
@.str.9 = [14 x i8] c"STATIC carrot\00"
@.str.10 = [14 x i8] c"STATIC daikon\00"
@.str.11 = [16 x i8] c"STATIC eggplant\00"
@.str.12 = [11 x i8] c"STATIC fig\00"
@.str.13 = [13 x i8] c"STATIC grape\00"
@__const.main.localShorts = [11 x i16] [i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11]
@main.staticShorts = internal global [9 x i16] [i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107, i16 108, i16 109]
@.str.14 = [39 x i8] c"staticStrings = %p, staticShorts = %p\0A\00"
@.str.15 = [20 x i8] c"MODIFIED STATIC fig\00"
@.str.16 = [28 x i8] c"MODIFIED STATIC horseradish\00"
define i32 @main() {
%1 = alloca [8 x i8*]
%2 = alloca [11 x i16]
%3 = bitcast [8 x i8*]* %1 to i8*
%4 = bitcast [11 x i16]* %2 to i8*
%5 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 0), i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 0))
%6 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 0
%7 = call i32 @f(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %6)
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 5)
%8 = load i8*, i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 1)
%9 = call i32 @f(i8* %8, i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 0))
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @main.staticStrings, i64 0, i64 7)
%10 = getelementptr inbounds [11 x i16], [11 x i16]* %2, i64 0, i64 0
%11 = call i32 @b(i16 signext 6, i16* %10)
store i16 8192, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 2)
%12 = load i16, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 5)
%13 = call i32 @b(i16 signext %12, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 0))
store <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42>, <8 x i16>* bitcast ([9 x i16]* @main.staticShorts to <8 x i16>*)
store i16 42, i16* getelementptr inbounds ([9 x i16], [9 x i16]* @main.staticShorts, i64 0, i64 8)
ret i32 0
}