#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 */
typedef int /*<<< orphan*/ strs;

/* Variables and functions */
char *longestCommonPrefix(char **, int);
int /*<<< orphan*/ printf(char *, char *);
void longestCommonPrefixMain(void) {
  char *strs[] = {"aqwerr", "aqwert", "aqwerty", "aqwertyu"};
  int strsSize = 0;
  { strsSize = sizeof(strs) / sizeof(strs[0]); };
  printf("%s\n", longestCommonPrefix(strs, strsSize));
  printf("%s\n", longestCommonPrefix(NULL, strsSize));
  printf("%s\n", longestCommonPrefix(strs, 0));
}


x86 assembly (clang, -O0):
<longestCommonPrefixMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2cd1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cce(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ccb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cc8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x4,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <longestCommonPrefix@plt>
mov    %rax,%rsi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <longestCommonPrefix@plt>
mov    %rax,%rsi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1030 <longestCommonPrefix@plt>
mov    %rax,%rsi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<longestCommonPrefixMain>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0x2ce2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cc6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <longestCommonPrefix@plt>
lea    0xeca(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x4,%esi
call   1030 <longestCommonPrefix@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <longestCommonPrefix@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"aqwerr\00"
@.str.1 = [7 x i8] c"aqwert\00"
@.str.2 = [8 x i8] c"aqwerty\00"
@.str.3 = [9 x i8] c"aqwertyu\00"
@__const.longestCommonPrefixMain.strs = [4 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 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 ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [4 x i8] c"%s\0A\00"
define void @longestCommonPrefixMain() {
%1 = alloca [4 x i8*]
%2 = alloca i32
%3 = bitcast [4 x i8*]* %1 to i8*
store i32 0, i32* %2
store i32 4, i32* %2
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i8* @longestCommonPrefix(i8** %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %2
%9 = call i8* @longestCommonPrefix(i8** null, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%12 = call i8* @longestCommonPrefix(i8** %11, i32 0)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"aqwerr\00"
@.str.1 = [7 x i8] c"aqwert\00"
@.str.2 = [8 x i8] c"aqwerty\00"
@.str.3 = [9 x i8] c"aqwertyu\00"
@__const.longestCommonPrefixMain.strs = [4 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 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 ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [4 x i8] c"%s\0A\00"
define void @longestCommonPrefixMain() {
%1 = alloca [4 x i8*]
%2 = bitcast [4 x i8*]* %1 to i8*
%3 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%4 = call i8* @longestCommonPrefix(i8** %3, i32 4)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%6 = call i8* @longestCommonPrefix(i8** null, i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%8 = call i8* @longestCommonPrefix(i8** %3, i32 0)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
ret void
}