#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 */
char *dngettext(char const *, char *, char const *, unsigned long);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
const char *b_dnpgettext(const char *domain, const char *context,
                         const char *msgId, const char *msgIdPlural,
                         unsigned long int n) {
  size_t context_len = strlen(context) + 1;
  size_t msgId_len = strlen(msgId) + 1;
  char ctxMsgId[context_len + msgId_len];
  memcpy(ctxMsgId, context, context_len - 1);
  ctxMsgId[context_len - 1] = '\004';
  memcpy(ctxMsgId + context_len, msgId, msgId_len);
  const char *const translation = dngettext(domain, ctxMsgId, msgIdPlural, n);
  if (translation == ctxMsgId)
    return msgId;
  return translation;
}


x86 assembly (clang, -O0):
<b_dnpgettext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%rdx
mov    %rcx,%rax
add    %rdx,%rax
mov    %rsp,%rsi
mov    %rsi,-0x48(%rbp)
lea    0xf(%rcx,%rdx,1),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x68(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rdx
sub    $0x1,%rdx
call   1040 <memcpy@plt>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rax
sub    $0x1,%rax
movb   $0x4,(%rdi,%rax,1)
add    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x68(%rbp),%rsi
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1050 <dngettext@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,-0x58(%rbp)
cmp    %rax,-0x58(%rbp)
jne    120f <b_dnpgettext+0xdf>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    121e <b_dnpgettext+0xee>
mov    -0x58(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x5c(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_dnpgettext>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,-0x30(%rbp)
mov    %rsi,%rdi
call   1030 <strlen@plt>
movslq %eax,%r14
mov    %r13,%rdi
call   1030 <strlen@plt>
movslq %eax,%r15
lea    (%r15,%r14,1),%rax
add    $0x11,%rax
add    $0x1,%r15
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <memcpy@plt>
movb   $0x4,(%r14,%r12,1)
lea    (%r14,%r12,1),%rdi
add    $0x1,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    -0x30(%rbp),%rdi
mov    %r12,%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1050 <dngettext@plt>
cmp    %r12,%rax
cmove  %r13,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @b_dnpgettext(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i64 %4, i64* %11
%18 = load i8*, i8** %8
%19 = call i32 @strlen(i8* %18)
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
store i64 %21, i64* %12
%22 = load i8*, i8** %9
%23 = call i32 @strlen(i8* %22)
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
store i64 %25, i64* %13
%26 = load i64, i64* %12
%27 = load i64, i64* %13
%28 = add i64 %26, %27
%29 = call i8* @llvm.stacksave()
store i8* %29, i8** %14
%30 = alloca i8, i64 %28
store i64 %28, i64* %15
%31 = load i8*, i8** %8
%32 = load i64, i64* %12
%33 = sub i64 %32, 1
%34 = call i32 @memcpy(i8* %30, i8* %31, i64 %33)
%35 = load i64, i64* %12
%36 = sub i64 %35, 1
%37 = getelementptr inbounds i8, i8* %30, i64 %36
store i8 4, i8* %37
%38 = load i64, i64* %12
%39 = getelementptr inbounds i8, i8* %30, i64 %38
%40 = load i8*, i8** %9
%41 = load i64, i64* %13
%42 = call i32 @memcpy(i8* %39, i8* %40, i64 %41)
%43 = load i8*, i8** %7
%44 = load i8*, i8** %10
%45 = load i64, i64* %11
%46 = call i8* @dngettext(i8* %43, i8* %30, i8* %44, i64 %45)
store i8* %46, i8** %16
%47 = load i8*, i8** %16
%48 = icmp eq i8* %47, %30
br i1 %48, label %49, label %51
49: ; preds = %5
%50 = load i8*, i8** %9
store i8* %50, i8** %6
store i32 1, i32* %17
br label %53
51: ; preds = %5
%52 = load i8*, i8** %16
store i8* %52, i8** %6
store i32 1, i32* %17
br label %53
53: ; preds = %51, %49
%54 = load i8*, i8** %14
%55 = load i8*, i8** %6
ret i8* %55
}

LLVM IR (-O2):
define i8* @b_dnpgettext(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = tail call i32 @strlen(i8* %1)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = tail call i32 @strlen(i8* %2)
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = add nsw i64 %11, %8
%13 = alloca i8, i64 %12
%14 = add nsw i64 %8, -1
%15 = call i32 @memcpy(i8* %13, i8* %1, i64 %14)
%16 = getelementptr inbounds i8, i8* %13, i64 %14
store i8 4, i8* %16
%17 = getelementptr inbounds i8, i8* %13, i64 %8
%18 = call i32 @memcpy(i8* %17, i8* %2, i64 %11)
%19 = call i8* @dngettext(i8* %0, i8* %13, i8* %3, i64 %4)
%20 = icmp eq i8* %19, %13
%21 = select i1 %20, i8* %2, i8* %19
ret i8* %21
}