#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 arg_rest(char **);
int dialog_calendar(char const *, char *, int /*<<< orphan*/,
                    int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                    int /*<<< orphan*/);
int /*<<< orphan*/ numeric_arg(char **, int);
int /*<<< orphan*/ optional_num(char **, int, int);
int call_calendar(const char *t, char *av[], int *offset_add) {
  *offset_add = arg_rest(av);
  return dialog_calendar(t, av[1], numeric_arg(av, 2), numeric_arg(av, 3),
                         optional_num(av, 4, -1), optional_num(av, 5, -1),
                         optional_num(av, 6, -1));
}


x86 assembly (clang, -O0):
<call_calendar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <arg_rest@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1060 <numeric_arg@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1060 <numeric_arg@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0xffffffff,%edx
call   1050 <optional_num@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0xffffffff,%edx
call   1050 <optional_num@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
mov    $0xffffffff,%edx
call   1050 <optional_num@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    %eax,(%rsp)
call   1040 <dialog_calendar@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_calendar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,0x10(%rsp)
mov    %rsi,%rdi
call   1030 <arg_rest@plt>
mov    %eax,0x0(%rbp)
mov    0x8(%rbx),%r15
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <numeric_arg@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <numeric_arg@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0xffffffff,%edx
call   1050 <optional_num@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0xffffffff,%edx
call   1050 <optional_num@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0xffffffff,%edx
call   1050 <optional_num@plt>
mov    %eax,(%rsp)
mov    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %ebp,%r8d
mov    %r14d,%r9d
call   1040 <dialog_calendar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @call_calendar(i8* %0, i8** %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
%7 = load i8**, i8*** %5
%8 = call i32 @arg_rest(i8** %7)
%9 = load i32*, i32** %6
store i32 %8, i32* %9
%10 = load i8*, i8** %4
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %5
%15 = call i32 @numeric_arg(i8** %14, i32 2)
%16 = load i8**, i8*** %5
%17 = call i32 @numeric_arg(i8** %16, i32 3)
%18 = load i8**, i8*** %5
%19 = call i32 @optional_num(i8** %18, i32 4, i32 -1)
%20 = load i8**, i8*** %5
%21 = call i32 @optional_num(i8** %20, i32 5, i32 -1)
%22 = load i8**, i8*** %5
%23 = call i32 @optional_num(i8** %22, i32 6, i32 -1)
%24 = call i32 @dialog_calendar(i8* %10, i8* %13, i32 %15, i32 %17, i32 %19, i32 %21, i32 %23)
ret i32 %24
}

LLVM IR (-O2):
define i32 @call_calendar(i8* %0, i8** %1, i32* nocapture writeonly %2) {
%4 = tail call i32 @arg_rest(i8** %1)
store i32 %4, i32* %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @numeric_arg(i8** %1, i32 2)
%8 = tail call i32 @numeric_arg(i8** %1, i32 3)
%9 = tail call i32 @optional_num(i8** %1, i32 4, i32 -1)
%10 = tail call i32 @optional_num(i8** %1, i32 5, i32 -1)
%11 = tail call i32 @optional_num(i8** %1, i32 6, i32 -1)
%12 = tail call i32 @dialog_calendar(i8* %0, i8* %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11)
ret i32 %12
}