#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*/ foo(int *, int *, int);
int main() {
  int a[100], b[200];
  foo((int *)0, a, 100);
  foo(a, (int *)0, 200);
  foo(a, b, 50);
  foo(a, b, 20);
  foo(a, b, 200);
  return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x64,%edx
call   1030 <foo@plt>
lea    -0x1a0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xc8,%edx
call   1030 <foo@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x4c0(%rbp),%rsi
mov    $0x32,%edx
call   1030 <foo@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x4c0(%rbp),%rsi
mov    $0x14,%edx
call   1030 <foo@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x4c0(%rbp),%rsi
mov    $0xc8,%edx
call   1030 <foo@plt>
mov    $0x2,%eax
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x4b8,%rsp
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1030 <foo@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1030 <foo@plt>
lea    0x190(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x32,%edx
call   1030 <foo@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x14,%edx
call   1030 <foo@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xc8,%edx
call   1030 <foo@plt>
mov    $0x2,%eax
add    $0x4b8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca [200 x i32]
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%5 = call i32 @foo(i32* null, i32* %4, i32 100)
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%7 = call i32 @foo(i32* %6, i32* null, i32 200)
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [200 x i32], [200 x i32]* %3, i64 0, i64 0
%10 = call i32 @foo(i32* %8, i32* %9, i32 50)
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%12 = getelementptr inbounds [200 x i32], [200 x i32]* %3, i64 0, i64 0
%13 = call i32 @foo(i32* %11, i32* %12, i32 20)
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%15 = getelementptr inbounds [200 x i32], [200 x i32]* %3, i64 0, i64 0
%16 = call i32 @foo(i32* %14, i32* %15, i32 200)
ret i32 2
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [200 x i32]
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast [200 x i32]* %2 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%6 = call i32 @foo(i32* null, i32* %5, i32 100)
%7 = call i32 @foo(i32* %5, i32* null, i32 200)
%8 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 0
%9 = call i32 @foo(i32* %5, i32* %8, i32 50)
%10 = call i32 @foo(i32* %5, i32* %8, i32 20)
%11 = call i32 @foo(i32* %5, i32* %8, i32 200)
ret i32 2
}