#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_passwd;
  char *pw_gecos;
  char *pw_dir;
  char *pw_shell;
};

/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void *strdup(char *);
int strlen(char *);
void copy_pwd_changes(struct passwd *dest, struct passwd *src, char *buffer,
                      size_t buflen) {
  if (src->pw_passwd != NULL && strlen(src->pw_passwd)) {
    if (buffer == NULL)
      dest->pw_passwd = strdup(src->pw_passwd);
    else if (dest->pw_passwd &&
             strlen(dest->pw_passwd) >= strlen(src->pw_passwd))
      strcpy(dest->pw_passwd, src->pw_passwd);
    else {
      dest->pw_passwd = buffer;
      strcpy(dest->pw_passwd, src->pw_passwd);
      buffer += strlen(dest->pw_passwd) + 1;
      buflen = buflen - (strlen(dest->pw_passwd) + 1);
    }
  }
  if (src->pw_gecos != NULL && strlen(src->pw_gecos)) {
    if (buffer == NULL)
      dest->pw_gecos = strdup(src->pw_gecos);
    else if (dest->pw_gecos && strlen(dest->pw_gecos) >= strlen(src->pw_gecos))
      strcpy(dest->pw_gecos, src->pw_gecos);
    else {
      dest->pw_gecos = buffer;
      strcpy(dest->pw_gecos, src->pw_gecos);
      buffer += strlen(dest->pw_gecos) + 1;
      buflen = buflen - (strlen(dest->pw_gecos) + 1);
    }
  }
  if (src->pw_dir != NULL && strlen(src->pw_dir)) {
    if (buffer == NULL)
      dest->pw_dir = strdup(src->pw_dir);
    else if (dest->pw_dir && strlen(dest->pw_dir) >= strlen(src->pw_dir))
      strcpy(dest->pw_dir, src->pw_dir);
    else {
      dest->pw_dir = buffer;
      strcpy(dest->pw_dir, src->pw_dir);
      buffer += strlen(dest->pw_dir) + 1;
      buflen = buflen - (strlen(dest->pw_dir) + 1);
    }
  }
  if (src->pw_shell != NULL && strlen(src->pw_shell)) {
    if (buffer == NULL)
      dest->pw_shell = strdup(src->pw_shell);
    else if (dest->pw_shell && strlen(dest->pw_shell) >= strlen(src->pw_shell))
      strcpy(dest->pw_shell, src->pw_shell);
    else {
      dest->pw_shell = buffer;
      strcpy(dest->pw_shell, src->pw_shell);
      buffer += strlen(dest->pw_shell) + 1;
      buflen = buflen - (strlen(dest->pw_shell) + 1);
    }
  }
}


x86 assembly (clang, -O0):
<copy_pwd_changes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     124d <copy_pwd_changes+0x11d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
je     124d <copy_pwd_changes+0x11d>
cmpq   $0x0,-0x18(%rbp)
jne    1191 <copy_pwd_changes+0x61>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1248 <copy_pwd_changes+0x118>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     11df <copy_pwd_changes+0xaf>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jl     11df <copy_pwd_changes+0xaf>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
jmp    1243 <copy_pwd_changes+0x113>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
add    $0x1,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1248 <copy_pwd_changes+0x118>
jmp    124d <copy_pwd_changes+0x11d>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1360 <copy_pwd_changes+0x230>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
je     1360 <copy_pwd_changes+0x230>
cmpq   $0x0,-0x18(%rbp)
jne    129a <copy_pwd_changes+0x16a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    135b <copy_pwd_changes+0x22b>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     12ed <copy_pwd_changes+0x1bd>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jl     12ed <copy_pwd_changes+0x1bd>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
jmp    1356 <copy_pwd_changes+0x226>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
add    $0x1,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    135b <copy_pwd_changes+0x22b>
jmp    1360 <copy_pwd_changes+0x230>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     1473 <copy_pwd_changes+0x343>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
je     1473 <copy_pwd_changes+0x343>
cmpq   $0x0,-0x18(%rbp)
jne    13ad <copy_pwd_changes+0x27d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
jmp    146e <copy_pwd_changes+0x33e>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     1400 <copy_pwd_changes+0x2d0>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jl     1400 <copy_pwd_changes+0x2d0>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
jmp    1469 <copy_pwd_changes+0x339>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
add    $0x1,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    146e <copy_pwd_changes+0x33e>
jmp    1473 <copy_pwd_changes+0x343>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x18(%rax)
je     1586 <copy_pwd_changes+0x456>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
je     1586 <copy_pwd_changes+0x456>
cmpq   $0x0,-0x18(%rbp)
jne    14c0 <copy_pwd_changes+0x390>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
jmp    1581 <copy_pwd_changes+0x451>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x18(%rax)
je     1513 <copy_pwd_changes+0x3e3>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jl     1513 <copy_pwd_changes+0x3e3>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
jmp    157c <copy_pwd_changes+0x44c>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
add    $0x1,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1581 <copy_pwd_changes+0x451>
jmp    1586 <copy_pwd_changes+0x456>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_pwd_changes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
test   %rdi,%rdi
je     11b5 <copy_pwd_changes+0x85>
call   1040 <strlen@plt>
test   %eax,%eax
je     11b5 <copy_pwd_changes+0x85>
test   %r15,%r15
je     119a <copy_pwd_changes+0x6a>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1171 <copy_pwd_changes+0x41>
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    (%rbx),%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    11aa <copy_pwd_changes+0x7a>
mov    %r15,(%r14)
mov    (%rbx),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    (%r14),%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%r15
add    $0x1,%r15
mov    (%r14),%rdi
call   1040 <strlen@plt>
jmp    11b5 <copy_pwd_changes+0x85>
mov    (%rbx),%rdi
call   1050 <strdup@plt>
mov    %rax,(%r14)
xor    %r15d,%r15d
jmp    11b5 <copy_pwd_changes+0x85>
mov    (%r14),%rdi
mov    (%rbx),%rsi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     1235 <copy_pwd_changes+0x105>
call   1040 <strlen@plt>
test   %eax,%eax
je     1235 <copy_pwd_changes+0x105>
test   %r15,%r15
je     1216 <copy_pwd_changes+0xe6>
mov    0x8(%r14),%rdi
test   %rdi,%rdi
je     11e9 <copy_pwd_changes+0xb9>
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    1228 <copy_pwd_changes+0xf8>
mov    %r15,0x8(%r14)
mov    0x8(%rbx),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x8(%r14),%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%r15
add    $0x1,%r15
mov    0x8(%r14),%rdi
call   1040 <strlen@plt>
jmp    1235 <copy_pwd_changes+0x105>
mov    0x8(%rbx),%rdi
call   1050 <strdup@plt>
mov    %rax,0x8(%r14)
xor    %r15d,%r15d
jmp    1235 <copy_pwd_changes+0x105>
mov    0x8(%r14),%rdi
mov    0x8(%rbx),%rsi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rdi
test   %rdi,%rdi
je     12b5 <copy_pwd_changes+0x185>
call   1040 <strlen@plt>
test   %eax,%eax
je     12b5 <copy_pwd_changes+0x185>
test   %r15,%r15
je     1296 <copy_pwd_changes+0x166>
mov    0x10(%r14),%rdi
test   %rdi,%rdi
je     1269 <copy_pwd_changes+0x139>
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    12a8 <copy_pwd_changes+0x178>
mov    %r15,0x10(%r14)
mov    0x10(%rbx),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x10(%r14),%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%r15
add    $0x1,%r15
mov    0x10(%r14),%rdi
call   1040 <strlen@plt>
jmp    12b5 <copy_pwd_changes+0x185>
mov    0x10(%rbx),%rdi
call   1050 <strdup@plt>
mov    %rax,0x10(%r14)
xor    %r15d,%r15d
jmp    12b5 <copy_pwd_changes+0x185>
mov    0x10(%r14),%rdi
mov    0x10(%rbx),%rsi
call   1030 <strcpy@plt>
mov    0x18(%rbx),%rdi
test   %rdi,%rdi
je     1322 <copy_pwd_changes+0x1f2>
call   1040 <strlen@plt>
test   %eax,%eax
je     1322 <copy_pwd_changes+0x1f2>
test   %r15,%r15
je     1315 <copy_pwd_changes+0x1e5>
mov    0x18(%r14),%rdi
test   %rdi,%rdi
je     12e9 <copy_pwd_changes+0x1b9>
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    132d <copy_pwd_changes+0x1fd>
mov    %r15,0x18(%r14)
mov    0x18(%rbx),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x18(%r14),%rdi
call   1040 <strlen@plt>
mov    0x18(%r14),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <strlen@plt>
mov    0x18(%rbx),%rdi
call   1050 <strdup@plt>
mov    %rax,0x18(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x18(%r14),%rdi
mov    0x18(%rbx),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
%struct.passwd = type { i8*, i8*, i8*, i8* }
define void @copy_pwd_changes(%struct.passwd* %0, %struct.passwd* %1, i8* %2, i64 %3) {
%5 = alloca %struct.passwd*
%6 = alloca %struct.passwd*
%7 = alloca i8*
%8 = alloca i64
store %struct.passwd* %0, %struct.passwd** %5
store %struct.passwd* %1, %struct.passwd** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load %struct.passwd*, %struct.passwd** %6
%10 = getelementptr inbounds %struct.passwd, %struct.passwd* %9, i32 0, i32 0
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %81
13: ; preds = %4
%14 = load %struct.passwd*, %struct.passwd** %6
%15 = getelementptr inbounds %struct.passwd, %struct.passwd* %14, i32 0, i32 0
%16 = load i8*, i8** %15
%17 = call i32 @strlen(i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %81
19: ; preds = %13
%20 = load i8*, i8** %7
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load %struct.passwd*, %struct.passwd** %6
%24 = getelementptr inbounds %struct.passwd, %struct.passwd* %23, i32 0, i32 0
%25 = load i8*, i8** %24
%26 = call i8* @strdup(i8* %25)
%27 = load %struct.passwd*, %struct.passwd** %5
%28 = getelementptr inbounds %struct.passwd, %struct.passwd* %27, i32 0, i32 0
store i8* %26, i8** %28
br label %80
29: ; preds = %19
%30 = load %struct.passwd*, %struct.passwd** %5
%31 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i32 0, i32 0
%32 = load i8*, i8** %31
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %52
34: ; preds = %29
%35 = load %struct.passwd*, %struct.passwd** %5
%36 = getelementptr inbounds %struct.passwd, %struct.passwd* %35, i32 0, i32 0
%37 = load i8*, i8** %36
%38 = call i32 @strlen(i8* %37)
%39 = load %struct.passwd*, %struct.passwd** %6
%40 = getelementptr inbounds %struct.passwd, %struct.passwd* %39, i32 0, i32 0
%41 = load i8*, i8** %40
%42 = call i32 @strlen(i8* %41)
%43 = icmp sge i32 %38, %42
br i1 %43, label %44, label %52
44: ; preds = %34
%45 = load %struct.passwd*, %struct.passwd** %5
%46 = getelementptr inbounds %struct.passwd, %struct.passwd* %45, i32 0, i32 0
%47 = load i8*, i8** %46
%48 = load %struct.passwd*, %struct.passwd** %6
%49 = getelementptr inbounds %struct.passwd, %struct.passwd* %48, i32 0, i32 0
%50 = load i8*, i8** %49
%51 = call i32 @strcpy(i8* %47, i8* %50)
br label %79
52: ; preds = %34, %29
%53 = load i8*, i8** %7
%54 = load %struct.passwd*, %struct.passwd** %5
%55 = getelementptr inbounds %struct.passwd, %struct.passwd* %54, i32 0, i32 0
store i8* %53, i8** %55
%56 = load %struct.passwd*, %struct.passwd** %5
%57 = getelementptr inbounds %struct.passwd, %struct.passwd* %56, i32 0, i32 0
%58 = load i8*, i8** %57
%59 = load %struct.passwd*, %struct.passwd** %6
%60 = getelementptr inbounds %struct.passwd, %struct.passwd* %59, i32 0, i32 0
%61 = load i8*, i8** %60
%62 = call i32 @strcpy(i8* %58, i8* %61)
%63 = load %struct.passwd*, %struct.passwd** %5
%64 = getelementptr inbounds %struct.passwd, %struct.passwd* %63, i32 0, i32 0
%65 = load i8*, i8** %64
%66 = call i32 @strlen(i8* %65)
%67 = add nsw i32 %66, 1
%68 = load i8*, i8** %7
%69 = sext i32 %67 to i64
%70 = getelementptr inbounds i8, i8* %68, i64 %69
store i8* %70, i8** %7
%71 = load i64, i64* %8
%72 = load %struct.passwd*, %struct.passwd** %5
%73 = getelementptr inbounds %struct.passwd, %struct.passwd* %72, i32 0, i32 0
%74 = load i8*, i8** %73
%75 = call i32 @strlen(i8* %74)
%76 = add nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = sub i64 %71, %77
store i64 %78, i64* %8
br label %79
79: ; preds = %52, %44
br label %80
80: ; preds = %79, %22
br label %81
81: ; preds = %80, %13, %4
%82 = load %struct.passwd*, %struct.passwd** %6
%83 = getelementptr inbounds %struct.passwd, %struct.passwd* %82, i32 0, i32 1
%84 = load i8*, i8** %83
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %154
86: ; preds = %81
%87 = load %struct.passwd*, %struct.passwd** %6
%88 = getelementptr inbounds %struct.passwd, %struct.passwd* %87, i32 0, i32 1
%89 = load i8*, i8** %88
%90 = call i32 @strlen(i8* %89)
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %154
92: ; preds = %86
%93 = load i8*, i8** %7
%94 = icmp eq i8* %93, null
br i1 %94, label %95, label %102
95: ; preds = %92
%96 = load %struct.passwd*, %struct.passwd** %6
%97 = getelementptr inbounds %struct.passwd, %struct.passwd* %96, i32 0, i32 1
%98 = load i8*, i8** %97
%99 = call i8* @strdup(i8* %98)
%100 = load %struct.passwd*, %struct.passwd** %5
%101 = getelementptr inbounds %struct.passwd, %struct.passwd* %100, i32 0, i32 1
store i8* %99, i8** %101
br label %153
102: ; preds = %92
%103 = load %struct.passwd*, %struct.passwd** %5
%104 = getelementptr inbounds %struct.passwd, %struct.passwd* %103, i32 0, i32 1
%105 = load i8*, i8** %104
%106 = icmp ne i8* %105, null
br i1 %106, label %107, label %125
107: ; preds = %102
%108 = load %struct.passwd*, %struct.passwd** %5
%109 = getelementptr inbounds %struct.passwd, %struct.passwd* %108, i32 0, i32 1
%110 = load i8*, i8** %109
%111 = call i32 @strlen(i8* %110)
%112 = load %struct.passwd*, %struct.passwd** %6
%113 = getelementptr inbounds %struct.passwd, %struct.passwd* %112, i32 0, i32 1
%114 = load i8*, i8** %113
%115 = call i32 @strlen(i8* %114)
%116 = icmp sge i32 %111, %115
br i1 %116, label %117, label %125
117: ; preds = %107
%118 = load %struct.passwd*, %struct.passwd** %5
%119 = getelementptr inbounds %struct.passwd, %struct.passwd* %118, i32 0, i32 1
%120 = load i8*, i8** %119
%121 = load %struct.passwd*, %struct.passwd** %6
%122 = getelementptr inbounds %struct.passwd, %struct.passwd* %121, i32 0, i32 1
%123 = load i8*, i8** %122
%124 = call i32 @strcpy(i8* %120, i8* %123)
br label %152
125: ; preds = %107, %102
%126 = load i8*, i8** %7
%127 = load %struct.passwd*, %struct.passwd** %5
%128 = getelementptr inbounds %struct.passwd, %struct.passwd* %127, i32 0, i32 1
store i8* %126, i8** %128
%129 = load %struct.passwd*, %struct.passwd** %5
%130 = getelementptr inbounds %struct.passwd, %struct.passwd* %129, i32 0, i32 1
%131 = load i8*, i8** %130
%132 = load %struct.passwd*, %struct.passwd** %6
%133 = getelementptr inbounds %struct.passwd, %struct.passwd* %132, i32 0, i32 1
%134 = load i8*, i8** %133
%135 = call i32 @strcpy(i8* %131, i8* %134)
%136 = load %struct.passwd*, %struct.passwd** %5
%137 = getelementptr inbounds %struct.passwd, %struct.passwd* %136, i32 0, i32 1
%138 = load i8*, i8** %137
%139 = call i32 @strlen(i8* %138)
%140 = add nsw i32 %139, 1
%141 = load i8*, i8** %7
%142 = sext i32 %140 to i64
%143 = getelementptr inbounds i8, i8* %141, i64 %142
store i8* %143, i8** %7
%144 = load i64, i64* %8
%145 = load %struct.passwd*, %struct.passwd** %5
%146 = getelementptr inbounds %struct.passwd, %struct.passwd* %145, i32 0, i32 1
%147 = load i8*, i8** %146
%148 = call i32 @strlen(i8* %147)
%149 = add nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = sub i64 %144, %150
store i64 %151, i64* %8
br label %152
152: ; preds = %125, %117
br label %153
153: ; preds = %152, %95
br label %154
154: ; preds = %153, %86, %81
%155 = load %struct.passwd*, %struct.passwd** %6
%156 = getelementptr inbounds %struct.passwd, %struct.passwd* %155, i32 0, i32 2
%157 = load i8*, i8** %156
%158 = icmp ne i8* %157, null
br i1 %158, label %159, label %227
159: ; preds = %154
%160 = load %struct.passwd*, %struct.passwd** %6
%161 = getelementptr inbounds %struct.passwd, %struct.passwd* %160, i32 0, i32 2
%162 = load i8*, i8** %161
%163 = call i32 @strlen(i8* %162)
%164 = icmp ne i32 %163, 0
br i1 %164, label %165, label %227
165: ; preds = %159
%166 = load i8*, i8** %7
%167 = icmp eq i8* %166, null
br i1 %167, label %168, label %175
168: ; preds = %165
%169 = load %struct.passwd*, %struct.passwd** %6
%170 = getelementptr inbounds %struct.passwd, %struct.passwd* %169, i32 0, i32 2
%171 = load i8*, i8** %170
%172 = call i8* @strdup(i8* %171)
%173 = load %struct.passwd*, %struct.passwd** %5
%174 = getelementptr inbounds %struct.passwd, %struct.passwd* %173, i32 0, i32 2
store i8* %172, i8** %174
br label %226
175: ; preds = %165
%176 = load %struct.passwd*, %struct.passwd** %5
%177 = getelementptr inbounds %struct.passwd, %struct.passwd* %176, i32 0, i32 2
%178 = load i8*, i8** %177
%179 = icmp ne i8* %178, null
br i1 %179, label %180, label %198
180: ; preds = %175
%181 = load %struct.passwd*, %struct.passwd** %5
%182 = getelementptr inbounds %struct.passwd, %struct.passwd* %181, i32 0, i32 2
%183 = load i8*, i8** %182
%184 = call i32 @strlen(i8* %183)
%185 = load %struct.passwd*, %struct.passwd** %6
%186 = getelementptr inbounds %struct.passwd, %struct.passwd* %185, i32 0, i32 2
%187 = load i8*, i8** %186
%188 = call i32 @strlen(i8* %187)
%189 = icmp sge i32 %184, %188
br i1 %189, label %190, label %198
190: ; preds = %180
%191 = load %struct.passwd*, %struct.passwd** %5
%192 = getelementptr inbounds %struct.passwd, %struct.passwd* %191, i32 0, i32 2
%193 = load i8*, i8** %192
%194 = load %struct.passwd*, %struct.passwd** %6
%195 = getelementptr inbounds %struct.passwd, %struct.passwd* %194, i32 0, i32 2
%196 = load i8*, i8** %195
%197 = call i32 @strcpy(i8* %193, i8* %196)
br label %225
198: ; preds = %180, %175
%199 = load i8*, i8** %7
%200 = load %struct.passwd*, %struct.passwd** %5
%201 = getelementptr inbounds %struct.passwd, %struct.passwd* %200, i32 0, i32 2
store i8* %199, i8** %201
%202 = load %struct.passwd*, %struct.passwd** %5
%203 = getelementptr inbounds %struct.passwd, %struct.passwd* %202, i32 0, i32 2
%204 = load i8*, i8** %203
%205 = load %struct.passwd*, %struct.passwd** %6
%206 = getelementptr inbounds %struct.passwd, %struct.passwd* %205, i32 0, i32 2
%207 = load i8*, i8** %206
%208 = call i32 @strcpy(i8* %204, i8* %207)
%209 = load %struct.passwd*, %struct.passwd** %5
%210 = getelementptr inbounds %struct.passwd, %struct.passwd* %209, i32 0, i32 2
%211 = load i8*, i8** %210
%212 = call i32 @strlen(i8* %211)
%213 = add nsw i32 %212, 1
%214 = load i8*, i8** %7
%215 = sext i32 %213 to i64
%216 = getelementptr inbounds i8, i8* %214, i64 %215
store i8* %216, i8** %7
%217 = load i64, i64* %8
%218 = load %struct.passwd*, %struct.passwd** %5
%219 = getelementptr inbounds %struct.passwd, %struct.passwd* %218, i32 0, i32 2
%220 = load i8*, i8** %219
%221 = call i32 @strlen(i8* %220)
%222 = add nsw i32 %221, 1
%223 = sext i32 %222 to i64
%224 = sub i64 %217, %223
store i64 %224, i64* %8
br label %225
225: ; preds = %198, %190
br label %226
226: ; preds = %225, %168
br label %227
227: ; preds = %226, %159, %154
%228 = load %struct.passwd*, %struct.passwd** %6
%229 = getelementptr inbounds %struct.passwd, %struct.passwd* %228, i32 0, i32 3
%230 = load i8*, i8** %229
%231 = icmp ne i8* %230, null
br i1 %231, label %232, label %300
232: ; preds = %227
%233 = load %struct.passwd*, %struct.passwd** %6
%234 = getelementptr inbounds %struct.passwd, %struct.passwd* %233, i32 0, i32 3
%235 = load i8*, i8** %234
%236 = call i32 @strlen(i8* %235)
%237 = icmp ne i32 %236, 0
br i1 %237, label %238, label %300
238: ; preds = %232
%239 = load i8*, i8** %7
%240 = icmp eq i8* %239, null
br i1 %240, label %241, label %248
241: ; preds = %238
%242 = load %struct.passwd*, %struct.passwd** %6
%243 = getelementptr inbounds %struct.passwd, %struct.passwd* %242, i32 0, i32 3
%244 = load i8*, i8** %243
%245 = call i8* @strdup(i8* %244)
%246 = load %struct.passwd*, %struct.passwd** %5
%247 = getelementptr inbounds %struct.passwd, %struct.passwd* %246, i32 0, i32 3
store i8* %245, i8** %247
br label %299
248: ; preds = %238
%249 = load %struct.passwd*, %struct.passwd** %5
%250 = getelementptr inbounds %struct.passwd, %struct.passwd* %249, i32 0, i32 3
%251 = load i8*, i8** %250
%252 = icmp ne i8* %251, null
br i1 %252, label %253, label %271
253: ; preds = %248
%254 = load %struct.passwd*, %struct.passwd** %5
%255 = getelementptr inbounds %struct.passwd, %struct.passwd* %254, i32 0, i32 3
%256 = load i8*, i8** %255
%257 = call i32 @strlen(i8* %256)
%258 = load %struct.passwd*, %struct.passwd** %6
%259 = getelementptr inbounds %struct.passwd, %struct.passwd* %258, i32 0, i32 3
%260 = load i8*, i8** %259
%261 = call i32 @strlen(i8* %260)
%262 = icmp sge i32 %257, %261
br i1 %262, label %263, label %271
263: ; preds = %253
%264 = load %struct.passwd*, %struct.passwd** %5
%265 = getelementptr inbounds %struct.passwd, %struct.passwd* %264, i32 0, i32 3
%266 = load i8*, i8** %265
%267 = load %struct.passwd*, %struct.passwd** %6
%268 = getelementptr inbounds %struct.passwd, %struct.passwd* %267, i32 0, i32 3
%269 = load i8*, i8** %268
%270 = call i32 @strcpy(i8* %266, i8* %269)
br label %298
271: ; preds = %253, %248
%272 = load i8*, i8** %7
%273 = load %struct.passwd*, %struct.passwd** %5
%274 = getelementptr inbounds %struct.passwd, %struct.passwd* %273, i32 0, i32 3
store i8* %272, i8** %274
%275 = load %struct.passwd*, %struct.passwd** %5
%276 = getelementptr inbounds %struct.passwd, %struct.passwd* %275, i32 0, i32 3
%277 = load i8*, i8** %276
%278 = load %struct.passwd*, %struct.passwd** %6
%279 = getelementptr inbounds %struct.passwd, %struct.passwd* %278, i32 0, i32 3
%280 = load i8*, i8** %279
%281 = call i32 @strcpy(i8* %277, i8* %280)
%282 = load %struct.passwd*, %struct.passwd** %5
%283 = getelementptr inbounds %struct.passwd, %struct.passwd* %282, i32 0, i32 3
%284 = load i8*, i8** %283
%285 = call i32 @strlen(i8* %284)
%286 = add nsw i32 %285, 1
%287 = load i8*, i8** %7
%288 = sext i32 %286 to i64
%289 = getelementptr inbounds i8, i8* %287, i64 %288
store i8* %289, i8** %7
%290 = load i64, i64* %8
%291 = load %struct.passwd*, %struct.passwd** %5
%292 = getelementptr inbounds %struct.passwd, %struct.passwd* %291, i32 0, i32 3
%293 = load i8*, i8** %292
%294 = call i32 @strlen(i8* %293)
%295 = add nsw i32 %294, 1
%296 = sext i32 %295 to i64
%297 = sub i64 %290, %296
store i64 %297, i64* %8
br label %298
298: ; preds = %271, %263
br label %299
299: ; preds = %298, %241
br label %300
300: ; preds = %299, %232, %227
ret void
}

LLVM IR (-O2):
%struct.passwd = type { i8*, i8*, i8*, i8* }
define void @copy_pwd_changes(%struct.passwd* nocapture %0, %struct.passwd* nocapture %1, i8* %2, i64 %3) {
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %1, i64 0, i32 0
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %40, label %8
8: ; preds = %4
%9 = tail call i32 @strlen(i8* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %40, label %11
11: ; preds = %8
%12 = icmp eq i8* %2, null
br i1 %12, label %13, label %17
13: ; preds = %11
%14 = load i8*, i8** %5
%15 = tail call i8* @strdup(i8* %14)
%16 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 0
store i8* %15, i8** %16
br label %40
17: ; preds = %11
%18 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 0
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %30, label %21
21: ; preds = %17
%22 = tail call i32 @strlen(i8* %19)
%23 = load i8*, i8** %5
%24 = tail call i32 @strlen(i8* %23)
%25 = icmp slt i32 %22, %24
br i1 %25, label %30, label %26
26: ; preds = %21
%27 = load i8*, i8** %18
%28 = load i8*, i8** %5
%29 = tail call i32 @strcpy(i8* %27, i8* %28)
br label %40
30: ; preds = %21, %17
store i8* %2, i8** %18
%31 = load i8*, i8** %5
%32 = tail call i32 @strcpy(i8* %2, i8* %31)
%33 = load i8*, i8** %18
%34 = tail call i32 @strlen(i8* %33)
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %2, i64 %36
%38 = load i8*, i8** %18
%39 = tail call i32 @strlen(i8* %38)
br label %40
40: ; preds = %13, %30, %26, %8, %4
%41 = phi i8* [ null, %13 ], [ %2, %26 ], [ %37, %30 ], [ %2, %8 ], [ %2, %4 ]
%42 = getelementptr inbounds %struct.passwd, %struct.passwd* %1, i64 0, i32 1
%43 = load i8*, i8** %42
%44 = icmp eq i8* %43, null
br i1 %44, label %77, label %45
45: ; preds = %40
%46 = tail call i32 @strlen(i8* %43)
%47 = icmp eq i32 %46, 0
br i1 %47, label %77, label %48
48: ; preds = %45
%49 = icmp eq i8* %41, null
br i1 %49, label %50, label %54
50: ; preds = %48
%51 = load i8*, i8** %42
%52 = tail call i8* @strdup(i8* %51)
%53 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 1
store i8* %52, i8** %53
br label %77
54: ; preds = %48
%55 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 1
%56 = load i8*, i8** %55
%57 = icmp eq i8* %56, null
br i1 %57, label %67, label %58
58: ; preds = %54
%59 = tail call i32 @strlen(i8* %56)
%60 = load i8*, i8** %42
%61 = tail call i32 @strlen(i8* %60)
%62 = icmp slt i32 %59, %61
br i1 %62, label %67, label %63
63: ; preds = %58
%64 = load i8*, i8** %55
%65 = load i8*, i8** %42
%66 = tail call i32 @strcpy(i8* %64, i8* %65)
br label %77
67: ; preds = %58, %54
store i8* %41, i8** %55
%68 = load i8*, i8** %42
%69 = tail call i32 @strcpy(i8* %41, i8* %68)
%70 = load i8*, i8** %55
%71 = tail call i32 @strlen(i8* %70)
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %41, i64 %73
%75 = load i8*, i8** %55
%76 = tail call i32 @strlen(i8* %75)
br label %77
77: ; preds = %50, %67, %63, %45, %40
%78 = phi i8* [ null, %50 ], [ %41, %63 ], [ %74, %67 ], [ %41, %45 ], [ %41, %40 ]
%79 = getelementptr inbounds %struct.passwd, %struct.passwd* %1, i64 0, i32 2
%80 = load i8*, i8** %79
%81 = icmp eq i8* %80, null
br i1 %81, label %114, label %82
82: ; preds = %77
%83 = tail call i32 @strlen(i8* %80)
%84 = icmp eq i32 %83, 0
br i1 %84, label %114, label %85
85: ; preds = %82
%86 = icmp eq i8* %78, null
br i1 %86, label %87, label %91
87: ; preds = %85
%88 = load i8*, i8** %79
%89 = tail call i8* @strdup(i8* %88)
%90 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 2
store i8* %89, i8** %90
br label %114
91: ; preds = %85
%92 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 2
%93 = load i8*, i8** %92
%94 = icmp eq i8* %93, null
br i1 %94, label %104, label %95
95: ; preds = %91
%96 = tail call i32 @strlen(i8* %93)
%97 = load i8*, i8** %79
%98 = tail call i32 @strlen(i8* %97)
%99 = icmp slt i32 %96, %98
br i1 %99, label %104, label %100
100: ; preds = %95
%101 = load i8*, i8** %92
%102 = load i8*, i8** %79
%103 = tail call i32 @strcpy(i8* %101, i8* %102)
br label %114
104: ; preds = %95, %91
store i8* %78, i8** %92
%105 = load i8*, i8** %79
%106 = tail call i32 @strcpy(i8* %78, i8* %105)
%107 = load i8*, i8** %92
%108 = tail call i32 @strlen(i8* %107)
%109 = add nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %78, i64 %110
%112 = load i8*, i8** %92
%113 = tail call i32 @strlen(i8* %112)
br label %114
114: ; preds = %87, %104, %100, %82, %77
%115 = phi i8* [ null, %87 ], [ %78, %100 ], [ %111, %104 ], [ %78, %82 ], [ %78, %77 ]
%116 = getelementptr inbounds %struct.passwd, %struct.passwd* %1, i64 0, i32 3
%117 = load i8*, i8** %116
%118 = icmp eq i8* %117, null
br i1 %118, label %148, label %119
119: ; preds = %114
%120 = tail call i32 @strlen(i8* %117)
%121 = icmp eq i32 %120, 0
br i1 %121, label %148, label %122
122: ; preds = %119
%123 = icmp eq i8* %115, null
br i1 %123, label %124, label %128
124: ; preds = %122
%125 = load i8*, i8** %116
%126 = tail call i8* @strdup(i8* %125)
%127 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 3
store i8* %126, i8** %127
br label %148
128: ; preds = %122
%129 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 3
%130 = load i8*, i8** %129
%131 = icmp eq i8* %130, null
br i1 %131, label %141, label %132
132: ; preds = %128
%133 = tail call i32 @strlen(i8* %130)
%134 = load i8*, i8** %116
%135 = tail call i32 @strlen(i8* %134)
%136 = icmp slt i32 %133, %135
br i1 %136, label %141, label %137
137: ; preds = %132
%138 = load i8*, i8** %129
%139 = load i8*, i8** %116
%140 = tail call i32 @strcpy(i8* %138, i8* %139)
br label %148
141: ; preds = %132, %128
store i8* %115, i8** %129
%142 = load i8*, i8** %116
%143 = tail call i32 @strcpy(i8* %115, i8* %142)
%144 = load i8*, i8** %129
%145 = tail call i32 @strlen(i8* %144)
%146 = load i8*, i8** %129
%147 = tail call i32 @strlen(i8* %146)
br label %148
148: ; preds = %124, %141, %137, %119, %114
ret void
}