#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*/ foo1(int, struct A *, ...);
int /*<<< orphan*/ foo12(int);
int /*<<< orphan*/ foo5(int, void *, int, ...);
int /*<<< orphan*/ foo6(int, void *, int, int, int, int, int);
int /*<<< orphan*/ foo7(int, ...);
void test1() {
  foo1(1, (void *)0);
  foo1(1, 0);
  foo5(1, (void *)0, 2);
  foo5(1, 2, (void *)0, 1);
  foo5(1, (void *)0, 2, 1);
  foo6(1, 2, 3, 4, 5, 6, 7);
  foo6(1, (void *)0, 3, 4, 5, 6, 7);
  foo7(1);
  foo7(1, (void *)0);
  foo12(1);
  struct A {};
  struct A a, b, c;
  foo1(3, &a, &b, &c);
  foo1(3, &a, &b, &c, (struct A *)0);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1060 <foo1@plt>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1060 <foo1@plt>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1050 <foo5@plt>
mov    $0x1,%ecx
mov    $0x2,%esi
xor    %edx,%edx
mov    %ecx,%edi
mov    $0x0,%al
call   1050 <foo5@plt>
mov    $0x1,%ecx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
mov    %ecx,%edi
mov    $0x0,%al
call   1050 <foo5@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
mov    $0x6,%r9d
movl   $0x7,(%rsp)
call   1040 <foo6@plt>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
mov    $0x6,%r9d
movl   $0x7,(%rsp)
call   1040 <foo6@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1070 <foo7@plt>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1070 <foo7@plt>
mov    $0x1,%edi
call   1030 <foo12@plt>
lea    -0x8(%rbp),%rsi
mov    $0x3,%edi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1060 <foo1@plt>
lea    -0x8(%rbp),%rsi
mov    $0x3,%edi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x0,%al
call   1060 <foo1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <foo1@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <foo1@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <foo5@plt>
mov    $0x2,%esi
mov    $0x1,%edi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <foo5@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <foo5@plt>
movl   $0x7,(%rsp)
mov    $0x2,%esi
mov    $0x1,%edi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
mov    $0x6,%r9d
call   1040 <foo6@plt>
movl   $0x7,(%rsp)
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
mov    $0x6,%r9d
call   1040 <foo6@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <foo7@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1070 <foo7@plt>
mov    $0x1,%edi
call   1030 <foo12@plt>
lea    0x8(%rsp),%rbx
mov    $0x3,%edi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <foo1@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1060 <foo1@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.A.0 = type {}
%struct.A = type opaque
define void @test1() {
%1 = alloca %struct.A.0
%2 = alloca %struct.A.0
%3 = alloca %struct.A.0
%4 = call i32 (i32, %struct.A*, ...) @foo1(i32 1, %struct.A* null)
%5 = call i32 (i32, %struct.A*, ...) @foo1(i32 1, %struct.A* null)
%6 = call i32 (i32, i8*, i32, ...) @foo5(i32 1, i8* null, i32 2)
%7 = call i32 (i32, i8*, i32, ...) @foo5(i32 1, i8* inttoptr (i64 2 to i8*), i32 0, i32 1)
%8 = call i32 (i32, i8*, i32, ...) @foo5(i32 1, i8* null, i32 2, i32 1)
%9 = call i32 @foo6(i32 1, i8* inttoptr (i64 2 to i8*), i32 3, i32 4, i32 5, i32 6, i32 7)
%10 = call i32 @foo6(i32 1, i8* null, i32 3, i32 4, i32 5, i32 6, i32 7)
%11 = call i32 (i32, ...) @foo7(i32 1)
%12 = call i32 (i32, ...) @foo7(i32 1, i8* null)
%13 = call i32 @foo12(i32 1)
%14 = bitcast %struct.A.0* %1 to %struct.A*
%15 = call i32 (i32, %struct.A*, ...) @foo1(i32 3, %struct.A* %14, %struct.A.0* %2, %struct.A.0* %3)
%16 = bitcast %struct.A.0* %1 to %struct.A*
%17 = call i32 (i32, %struct.A*, ...) @foo1(i32 3, %struct.A* %16, %struct.A.0* %2, %struct.A.0* %3, %struct.A.0* null)
ret void
}

LLVM IR (-O2):
%struct.A.0 = type {}
%struct.A = type opaque
define void @test1() {
%1 = alloca %struct.A.0
%2 = tail call i32 (i32, %struct.A*, ...) @foo1(i32 1, %struct.A* null)
%3 = tail call i32 (i32, %struct.A*, ...) @foo1(i32 1, %struct.A* null)
%4 = tail call i32 (i32, i8*, i32, ...) @foo5(i32 1, i8* null, i32 2)
%5 = tail call i32 (i32, i8*, i32, ...) @foo5(i32 1, i8* inttoptr (i64 2 to i8*), i32 0, i32 1)
%6 = tail call i32 (i32, i8*, i32, ...) @foo5(i32 1, i8* null, i32 2, i32 1)
%7 = tail call i32 @foo6(i32 1, i8* inttoptr (i64 2 to i8*), i32 3, i32 4, i32 5, i32 6, i32 7)
%8 = tail call i32 @foo6(i32 1, i8* null, i32 3, i32 4, i32 5, i32 6, i32 7)
%9 = tail call i32 (i32, ...) @foo7(i32 1)
%10 = tail call i32 (i32, ...) @foo7(i32 1, i8* null)
%11 = tail call i32 @foo12(i32 1)
%12 = bitcast %struct.A.0* %1 to i8*
%13 = bitcast %struct.A.0* %1 to %struct.A*
%14 = call i32 (i32, %struct.A*, ...) @foo1(i32 3, %struct.A* %13, %struct.A.0* %1, %struct.A.0* %1)
%15 = call i32 (i32, %struct.A*, ...) @foo1(i32 3, %struct.A* %13, %struct.A.0* %1, %struct.A.0* %1, %struct.A.0* null)
ret void
}