#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 {
  int /*<<< orphan*/ pw_shell;
  int /*<<< orphan*/ pw_dir;
  int /*<<< orphan*/ pw_gecos;
  int /*<<< orphan*/ pw_passwd;
  int /*<<< orphan*/ pw_name;
};

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct passwd *, char, int);
void give_pwd_free(struct passwd *pwd) {
  free(pwd->pw_name);
  free(pwd->pw_passwd);
  free(pwd->pw_gecos);
  free(pwd->pw_dir);
  free(pwd->pw_shell);
  memset(pwd, '\0', sizeof(struct passwd));
}


x86 assembly (clang, -O0):
<give_pwd_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<give_pwd_free>:
push   %rbx
mov    %rdi,%rbx
mov    0x10(%rdi),%edi
call   1030 <free@plt>
mov    0xc(%rbx),%edi
call   1030 <free@plt>
mov    0x8(%rbx),%edi
call   1030 <free@plt>
mov    0x4(%rbx),%edi
call   1030 <free@plt>
mov    (%rbx),%edi
call   1030 <free@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x14,%edx
pop    %rbx
jmp    1040 <memset@plt>

LLVM IR (-O0):
%struct.passwd = type { i32, i32, i32, i32, i32 }
define void @give_pwd_free(%struct.passwd* %0) {
%2 = alloca %struct.passwd*
store %struct.passwd* %0, %struct.passwd** %2
%3 = load %struct.passwd*, %struct.passwd** %2
%4 = getelementptr inbounds %struct.passwd, %struct.passwd* %3, i32 0, i32 4
%5 = load i32, i32* %4
%6 = call i32 @free(i32 %5)
%7 = load %struct.passwd*, %struct.passwd** %2
%8 = getelementptr inbounds %struct.passwd, %struct.passwd* %7, i32 0, i32 3
%9 = load i32, i32* %8
%10 = call i32 @free(i32 %9)
%11 = load %struct.passwd*, %struct.passwd** %2
%12 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i32 0, i32 2
%13 = load i32, i32* %12
%14 = call i32 @free(i32 %13)
%15 = load %struct.passwd*, %struct.passwd** %2
%16 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = call i32 @free(i32 %17)
%19 = load %struct.passwd*, %struct.passwd** %2
%20 = getelementptr inbounds %struct.passwd, %struct.passwd* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = call i32 @free(i32 %21)
%23 = load %struct.passwd*, %struct.passwd** %2
%24 = call i32 @memset(%struct.passwd* %23, i8 signext 0, i32 20)
ret void
}

LLVM IR (-O2):
%struct.passwd = type { i32, i32, i32, i32, i32 }
define void @give_pwd_free(%struct.passwd* %0) {
%2 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 4
%3 = load i32, i32* %2
%4 = tail call i32 @free(i32 %3)
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 3
%6 = load i32, i32* %5
%7 = tail call i32 @free(i32 %6)
%8 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 2
%9 = load i32, i32* %8
%10 = tail call i32 @free(i32 %9)
%11 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 1
%12 = load i32, i32* %11
%13 = tail call i32 @free(i32 %12)
%14 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 0
%15 = load i32, i32* %14
%16 = tail call i32 @free(i32 %15)
%17 = tail call i32 @memset(%struct.passwd* %0, i8 signext 0, i32 20)
ret void
}