#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 */
struct passwd {
  char *pw_name;
};

/* Variables and functions */
int EOF;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getegid();
int /*<<< orphan*/ geteuid();
int /*<<< orphan*/ getgid();
int getopt(int, char **, char *);
struct passwd *getpwuid(scalar_t__);
scalar_t__ getuid();
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int optind;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *, int, scalar_t__);
int /*<<< orphan*/ unsetenv(char *);
int /*<<< orphan*/ wall(char *, int);
int main(int argc, char **argv) {
  char buf[4096];
  char line[83];
  int i, f, ch;
  int len = 0;
  int remote = 0;
  char *p;
  char *whoami;
  struct passwd *pwd;
  buf[0] = 0;
  if ((pwd = getpwuid(getuid())) == NULL) {
    if (getuid() == 0)
      whoami = "root";
    else {
      fprintf(stderr, "You don't exist. Go away.\n");
      exit(1);
    }
  } else
    whoami = pwd->pw_name;
  while ((ch = getopt(argc, argv, "n")) != EOF)
    switch (ch) {
    case 'n':
      if (geteuid() != 0 && getgid() != getegid()) {
        fprintf(stderr, "wall -n: not priviliged\n");
        exit(1);
      }
      remote = 1;
      break;
    default:
      fprintf(stderr, "usage: wall [message]\n");
      return 1;
      break;
    }
  if ((argc - optind) > 0) {
    for (f = optind; f < argc; f++) {
      len += strlen(argv[f]) + 1;
      if (len >= 4096 - 2)
        break;
      strcat(buf, argv[f]);
      if (f < argc - 1)
        strcat(buf, " ");
    }
    strcat(buf, "\r\n");
  } else {
    while (fgets(line, 80, stdin)) {
      for (p = line; *p && *p != '\r' && *p != '\n'; p++)
        ;
      strcpy(p, "\r\n");
      len += strlen(line);
      if (len >= 4096)
        break;
      strcat(buf, line);
    }
  }
  i = 0;
  for (p = buf; *p; p++) {
    if (*p == '\n' && ++i >= 20) {
      *++p = 0;
      break;
    }
  }
  openlog("wall", LOG_PID, LOG_USER);
  syslog(LOG_INFO, "wall: user %s broadcasted %d lines (%zu chars)", whoami, i,
         strlen(buf));
  closelog();
  unsetenv("TZ");
  wall(buf, remote);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1080(%rbp)
movl   $0x0,-0x1084(%rbp)
movb   $0x0,-0x1010(%rbp)
mov    $0x0,%al
call   1070 <getuid@plt>
mov    %rax,%rdi
call   1050 <getpwuid@plt>
mov    %rax,-0x10a0(%rbp)
cmp    $0x0,%rax
jne    12ac <main+0x9c>
mov    $0x0,%al
call   1070 <getuid@plt>
cmp    $0x0,%rax
jne    1288 <main+0x78>
lea    0xd84(%rip),%rax
mov    %rax,-0x1098(%rbp)
jmp    12a7 <main+0x97>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
lea    0xd6d(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
jmp    12bd <main+0xad>
mov    -0x10a0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x1098(%rbp)
jmp    12c2 <main+0xb2>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd50(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x107c(%rbp)
mov    0x2cf6(%rip),%rcx
cmp    (%rcx),%eax
je     1386 <main+0x176>
mov    -0x107c(%rbp),%eax
sub    $0x6e,%eax
jne    1360 <main+0x150>
jmp    12fe <main+0xee>
mov    $0x0,%al
call   1080 <geteuid@plt>
cmp    $0x0,%eax
je     1351 <main+0x141>
mov    $0x0,%al
call   10c0 <getgid@plt>
mov    %eax,-0x10a4(%rbp)
mov    $0x0,%al
call   10e0 <getegid@plt>
mov    %eax,%ecx
mov    -0x10a4(%rbp),%eax
cmp    %ecx,%eax
je     1351 <main+0x141>
mov    0x2c7f(%rip),%rax
mov    (%rax),%edi
lea    0xce0(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
movl   $0x1,-0x1084(%rbp)
jmp    1381 <main+0x171>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16b0 <main+0x4a0>
jmp    12c2 <main+0xb2>
mov    -0x8(%rbp),%eax
mov    0x2c40(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x0,%eax
jle    146c <main+0x25c>
mov    0x2c2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1078(%rbp)
mov    -0x1078(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1454 <main+0x244>
mov    -0x10(%rbp),%rax
movslq -0x1078(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
add    $0x1,%rcx
movslq -0x1080(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1080(%rbp)
cmpl   $0xffe,-0x1080(%rbp)
jl     13f9 <main+0x1e9>
jmp    1454 <main+0x244>
lea    -0x1010(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1078(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1110 <strcat@plt>
mov    -0x1078(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    143b <main+0x22b>
lea    -0x1010(%rbp),%rdi
lea    0xc1c(%rip),%rsi
call   1110 <strcat@plt>
jmp    1440 <main+0x230>
mov    -0x1078(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1078(%rbp)
jmp    13aa <main+0x19a>
lea    -0x1010(%rbp),%rdi
lea    0xbf2(%rip),%rsi
call   1110 <strcat@plt>
jmp    1582 <main+0x372>
jmp    1471 <main+0x261>
lea    -0x1070(%rbp),%rdi
mov    0x2b61(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     157d <main+0x36d>
lea    -0x1070(%rbp),%rax
mov    %rax,-0x1090(%rbp)
mov    -0x1090(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x10a5(%rbp)
je     14ef <main+0x2df>
mov    -0x1090(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x10a5(%rbp)
je     14ef <main+0x2df>
mov    -0x1090(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x10a5(%rbp)
mov    -0x10a5(%rbp),%al
test   $0x1,%al
jne    1502 <main+0x2f2>
jmp    151e <main+0x30e>
jmp    1507 <main+0x2f7>
mov    -0x1090(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1090(%rbp)
jmp    14a3 <main+0x293>
mov    -0x1090(%rbp),%rdi
lea    0xb28(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x1070(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
movslq -0x1080(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1080(%rbp)
cmpl   $0x1000,-0x1080(%rbp)
jl     1565 <main+0x355>
jmp    157d <main+0x36d>
lea    -0x1010(%rbp),%rdi
lea    -0x1070(%rbp),%rsi
call   1110 <strcat@plt>
jmp    1471 <main+0x261>
jmp    1582 <main+0x372>
movl   $0x0,-0x1074(%rbp)
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1090(%rbp)
mov    -0x1090(%rbp),%rax
cmpb   $0x0,(%rax)
je     160f <main+0x3ff>
mov    -0x1090(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    15f3 <main+0x3e3>
mov    -0x1074(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1074(%rbp)
cmp    $0x14,%eax
jl     15f3 <main+0x3e3>
mov    -0x1090(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x1090(%rbp)
movb   $0x0,0x1(%rax)
jmp    160f <main+0x3ff>
jmp    15f8 <main+0x3e8>
mov    -0x1090(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1090(%rbp)
jmp    159a <main+0x38a>
mov    0x29aa(%rip),%rax
mov    (%rax),%esi
mov    0x29c9(%rip),%rax
mov    (%rax),%edx
lea    0xa2f(%rip),%rdi
call   1120 <openlog@plt>
mov    0x297c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10bc(%rbp)
mov    -0x1098(%rbp),%rax
mov    %rax,-0x10b8(%rbp)
mov    -0x1074(%rbp),%eax
mov    %eax,-0x10ac(%rbp)
lea    -0x1010(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x10bc(%rbp),%edi
mov    -0x10b8(%rbp),%rdx
mov    -0x10ac(%rbp),%ecx
mov    %rax,%r8
lea    0x9dd(%rip),%rsi
call   10d0 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
lea    0x9f9(%rip),%rdi
call   1100 <unsetenv@plt>
lea    -0x1010(%rbp),%rdi
mov    -0x1084(%rbp),%esi
call   10b0 <wall@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1078,%rsp
mov    %rsi,%r13
mov    %edi,%ebp
movb   $0x0,0x70(%rsp)
xor    %eax,%eax
call   1070 <getuid@plt>
mov    %rax,%rdi
call   1050 <getpwuid@plt>
test   %rax,%rax
je     1244 <main+0x34>
mov    (%rax),%r12
jmp    125b <main+0x4b>
xor    %eax,%eax
call   1070 <getuid@plt>
test   %rax,%rax
jne    14f3 <main+0x2e3>
lea    0xda5(%rip),%r12
lea    0xdbe(%rip),%rdx
mov    %ebp,%edi
mov    %r13,%rsi
call   10f0 <getopt@plt>
mov    0x2d65(%rip),%r14
xor    %ecx,%ecx
cmp    (%r14),%eax
je     1309 <main+0xf9>
lea    0xd9b(%rip),%r15
jmp    12a2 <main+0x92>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r15,%rdx
call   10f0 <getopt@plt>
cmp    (%r14),%eax
je     1304 <main+0xf4>
cmp    $0x6e,%eax
jne    12e5 <main+0xd5>
xor    %eax,%eax
call   1080 <geteuid@plt>
test   %eax,%eax
je     1290 <main+0x80>
xor    %eax,%eax
call   10c0 <getgid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10e0 <getegid@plt>
cmp    %eax,%ebx
je     1290 <main+0x80>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
lea    0xd4c(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
lea    0xd46(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%ebx
jmp    14df <main+0x2cf>
mov    $0x1,%ecx
mov    %ecx,0x4(%rsp)
mov    %r12,0x8(%rsp)
mov    0x2cb7(%rip),%rax
movslq (%rax),%r15
cmp    %ebp,%r15d
jge    1387 <main+0x177>
lea    -0x1(%rbp),%eax
movslq %eax,%rbx
sub    %r15d,%ebp
xor    %r12d,%r12d
jmp    133d <main+0x12d>
nop
add    $0x1,%r15
add    $0xffffffff,%ebp
je     1423 <main+0x213>
mov    0x0(%r13,%r15,8),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
movslq %r12d,%rcx
lea    (%rcx,%rax,1),%r12
add    $0x1,%r12
cmp    $0xffd,%r12d
jg     1423 <main+0x213>
lea    0x70(%rsp),%rdi
mov    %r14,%rsi
call   1110 <strcat@plt>
cmp    %rbx,%r15
jge    1330 <main+0x120>
lea    0x70(%rsp),%rdi
lea    0xcd2(%rip),%rsi
call   1110 <strcat@plt>
jmp    1330 <main+0x120>
mov    0x2c52(%rip),%r14
mov    (%r14),%edx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x50,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1434 <main+0x224>
xor    %ebp,%ebp
mov    $0x2401,%ebx
lea    0xc9a(%rip),%r13
lea    0x70(%rsp),%r12
nop
mov    %r15,%rdi
jmp    13d4 <main+0x1c4>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0xd,%rax
ja     13d0 <main+0x1c0>
bt     %rax,%rbx
jae    13d0 <main+0x1c0>
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
movslq %ebp,%rbp
add    %rax,%rbp
cmp    $0xfff,%ebp
jg     1434 <main+0x224>
mov    %r12,%rdi
mov    %r15,%rsi
call   1110 <strcat@plt>
mov    (%r14),%edx
mov    %r15,%rdi
mov    $0x50,%esi
call   1090 <fgets@plt>
test   %rax,%rax
jne    13c0 <main+0x1b0>
jmp    1434 <main+0x224>
lea    0xc2a(%rip),%rsi
lea    0x70(%rsp),%rdi
call   1110 <strcat@plt>
lea    0x71(%rsp),%rax
xor    %ecx,%ecx
mov    0x8(%rsp),%r15
jmp    1458 <main+0x248>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %dl,%dl
je     146d <main+0x25d>
add    $0x1,%rax
movzbl -0x1(%rax),%edx
cmp    $0xa,%dl
jne    1450 <main+0x240>
lea    0x1(%rcx),%ebx
cmp    $0x13,%ecx
jge    1471 <main+0x261>
mov    %ebx,%ecx
jmp    1454 <main+0x244>
mov    %ecx,%ebx
jmp    1474 <main+0x264>
movb   $0x0,(%rax)
mov    0x2b45(%rip),%rax
mov    (%rax),%esi
mov    0x2b64(%rip),%rax
mov    (%rax),%edx
lea    0xbca(%rip),%rdi
call   1120 <openlog@plt>
mov    0x2b17(%rip),%rax
mov    (%rax),%ebp
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    0xbad(%rip),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
mov    %ebx,%ecx
mov    %rax,%r8
call   10d0 <syslog@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <closelog@plt>
lea    0xbbd(%rip),%rdi
call   1100 <unsetenv@plt>
mov    %r14,%rdi
mov    0x4(%rsp),%esi
call   10b0 <wall@plt>
mov    %ebx,%eax
add    $0x1078,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2abe(%rip),%rax
mov    (%rax),%edi
lea    0xb02(%rip),%rsi
jmp    12d6 <main+0xc6>

LLVM IR (-O0):
%struct.passwd = type { i8* }
@.str = [5 x i8] c"root\00"
@stderr = global i32 0
@.str.1 = [27 x i8] c"You don't exist. Go away.\0A\00"
@.str.2 = [2 x i8] c"n\00"
@EOF = global i32 0
@.str.3 = [25 x i8] c"wall -n: not priviliged\0A\00"
@.str.4 = [23 x i8] c"usage: wall [message]\0A\00"
@optind = global i32 0
@.str.5 = [2 x i8] c" \00"
@.str.6 = [3 x i8] c"\0D\0A\00"
@stdin = global i32 0
@.str.7 = [5 x i8] c"wall\00"
@LOG_PID = global i32 0
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str.8 = [47 x i8] c"wall: user %s broadcasted %d lines (%zu chars)\00"
@.str.9 = [3 x i8] c"TZ\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca [83 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca %struct.passwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
store i32 0, i32* %12
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
store i8 0, i8* %16
%17 = call i64 (...) @getuid()
%18 = call %struct.passwd* @getpwuid(i64 %17)
store %struct.passwd* %18, %struct.passwd** %15
%19 = icmp eq %struct.passwd* %18, null
br i1 %19, label %20, label %29
20: ; preds = %2
%21 = call i64 (...) @getuid()
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %14
br label %28
24: ; preds = %20
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %23
br label %33
29: ; preds = %2
%30 = load %struct.passwd*, %struct.passwd** %15
%31 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i32 0, i32 0
%32 = load i8*, i8** %31
store i8* %32, i8** %14
br label %33
33: ; preds = %29, %28
br label %34
34: ; preds = %57, %33
%35 = load i32, i32* %4
%36 = load i8**, i8*** %5
%37 = call i32 @getopt(i32 %35, i8** %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 %37, i32* %10
%38 = load i32, i32* @EOF
%39 = icmp ne i32 %37, %38
br i1 %39, label %40, label %58
40: ; preds = %34
%41 = load i32, i32* %10
switch i32 %41, label %54 [
i32 110, label %42
]
42: ; preds = %40
%43 = call i32 (...) @geteuid()
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %42
%46 = call i32 (...) @getgid()
%47 = call i32 (...) @getegid()
%48 = icmp ne i32 %46, %47
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %45, %42
store i32 1, i32* %12
br label %57
54: ; preds = %40
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %189
57: ; preds = %53
br label %34
58: ; preds = %34
%59 = load i32, i32* %4
%60 = load i32, i32* @optind
%61 = sub nsw i32 %59, %60
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %106
63: ; preds = %58
%64 = load i32, i32* @optind
store i32 %64, i32* %9
br label %65
65: ; preds = %100, %63
%66 = load i32, i32* %9
%67 = load i32, i32* %4
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %103
69: ; preds = %65
%70 = load i8**, i8*** %5
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %70, i64 %72
%74 = load i8*, i8** %73
%75 = call i64 @strlen(i8* %74)
%76 = add nsw i64 %75, 1
%77 = load i32, i32* %11
%78 = sext i32 %77 to i64
%79 = add nsw i64 %78, %76
%80 = trunc i64 %79 to i32
store i32 %80, i32* %11
%81 = load i32, i32* %11
%82 = icmp sge i32 %81, 4094
br i1 %82, label %83, label %84
83: ; preds = %69
br label %103
84: ; preds = %69
%85 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%86 = load i8**, i8*** %5
%87 = load i32, i32* %9
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @strcat(i8* %85, i8* %90)
%92 = load i32, i32* %9
%93 = load i32, i32* %4
%94 = sub nsw i32 %93, 1
%95 = icmp slt i32 %92, %94
br i1 %95, label %96, label %99
96: ; preds = %84
%97 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%98 = call i32 @strcat(i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %99
99: ; preds = %96, %84
br label %100
100: ; preds = %99
%101 = load i32, i32* %9
%102 = add nsw i32 %101, 1
store i32 %102, i32* %9
br label %65
103: ; preds = %83, %65
%104 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%105 = call i32 @strcat(i8* %104, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %152
106: ; preds = %58
br label %107
107: ; preds = %147, %106
%108 = getelementptr inbounds [83 x i8], [83 x i8]* %7, i64 0, i64 0
%109 = load i32, i32* @stdin
%110 = call i64 @fgets(i8* %108, i32 80, i32 %109)
%111 = icmp ne i64 %110, 0
br i1 %111, label %112, label %151
112: ; preds = %107
%113 = getelementptr inbounds [83 x i8], [83 x i8]* %7, i64 0, i64 0
store i8* %113, i8** %13
br label %114
114: ; preds = %132, %112
%115 = load i8*, i8** %13
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %129
119: ; preds = %114
%120 = load i8*, i8** %13
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp ne i32 %122, 13
br i1 %123, label %124, label %129
124: ; preds = %119
%125 = load i8*, i8** %13
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
%128 = icmp ne i32 %127, 10
br label %129
129: ; preds = %124, %119, %114
%130 = phi i1 [ false, %119 ], [ false, %114 ], [ %128, %124 ]
br i1 %130, label %131, label %135
131: ; preds = %129
br label %132
132: ; preds = %131
%133 = load i8*, i8** %13
%134 = getelementptr inbounds i8, i8* %133, i32 1
store i8* %134, i8** %13
br label %114
135: ; preds = %129
%136 = load i8*, i8** %13
%137 = call i32 @strcpy(i8* %136, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%138 = getelementptr inbounds [83 x i8], [83 x i8]* %7, i64 0, i64 0
%139 = call i64 @strlen(i8* %138)
%140 = load i32, i32* %11
%141 = sext i32 %140 to i64
%142 = add nsw i64 %141, %139
%143 = trunc i64 %142 to i32
store i32 %143, i32* %11
%144 = load i32, i32* %11
%145 = icmp sge i32 %144, 4096
br i1 %145, label %146, label %147
146: ; preds = %135
br label %151
147: ; preds = %135
%148 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%149 = getelementptr inbounds [83 x i8], [83 x i8]* %7, i64 0, i64 0
%150 = call i32 @strcat(i8* %148, i8* %149)
br label %107
151: ; preds = %146, %107
br label %152
152: ; preds = %151, %103
store i32 0, i32* %8
%153 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
store i8* %153, i8** %13
br label %154
154: ; preds = %171, %152
%155 = load i8*, i8** %13
%156 = load i8, i8* %155
%157 = icmp ne i8 %156, 0
br i1 %157, label %158, label %174
158: ; preds = %154
%159 = load i8*, i8** %13
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp eq i32 %161, 10
br i1 %162, label %163, label %170
163: ; preds = %158
%164 = load i32, i32* %8
%165 = add nsw i32 %164, 1
store i32 %165, i32* %8
%166 = icmp sge i32 %165, 20
br i1 %166, label %167, label %170
167: ; preds = %163
%168 = load i8*, i8** %13
%169 = getelementptr inbounds i8, i8* %168, i32 1
store i8* %169, i8** %13
store i8 0, i8* %169
br label %174
170: ; preds = %163, %158
br label %171
171: ; preds = %170
%172 = load i8*, i8** %13
%173 = getelementptr inbounds i8, i8* %172, i32 1
store i8* %173, i8** %13
br label %154
174: ; preds = %167, %154
%175 = load i32, i32* @LOG_PID
%176 = load i32, i32* @LOG_USER
%177 = call i32 @openlog(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %175, i32 %176)
%178 = load i32, i32* @LOG_INFO
%179 = load i8*, i8** %14
%180 = load i32, i32* %8
%181 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%182 = call i64 @strlen(i8* %181)
%183 = call i32 @syslog(i32 %178, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i8* %179, i32 %180, i64 %182)
%184 = call i32 (...) @closelog()
%185 = call i32 @unsetenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%186 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%187 = load i32, i32* %12
%188 = call i32 @wall(i8* %186, i32 %187)
store i32 0, i32* %3
br label %189
189: ; preds = %174, %54
%190 = load i32, i32* %3
ret i32 %190
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
@.str = [5 x i8] c"root\00"
@stderr = global i32 0
@.str.1 = [27 x i8] c"You don't exist. Go away.\0A\00"
@.str.2 = [2 x i8] c"n\00"
@EOF = global i32 0
@.str.3 = [25 x i8] c"wall -n: not priviliged\0A\00"
@.str.4 = [23 x i8] c"usage: wall [message]\0A\00"
@optind = global i32 0
@.str.5 = [2 x i8] c" \00"
@.str.6 = [3 x i8] c"\0D\0A\00"
@stdin = global i32 0
@.str.7 = [5 x i8] c"wall\00"
@LOG_PID = global i32 0
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str.8 = [47 x i8] c"wall: user %s broadcasted %d lines (%zu chars)\00"
@.str.9 = [3 x i8] c"TZ\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
%4 = alloca [83 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [83 x i8], [83 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
%7 = tail call i64 (...) @getuid()
%8 = tail call %struct.passwd* @getpwuid(i64 %7)
%9 = icmp eq %struct.passwd* %8, null
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = tail call i64 (...) @getuid()
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds %struct.passwd, %struct.passwd* %8, i64 0, i32 0
%19 = load i8*, i8** %18
br label %20
20: ; preds = %10, %17
%21 = phi i8* [ %19, %17 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %10 ]
%22 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %46, label %25
25: ; preds = %20, %39
%26 = phi i32 [ %40, %39 ], [ %22, %20 ]
%27 = icmp eq i32 %26, 110
br i1 %27, label %28, label %43
28: ; preds = %25
%29 = tail call i32 (...) @geteuid()
%30 = icmp eq i32 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %28
%32 = tail call i32 (...) @getgid()
%33 = tail call i32 (...) @getegid()
%34 = icmp eq i32 %32, %33
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %31, %28
%40 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %46, label %25
43: ; preds = %25
%44 = load i32, i32* @stderr
%45 = tail call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %125
46: ; preds = %39, %20
%47 = phi i32 [ 0, %20 ], [ 1, %39 ]
%48 = load i32, i32* @optind
%49 = icmp slt i32 %48, %0
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = load i32, i32* @stdin
%52 = call i64 @fgets(i8* %6, i32 80, i32 %51)
%53 = icmp eq i64 %52, 0
br i1 %53, label %101, label %81
54: ; preds = %46
%55 = add nsw i32 %0, -1
%56 = sext i32 %48 to i64
%57 = sext i32 %55 to i64
br label %58
58: ; preds = %54, %75
%59 = phi i64 [ %56, %54 ], [ %76, %75 ]
%60 = phi i64 [ 0, %54 ], [ %67, %75 ]
%61 = getelementptr inbounds i8*, i8** %1, i64 %59
%62 = load i8*, i8** %61
%63 = call i64 @strlen(i8* dereferenceable(1) %62)
%64 = shl i64 %60, 32
%65 = ashr exact i64 %64, 32
%66 = add nsw i64 %65, 1
%67 = add i64 %66, %63
%68 = trunc i64 %67 to i32
%69 = icmp sgt i32 %68, 4093
br i1 %69, label %79, label %70
70: ; preds = %58
%71 = call i32 @strcat(i8* %5, i8* %62)
%72 = icmp slt i64 %59, %57
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %75
75: ; preds = %70, %73
%76 = add nsw i64 %59, 1
%77 = trunc i64 %76 to i32
%78 = icmp eq i32 %77, %0
br i1 %78, label %79, label %58
79: ; preds = %75, %58
%80 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %101
81: ; preds = %50, %96
%82 = phi i64 [ %93, %96 ], [ 0, %50 ]
br label %83
83: ; preds = %81, %86
%84 = phi i8* [ %87, %86 ], [ %6, %81 ]
%85 = load i8, i8* %84
switch i8 %85, label %86 [
i8 0, label %88
i8 13, label %88
i8 10, label %88
]
86: ; preds = %83
%87 = getelementptr inbounds i8, i8* %84, i64 1
br label %83
88: ; preds = %83, %83, %83
%89 = call i32 @strcpy(i8* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%90 = call i64 @strlen(i8* %6)
%91 = shl i64 %82, 32
%92 = ashr exact i64 %91, 32
%93 = add nsw i64 %90, %92
%94 = trunc i64 %93 to i32
%95 = icmp sgt i32 %94, 4095
br i1 %95, label %101, label %96
96: ; preds = %88
%97 = call i32 @strcat(i8* %5, i8* %6)
%98 = load i32, i32* @stdin
%99 = call i64 @fgets(i8* %6, i32 80, i32 %98)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %81
101: ; preds = %88, %96, %50, %79
br label %102
102: ; preds = %101, %111
%103 = phi i32 [ %112, %111 ], [ 0, %101 ]
%104 = phi i8* [ %113, %111 ], [ %5, %101 ]
%105 = load i8, i8* %104
switch i8 %105, label %111 [
i8 0, label %114
i8 10, label %106
]
106: ; preds = %102
%107 = add nsw i32 %103, 1
%108 = icmp sgt i32 %103, 18
br i1 %108, label %109, label %111
109: ; preds = %106
%110 = getelementptr inbounds i8, i8* %104, i64 1
store i8 0, i8* %110
br label %114
111: ; preds = %102, %106
%112 = phi i32 [ %107, %106 ], [ %103, %102 ]
%113 = getelementptr inbounds i8, i8* %104, i64 1
br label %102
114: ; preds = %102, %109
%115 = phi i32 [ %107, %109 ], [ %103, %102 ]
%116 = load i32, i32* @LOG_PID
%117 = load i32, i32* @LOG_USER
%118 = call i32 @openlog(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %116, i32 %117)
%119 = load i32, i32* @LOG_INFO
%120 = call i64 @strlen(i8* %5)
%121 = call i32 @syslog(i32 %119, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i8* %21, i32 %115, i64 %120)
%122 = call i32 (...) @closelog()
%123 = call i32 @unsetenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%124 = call i32 @wall(i8* %5, i32 %47)
br label %125
125: ; preds = %114, %43
%126 = phi i32 [ 1, %43 ], [ 0, %114 ]
ret i32 %126
}