#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*/ __nss_configure_lookup(char *, char const *);
scalar_t__ strcmp(char *, char const *);
void __attribute__((unused)) setdb(const char *dbname) {
  if (strcmp("db", dbname)) {
    __nss_configure_lookup("hosts", dbname);
    __nss_configure_lookup("networks", dbname);
  }
  __nss_configure_lookup("protocols", dbname);
  __nss_configure_lookup("rpc", dbname);
  __nss_configure_lookup("services", dbname);
}


x86 assembly (clang, -O0):
<setdb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1166 <setdb+0x46>
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1030 <__nss_configure_lookup@plt>
mov    -0x8(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <__nss_configure_lookup@plt>
mov    -0x8(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1030 <__nss_configure_lookup@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <__nss_configure_lookup@plt>
mov    -0x8(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <__nss_configure_lookup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setdb>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1156 <setdb+0x36>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <__nss_configure_lookup@plt>
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
call   1030 <__nss_configure_lookup@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <__nss_configure_lookup@plt>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <__nss_configure_lookup@plt>
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <__nss_configure_lookup@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"db\00"
@.str.1 = [6 x i8] c"hosts\00"
@.str.2 = [9 x i8] c"networks\00"
@.str.3 = [10 x i8] c"protocols\00"
@.str.4 = [4 x i8] c"rpc\00"
@.str.5 = [9 x i8] c"services\00"
define void @setdb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %6, %1
%12 = load i8*, i8** %2
%13 = call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %2
%15 = call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %2
%17 = call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"db\00"
@.str.1 = [6 x i8] c"hosts\00"
@.str.2 = [9 x i8] c"networks\00"
@.str.3 = [10 x i8] c"protocols\00"
@.str.4 = [4 x i8] c"rpc\00"
@.str.5 = [9 x i8] c"services\00"
define void @setdb(i8* %0) {
%2 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = tail call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %4, %1
%8 = tail call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%9 = tail call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%10 = tail call i32 @__nss_configure_lookup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %0)
ret void
}