#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
void send_mail(const char *from, const char *to, const char *subject,
               const char *ip, const char *comment, const char *name,
               const char *url) {
  FILE *email = popen("/usr/sbin/sendmail -t -oi", "w");
  fprintf(email, "Subject: %s\n", subject);
  fprintf(email, "To: %s\n", to);
  fprintf(email, "From: %s\n", from);
  fprintf(email, "Content-type: text/plain\n\n");
  fprintf(email, "A new comment has been submited.\n");
  fprintf(email, "Name : %s\n", name);
  fprintf(email, "URL : %s\n", url);
  fprintf(email, "IP : %s\n", ip);
  fprintf(email, "Comment :\n");
  fprintf(email, "%s\n", comment);
  pclose(email);
  return;
}


x86 assembly (clang, -O0):
<send_mail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xea5(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%rdx
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <pclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_mail>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r13
mov    %r8,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbp
mov    0x50(%rsp),%r12
lea    0xe90(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,%rbx
lea    0xe96(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe79(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe7b(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe64(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe3e(%rip),%rsi
mov    %rbx,%rdi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <pclose@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"/usr/sbin/sendmail -t -oi\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [13 x i8] c"Subject: %s\0A\00"
@.str.3 = [8 x i8] c"To: %s\0A\00"
@.str.4 = [10 x i8] c"From: %s\0A\00"
@.str.5 = [27 x i8] c"Content-type: text/plain\0A\0A\00"
@.str.6 = [34 x i8] c"A new comment has been submited.\0A\00"
@.str.7 = [11 x i8] c"Name : %s\0A\00"
@.str.8 = [10 x i8] c"URL : %s\0A\00"
@.str.9 = [9 x i8] c"IP : %s\0A\00"
@.str.10 = [11 x i8] c"Comment :\0A\00"
@.str.11 = [4 x i8] c"%s\0A\00"
define void @send_mail(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i8* %6, i8** %14
%16 = call i32* @popen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %15
%17 = load i32*, i32** %15
%18 = load i8*, i8** %10
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i32*, i32** %15
%21 = load i8*, i8** %9
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = load i32*, i32** %15
%24 = load i8*, i8** %8
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = load i32*, i32** %15
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32*, i32** %15
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%30 = load i32*, i32** %15
%31 = load i8*, i8** %13
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %31)
%33 = load i32*, i32** %15
%34 = load i8*, i8** %14
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %34)
%36 = load i32*, i32** %15
%37 = load i8*, i8** %11
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %37)
%39 = load i32*, i32** %15
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%41 = load i32*, i32** %15
%42 = load i8*, i8** %12
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %42)
%44 = load i32*, i32** %15
%45 = call i32 @pclose(i32* %44)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"/usr/sbin/sendmail -t -oi\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [13 x i8] c"Subject: %s\0A\00"
@.str.3 = [8 x i8] c"To: %s\0A\00"
@.str.4 = [10 x i8] c"From: %s\0A\00"
@.str.5 = [27 x i8] c"Content-type: text/plain\0A\0A\00"
@.str.6 = [34 x i8] c"A new comment has been submited.\0A\00"
@.str.7 = [11 x i8] c"Name : %s\0A\00"
@.str.8 = [10 x i8] c"URL : %s\0A\00"
@.str.9 = [9 x i8] c"IP : %s\0A\00"
@.str.10 = [11 x i8] c"Comment :\0A\00"
@.str.11 = [4 x i8] c"%s\0A\00"
define void @send_mail(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = tail call i32* @popen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i64 26, i64 1, i32* %8)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i64 33, i64 1, i32* %8)
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %5)
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %6)
%16 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %3)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i64 10, i64 1, i32* %8)
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %4)
%19 = tail call i32 @pclose(i32* %8)
ret void
}