#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;
  char *pw_passwd;
  int pw_uid;
  int pw_gid;
  char *pw_gecos;
  char *pw_dir;
  char *pw_shell;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, char *, char *, int, int,
                   char *, char *, char *);
int putpwent(const struct passwd *pw, FILE *f) {
  return fprintf(f, "%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd,
                 pw->pw_uid, pw->pw_gid, pw->pw_gecos, pw->pw_dir,
                 pw->pw_shell) < 0
             ? -1
             : 0;
}


x86 assembly (clang, -O0):
<putpwent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%r9d
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%r11
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%r10
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%rax
lea    0xe9e(%rip),%rsi
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <fprintf@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%rdx
cmovl  %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putpwent>:
sub    $0x18,%rsp
mov    %rsi,%rax
mov    (%rdi),%rdx
mov    0x8(%rdi),%rcx
mov    0x10(%rdi),%r8d
mov    0x14(%rdi),%r9d
movups 0x18(%rdi),%xmm0
mov    0x28(%rdi),%rsi
mov    %rsi,0x10(%rsp)
movups %xmm0,(%rsp)
lea    0xec2(%rip),%rsi
mov    %rax,%rdi
call   1030 <fprintf@plt>
sar    $0x3f,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.passwd = type { i8*, i8*, i32, i32, i8*, i8*, i8* }
@.str = [22 x i8] c"%s:%s:%d:%d:%s:%s:%s\0A\00"
define i32 @putpwent(%struct.passwd* %0, i32* %1) {
%3 = alloca %struct.passwd*
%4 = alloca i32*
store %struct.passwd* %0, %struct.passwd** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load %struct.passwd*, %struct.passwd** %3
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i32 0, i32 0
%8 = load i8*, i8** %7
%9 = load %struct.passwd*, %struct.passwd** %3
%10 = getelementptr inbounds %struct.passwd, %struct.passwd* %9, i32 0, i32 1
%11 = load i8*, i8** %10
%12 = load %struct.passwd*, %struct.passwd** %3
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %12, i32 0, i32 2
%14 = load i32, i32* %13
%15 = load %struct.passwd*, %struct.passwd** %3
%16 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i32 0, i32 3
%17 = load i32, i32* %16
%18 = load %struct.passwd*, %struct.passwd** %3
%19 = getelementptr inbounds %struct.passwd, %struct.passwd* %18, i32 0, i32 4
%20 = load i8*, i8** %19
%21 = load %struct.passwd*, %struct.passwd** %3
%22 = getelementptr inbounds %struct.passwd, %struct.passwd* %21, i32 0, i32 5
%23 = load i8*, i8** %22
%24 = load %struct.passwd*, %struct.passwd** %3
%25 = getelementptr inbounds %struct.passwd, %struct.passwd* %24, i32 0, i32 6
%26 = load i8*, i8** %25
%27 = call i64 @fprintf(i32* %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %11, i32 %14, i32 %17, i8* %20, i8* %23, i8* %26)
%28 = icmp slt i64 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 -1, i32 0
ret i32 %30
}

LLVM IR (-O2):
%struct.passwd = type { i8*, i8*, i32, i32, i8*, i8*, i8* }
@.str = [22 x i8] c"%s:%s:%d:%d:%s:%s:%s\0A\00"
define i32 @putpwent(%struct.passwd* nocapture %0, i32* nocapture %1) {
%3 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 0
%4 = load i8*, i8** %3
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 4
%12 = load i8*, i8** %11
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 5
%14 = load i8*, i8** %13
%15 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 6
%16 = load i8*, i8** %15
%17 = tail call i64 @fprintf(i32* %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i32 %8, i32 %10, i8* %12, i8* %14, i8* %16)
%18 = ashr i64 %17, 63
%19 = trunc i64 %18 to i32
ret i32 %19
}