bulkmail(argc, argv, from) char **argv, *from;
{
  extern fin, fout;
  int tbuf[2];
  register c;
  fin = 0;
  (&fin)[1] = 0;
  time(tbuf);
  printf("From %s %s", from, ctime(tbuf));
  while (c = getchar())
    putchar(c);
  putchar('\n');
  flush();
  close(fout);
  while (--argc > 0)
    sendto(*++argv);
  delexit();
}


x86 assembly (clang, -O0):
<bulkmail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e3e(%rip),%rax
movl   $0x0,(%rax)
mov    0x2e31(%rip),%rax
movl   $0x0,0x4(%rax)
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   10a0 <time@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1050 <ctime@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
je     1212 <bulkmail+0x82>
mov    -0x24(%rbp),%edi
mov    $0x0,%al
call   1040 <putchar@plt>
jmp    11f0 <bulkmail+0x60>
mov    $0xa,%edi
mov    $0x0,%al
call   1040 <putchar@plt>
mov    $0x0,%al
call   1030 <flush@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1080 <close@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1266 <bulkmail+0xd6>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1070 <sendto@plt>
jmp    1235 <bulkmail+0xa5>
mov    $0x0,%al
call   10b0 <delexit@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bulkmail>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e42(%rip),%rax
movq   $0x0,(%rax)
mov    %rsp,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <time@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <ctime@plt>
lea    0xe35(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <getchar@plt>
test   %eax,%eax
je     11f6 <bulkmail+0x66>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <putchar@plt>
jmp    11e0 <bulkmail+0x50>
mov    $0xa,%edi
xor    %eax,%eax
call   1040 <putchar@plt>
xor    %eax,%eax
call   1030 <flush@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
call   1080 <close@plt>
cmp    $0x2,%ebp
jl     1246 <bulkmail+0xb6>
add    $0x1,%ebp
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%rdi
xor    %eax,%eax
call   1070 <sendto@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
cmp    $0x2,%ebp
ja     1230 <bulkmail+0xa0>
xor    %eax,%eax
call   10b0 <delexit@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@fin = external global i32
@.str = [11 x i8] c"From %s %s\00"
@fout = external global i32
define i32 @bulkmail(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca [2 x i32]
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i32 0, i32* @fin
store i32 0, i32* getelementptr inbounds (i32, i32* @fin, i64 1)
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%11 = call i32 (i32*, ...) bitcast (i32 (...)* @time to i32 (i32*, ...)*)(i32* %10)
%12 = load i8*, i8** %7
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%14 = call i32 (i32*, ...) bitcast (i32 (...)* @ctime to i32 (i32*, ...)*)(i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %14)
br label %16
16: ; preds = %19, %3
%17 = call i32 (...) @getchar()
store i32 %17, i32* %9
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %9
%21 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %20)
br label %16
22: ; preds = %16
%23 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%24 = call i32 (...) @flush()
%25 = load i32, i32* @fout
%26 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %25)
br label %27
27: ; preds = %31, %22
%28 = load i32, i32* %5
%29 = add nsw i32 %28, -1
store i32 %29, i32* %5
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load i8**, i8*** %6
%33 = getelementptr inbounds i8*, i8** %32, i32 1
store i8** %33, i8*** %6
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @sendto to i32 (i8*, ...)*)(i8* %34)
br label %27
36: ; preds = %27
%37 = call i32 (...) @delexit()
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
@fin = external global i32
@.str = [11 x i8] c"From %s %s\00"
@fout = external global i32
define i32 @bulkmail(i32 %0, i8** nocapture %1, i8* %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
store i32 0, i32* @fin
store i32 0, i32* getelementptr inbounds (i32, i32* @fin, i64 1)
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%7 = call i32 (i32*, ...) bitcast (i32 (...)* @time to i32 (i32*, ...)*)(i32* %6)
%8 = call i32 (i32*, ...) bitcast (i32 (...)* @ctime to i32 (i32*, ...)*)(i32* %6)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %8)
%10 = call i32 (...) @getchar()
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %3, %12
%13 = phi i32 [ %15, %12 ], [ %10, %3 ]
%14 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %13)
%15 = call i32 (...) @getchar()
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %12
17: ; preds = %12, %3
%18 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%19 = call i32 (...) @flush()
%20 = load i32, i32* @fout
%21 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %20)
%22 = icmp sgt i32 %0, 1
br i1 %22, label %23, label %31
23: ; preds = %17, %23
%24 = phi i32 [ %26, %23 ], [ %0, %17 ]
%25 = phi i8** [ %27, %23 ], [ %1, %17 ]
%26 = add nsw i32 %24, -1
%27 = getelementptr inbounds i8*, i8** %25, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @sendto to i32 (i8*, ...)*)(i8* %28)
%30 = icmp ugt i32 %24, 2
br i1 %30, label %23, label %31
31: ; preds = %23, %17
%32 = call i32 (...) @delexit()
ret i32 undef
}