#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 */
typedef int /*<<< orphan*/ BIT_STRING_BITNAME;
typedef int /*<<< orphan*/ ASN1_BIT_STRING;

/* Variables and functions */
int ASN1_BIT_STRING_num_asc(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ASN1_BIT_STRING_set_bit(int /*<<< orphan*/ *, int, int);
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
                            BIT_STRING_BITNAME *tbl) {
  int bitnum;
  bitnum = ASN1_BIT_STRING_num_asc(name, tbl);
  if (bitnum < 0)
    return 0;
  if (bs) {
    if (!ASN1_BIT_STRING_set_bit(bs, bitnum, value))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<ASN1_BIT_STRING_set_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <ASN1_BIT_STRING_num_asc@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    115d <ASN1_BIT_STRING_set_asc+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1198 <ASN1_BIT_STRING_set_asc+0x78>
cmpq   $0x0,-0x10(%rbp)
je     1191 <ASN1_BIT_STRING_set_asc+0x71>
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <ASN1_BIT_STRING_set_bit@plt>
cmp    $0x0,%eax
jne    118c <ASN1_BIT_STRING_set_asc+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    1198 <ASN1_BIT_STRING_set_asc+0x78>
jmp    1191 <ASN1_BIT_STRING_set_asc+0x71>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_BIT_STRING_set_asc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rdi,%rbp
mov    %rsi,%rdi
mov    %rcx,%rsi
call   1030 <ASN1_BIT_STRING_num_asc@plt>
xor    %ebx,%ebx
test   %eax,%eax
js     1156 <ASN1_BIT_STRING_set_asc+0x36>
test   %rbp,%rbp
je     1151 <ASN1_BIT_STRING_set_asc+0x31>
mov    %rbp,%rdi
mov    %eax,%esi
mov    %r14d,%edx
call   1040 <ASN1_BIT_STRING_set_bit@plt>
test   %eax,%eax
je     1156 <ASN1_BIT_STRING_set_asc+0x36>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ASN1_BIT_STRING_set_asc(i32* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%11 = load i8*, i8** %7
%12 = load i32*, i32** %9
%13 = call i32 @ASN1_BIT_STRING_num_asc(i8* %11, i32* %12)
store i32 %13, i32* %10
%14 = load i32, i32* %10
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 0, i32* %5
br label %29
17: ; preds = %4
%18 = load i32*, i32** %6
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i32*, i32** %6
%22 = load i32, i32* %10
%23 = load i32, i32* %8
%24 = call i32 @ASN1_BIT_STRING_set_bit(i32* %21, i32 %22, i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %20
store i32 0, i32* %5
br label %29
27: ; preds = %20
br label %28
28: ; preds = %27, %17
store i32 1, i32* %5
br label %29
29: ; preds = %28, %26, %16
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @ASN1_BIT_STRING_set_asc(i32* %0, i8* %1, i32 %2, i32* %3) {
%5 = tail call i32 @ASN1_BIT_STRING_num_asc(i8* %1, i32* %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = icmp eq i32* %0, null
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = tail call i32 @ASN1_BIT_STRING_set_bit(i32* %0, i32 %5, i32 %2)
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9, %7
br label %13
13: ; preds = %9, %4, %12
%14 = phi i32 [ 1, %12 ], [ 0, %4 ], [ 0, %9 ]
ret i32 %14
}