#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*/ assert(int);
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ snprintf(char *, unsigned int, char *, char *, char *,
                            char *, int);
int strlen(char *);
char *dbin_toenvstring_density(char *x, char **par, unsigned int npar,
                               int give_log) {
  char *size, *prob, *buff;
  unsigned int sz;
  assert(par != NULL && npar >= 2);
  size = par[1];
  prob = par[0];
  sz = sizeof(char) * (strlen(x) + strlen(size) + strlen(prob) + 40);
  buff = (char *)malloc(sz);
  snprintf(buff, sz, "dbinom(state,%s, %s, %s, %d)", x, size, prob, give_log);
  return buff;
}


x86 assembly (clang, -O0):
<dbin_toenvstring_density>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x35(%rbp)
je     1170 <dbin_toenvstring_density+0x30>
cmpl   $0x2,-0x14(%rbp)
setae  %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
add    $0x28,%eax
cltq
shl    $0x0,%rax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x18(%rbp),%eax
lea    0xe08(%rip),%rdx
mov    %eax,(%rsp)
call   1040 <snprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbin_toenvstring_density>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
test   %rsi,%rsi
setne  %al
cmp    $0x2,%edx
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
mov    (%rbx),%r12
mov    0x8(%rbx),%r13
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %ebp,%ebx
add    %eax,%ebx
add    $0x28,%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,(%rsp)
lea    0xe57(%rip),%rdx
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r15,%rcx
mov    %r13,%r8
mov    %r12,%r9
call   1040 <snprintf@plt>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"dbinom(state,%s, %s, %s, %d)\00"
define i8* @dbin_toenvstring_density(i8* %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%13 = load i8**, i8*** %6
%14 = icmp ne i8** %13, null
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32, i32* %7
%17 = icmp uge i32 %16, 2
br label %18
18: ; preds = %15, %4
%19 = phi i1 [ false, %4 ], [ %17, %15 ]
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i8**, i8*** %6
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %9
%25 = load i8**, i8*** %6
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
store i8* %27, i8** %10
%28 = load i8*, i8** %5
%29 = call i32 @strlen(i8* %28)
%30 = load i8*, i8** %9
%31 = call i32 @strlen(i8* %30)
%32 = add nsw i32 %29, %31
%33 = load i8*, i8** %10
%34 = call i32 @strlen(i8* %33)
%35 = add nsw i32 %32, %34
%36 = add nsw i32 %35, 40
%37 = sext i32 %36 to i64
%38 = mul i64 1, %37
%39 = trunc i64 %38 to i32
store i32 %39, i32* %12
%40 = load i32, i32* %12
%41 = call i64 @malloc(i32 %40)
%42 = inttoptr i64 %41 to i8*
store i8* %42, i8** %11
%43 = load i8*, i8** %11
%44 = load i32, i32* %12
%45 = load i8*, i8** %5
%46 = load i8*, i8** %9
%47 = load i8*, i8** %10
%48 = load i32, i32* %8
%49 = call i32 @snprintf(i8* %43, i32 %44, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %45, i8* %46, i8* %47, i32 %48)
%50 = load i8*, i8** %11
ret i8* %50
}

LLVM IR (-O2):
@.str = [29 x i8] c"dbinom(state,%s, %s, %s, %d)\00"
define i8* @dbin_toenvstring_density(i8* %0, i8** %1, i32 %2, i32 %3) {
%5 = icmp ne i8** %1, null
%6 = icmp ugt i32 %2, 1
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i8*, i8** %1
%13 = tail call i32 @strlen(i8* %0)
%14 = tail call i32 @strlen(i8* %11)
%15 = tail call i32 @strlen(i8* %12)
%16 = add i32 %13, 40
%17 = add i32 %16, %14
%18 = add i32 %17, %15
%19 = tail call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to i8*
%21 = tail call i32 @snprintf(i8* %20, i32 %18, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %11, i8* %12, i32 %3)
ret i8* %20
}