#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*/ Logit(char *, char const *, ...);
int mail_spool(char *, char const *, char const *, char const *, void *);
int /*<<< orphan*/ safestring(char const *);
int mail_ast(const char *addr, const char *subj, const char *text) {
  int ret;
  char nbuf[1024];
  Logit("Mail_ast(%s,%s,%s)", addr, subj, text);
  if (!safestring(addr))
    return -1;
  ret = mail_spool(nbuf, addr, subj, text, ((void *)0));
  Logit("Mail_spool(%s) :=%d", nbuf, ret);
  return ret;
}


x86 assembly (clang, -O0):
<mail_ast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1050 <Logit@plt>
mov    -0x10(%rbp),%rdi
call   1040 <safestring@plt>
cmp    $0x0,%eax
jne    117f <mail_ast+0x4f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bd <mail_ast+0x8d>
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <mail_spool@plt>
mov    %eax,-0x24(%rbp)
lea    -0x430(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <Logit@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mail_ast>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <Logit@plt>
mov    %rbx,%rdi
call   1040 <safestring@plt>
test   %eax,%eax
je     1198 <mail_ast+0x68>
mov    %rsp,%r12
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
call   1030 <mail_spool@plt>
mov    %eax,%ebx
lea    0xe89(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <Logit@plt>
jmp    119d <mail_ast+0x6d>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Mail_ast(%s,%s,%s)\00"
@.str.1 = [20 x i8] c"Mail_spool(%s) :=%d\00"
define i32 @mail_ast(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [1024 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = call i32 (i8*, i8*, ...) @Logit(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @safestring(i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %3
store i32 -1, i32* %4
br label %28
18: ; preds = %3
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i32 @mail_spool(i8* %19, i8* %20, i8* %21, i8* %22, i8* null)
store i32 %23, i32* %8
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%25 = load i32, i32* %8
%26 = call i32 (i8*, i8*, ...) @Logit(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %25)
%27 = load i32, i32* %8
store i32 %27, i32* %4
br label %28
28: ; preds = %18, %17
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
@.str = [19 x i8] c"Mail_ast(%s,%s,%s)\00"
@.str.1 = [20 x i8] c"Mail_spool(%s) :=%d\00"
define i32 @mail_ast(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = tail call i32 (i8*, i8*, ...) @Logit(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%7 = tail call i32 @safestring(i8* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = call i32 @mail_spool(i8* %5, i8* %0, i8* %1, i8* %2, i8* null)
%11 = call i32 (i8*, i8*, ...) @Logit(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %10)
br label %12
12: ; preds = %3, %9
%13 = phi i32 [ %10, %9 ], [ -1, %3 ]
ret i32 %13
}