struct passwd *who(u)
char *u;
{
  struct passwd *pw;
  long id;
  char *ep;
  if (pw = getpwnam(u))
    return (pw);
  id = strtol(u, &ep, 10);
  if (*u && !*ep && (pw = getpwuid(id)))
    return (pw);
  errx(1, "%s: No such user", u);
}


x86 assembly (clang, -O0):
<who>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <getpwnam@plt>
cltq
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1174 <who+0x34>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <who+0xa6>
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11cf <who+0x8f>
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11cf <who+0x8f>
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <getpwuid@plt>
cltq
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11cf <who+0x8f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <who+0xa6>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1040 <errx@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<who>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <getpwnam@plt>
test   %eax,%eax
je     1157 <who+0x17>
cltq
jmp    118e <who+0x4e>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1060 <strtol@plt>
cmpb   $0x0,(%rbx)
je     1178 <who+0x38>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
je     1194 <who+0x54>
lea    0xe81(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <errx@plt>
add    $0x10,%rsp
pop    %rbx
ret
mov    %rax,%rdi
xor    %eax,%eax
call   1030 <getpwuid@plt>
test   %eax,%eax
jne    1153 <who+0x13>
jmp    1178 <who+0x38>

LLVM IR (-O0):
%struct.passwd = type opaque
@.str = [17 x i8] c"%s: No such user\00"
define %struct.passwd* @who(i8* %0) {
%2 = alloca %struct.passwd*
%3 = alloca i8*
%4 = alloca %struct.passwd*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @getpwnam to i32 (i8*, ...)*)(i8* %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to %struct.passwd*
store %struct.passwd* %10, %struct.passwd** %4
%11 = icmp ne %struct.passwd* %10, null
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = load %struct.passwd*, %struct.passwd** %4
store %struct.passwd* %13, %struct.passwd** %2
br label %36
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = call i64 @strtol(i8* %15, i8** %6, i32 10)
store i64 %16, i64* %5
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %33
21: ; preds = %14
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = load i64, i64* %5
%27 = call i32 (i64, ...) bitcast (i32 (...)* @getpwuid to i32 (i64, ...)*)(i64 %26)
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to %struct.passwd*
store %struct.passwd* %29, %struct.passwd** %4
%30 = icmp ne %struct.passwd* %29, null
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = load %struct.passwd*, %struct.passwd** %4
store %struct.passwd* %32, %struct.passwd** %2
br label %36
33: ; preds = %25, %21, %14
%34 = load i8*, i8** %3
%35 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @errx to i32 (i32, i8*, i8*, ...)*)(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %33, %31, %12
%37 = load %struct.passwd*, %struct.passwd** %2
ret %struct.passwd* %37
}

LLVM IR (-O2):
%struct.passwd = type opaque
@.str = [17 x i8] c"%s: No such user\00"
define %struct.passwd* @who(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getpwnam to i32 (i8*, ...)*)(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = inttoptr i64 %7 to %struct.passwd*
br label %25
9: ; preds = %1
%10 = call i64 @strtol(i8* %0, i8** %2, i32 10)
%11 = load i8, i8* %0
%12 = icmp eq i8 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = tail call i32 (i64, ...) bitcast (i32 (...)* @getpwuid to i32 (i64, ...)*)(i64 %10)
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = sext i32 %18 to i64
%22 = inttoptr i64 %21 to %struct.passwd*
br label %25
23: ; preds = %17, %13, %9
%24 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @errx to i32 (i32, i8*, i8*, ...)*)(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %25
25: ; preds = %23, %20, %6
%26 = phi %struct.passwd* [ %8, %6 ], [ undef, %23 ], [ %22, %20 ]
ret %struct.passwd* %26
}