#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 */

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ yp_get_default_domain(char **);
int yp_match(char *, char *, char *, int /*<<< orphan*/, char **, int *);
int getmuser(char *name, char *Unix, char *Mainframe) {
  int ret, len;
  static char *val, *dom;
  if (dom == (char *)(0))
    (void)yp_get_default_domain(&dom);
  if (val)
    free(val);
  if ((ret = yp_match(dom, "musers", name, strlen(name), &val, &len)) == 0) {
    (void)sscanf(val, "%s %s", Unix, Mainframe);
    return (0);
  } else
    return (ret);
}


x86 assembly (clang, -O0):
<getmuser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,0x2eec(%rip)
jne    117e <getmuser+0x2e>
lea    0x2edf(%rip),%rdi
call   1050 <yp_get_default_domain@plt>
cmpq   $0x0,0x2eca(%rip)
je     1198 <getmuser+0x48>
mov    0x2ebd(%rip),%rdi
call   1030 <free@plt>
mov    0x2eb9(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
lea    0xe3b(%rip),%rsi
lea    0x2e84(%rip),%r8
lea    -0x28(%rbp),%r9
call   1070 <yp_match@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jne    1208 <getmuser+0xb8>
mov    0x2e68(%rip),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe10(%rip),%rsi
call   1060 <sscanf@plt>
movl   $0x0,-0x4(%rbp)
jmp    120e <getmuser+0xbe>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmuser>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
cmpq   $0x0,0x2eef(%rip)
jne    1177 <getmuser+0x27>
lea    0x2ee6(%rip),%rdi
call   1050 <yp_get_default_domain@plt>
mov    0x2ed2(%rip),%rdi
test   %rdi,%rdi
je     1188 <getmuser+0x38>
call   1030 <free@plt>
mov    0x2ec9(%rip),%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
lea    0xe62(%rip),%rsi
lea    0x2eab(%rip),%r8
lea    0x4(%rsp),%r9
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %eax,%ecx
call   1070 <yp_match@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    11d6 <getmuser+0x86>
mov    0x2e8c(%rip),%rdi
lea    0xe3c(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1060 <sscanf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@getmuser.val = internal global i8* null
@getmuser.dom = internal global i8* null
@.str = [7 x i8] c"musers\00"
@.str.1 = [6 x i8] c"%s %s\00"
define i32 @getmuser(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load i8*, i8** @getmuser.dom
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @yp_get_default_domain(i8** @getmuser.dom)
br label %14
14: ; preds = %12, %3
%15 = load i8*, i8** @getmuser.val
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** @getmuser.val
%19 = call i32 @free(i8* %18)
br label %20
20: ; preds = %17, %14
%21 = load i8*, i8** @getmuser.dom
%22 = load i8*, i8** %5
%23 = load i8*, i8** %5
%24 = call i32 @strlen(i8* %23)
%25 = call i32 @yp_match(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %22, i32 %24, i8** @getmuser.val, i32* %9)
store i32 %25, i32* %8
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %20
%28 = load i8*, i8** @getmuser.val
%29 = load i8*, i8** %6
%30 = load i8*, i8** %7
%31 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %29, i8* %30)
store i32 0, i32* %4
br label %34
32: ; preds = %20
%33 = load i32, i32* %8
store i32 %33, i32* %4
br label %34
34: ; preds = %32, %27
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
@getmuser.val = internal global i8* null
@getmuser.dom = internal global i8* null
@.str = [7 x i8] c"musers\00"
@.str.1 = [6 x i8] c"%s %s\00"
define i32 @getmuser(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i8*, i8** @getmuser.dom
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @yp_get_default_domain(i8** @getmuser.dom)
br label %10
10: ; preds = %8, %3
%11 = load i8*, i8** @getmuser.val
%12 = icmp eq i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @free(i8* %11)
br label %15
15: ; preds = %13, %10
%16 = load i8*, i8** @getmuser.dom
%17 = tail call i32 @strlen(i8* %0)
%18 = call i32 @yp_match(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %17, i8** @getmuser.val, i32* %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8*, i8** @getmuser.val
%22 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
br label %23
23: ; preds = %15, %20
ret i32 %18
}