#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  unsigned char *data;
  void *type;
  int /*<<< orphan*/ length;
};
typedef int /*<<< orphan*/ ASN1_STRING;
typedef TYPE_1__ ASN1_GENERALIZEDTIME;

/* Variables and functions */
scalar_t__ ASN1_GENERALIZEDTIME_check(TYPE_1__ *);
int /*<<< orphan*/ ASN1_STRING_set(int /*<<< orphan*/ *, char const *,
                                   int /*<<< orphan*/);
void *V_ASN1_GENERALIZEDTIME;
int /*<<< orphan*/ strlen(char const *);
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) {
  ASN1_GENERALIZEDTIME t;
  t.type = V_ASN1_GENERALIZEDTIME;
  t.length = strlen(str);
  t.data = (unsigned char *)str;
  if (ASN1_GENERALIZEDTIME_check(&t)) {
    if (s != NULL) {
      if (!ASN1_STRING_set((ASN1_STRING *)s, str, t.length))
        return 0;
      s->type = V_ASN1_GENERALIZEDTIME;
    }
    return (1);
  } else
    return (0);
}


x86 assembly (clang, -O0):
<ASN1_GENERALIZEDTIME_set_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <ASN1_GENERALIZEDTIME_check@plt>
cmp    $0x0,%rax
je     11c3 <ASN1_GENERALIZEDTIME_set_string+0x93>
cmpq   $0x0,-0x10(%rbp)
je     11b7 <ASN1_GENERALIZEDTIME_set_string+0x87>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1050 <ASN1_STRING_set@plt>
cmp    $0x0,%eax
jne    11a5 <ASN1_GENERALIZEDTIME_set_string+0x75>
movl   $0x0,-0x4(%rbp)
jmp    11ca <ASN1_GENERALIZEDTIME_set_string+0x9a>
mov    0x2e3c(%rip),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11ca <ASN1_GENERALIZEDTIME_set_string+0x9a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_GENERALIZEDTIME_set_string>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2ea1(%rip),%r15
mov    (%r15),%rax
mov    %rax,0x8(%rsp)
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,0x10(%rsp)
mov    %rbx,(%rsp)
mov    %rsp,%rdi
call   1040 <ASN1_GENERALIZEDTIME_check@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1192 <ASN1_GENERALIZEDTIME_set_string+0x62>
test   %r14,%r14
je     118d <ASN1_GENERALIZEDTIME_set_string+0x5d>
mov    0x10(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <ASN1_STRING_set@plt>
test   %eax,%eax
je     1192 <ASN1_GENERALIZEDTIME_set_string+0x62>
mov    (%r15),%rax
mov    %rax,0x8(%r14)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i8*, i8*, i32 }
@V_ASN1_GENERALIZEDTIME = global i8* null
define i32 @ASN1_GENERALIZEDTIME_set_string(%struct.TYPE_4__* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_4__*
%5 = alloca i8*
%6 = alloca %struct.TYPE_4__
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %4
store i8* %1, i8** %5
%7 = load i8*, i8** @V_ASN1_GENERALIZEDTIME
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 1
store i8* %7, i8** %8
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 2
store i32 %10, i32* %11
%12 = load i8*, i8** %5
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
store i8* %12, i8** %13
%14 = call i64 @ASN1_GENERALIZEDTIME_check(%struct.TYPE_4__* %6)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %2
%17 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%18 = icmp ne %struct.TYPE_4__* %17, null
br i1 %18, label %19, label %32
19: ; preds = %16
%20 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%21 = bitcast %struct.TYPE_4__* %20 to i32*
%22 = load i8*, i8** %5
%23 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 2
%24 = load i32, i32* %23
%25 = call i32 @ASN1_STRING_set(i32* %21, i8* %22, i32 %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %19
store i32 0, i32* %3
br label %34
28: ; preds = %19
%29 = load i8*, i8** @V_ASN1_GENERALIZEDTIME
%30 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%31 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %30, i32 0, i32 1
store i8* %29, i8** %31
br label %32
32: ; preds = %28, %16
store i32 1, i32* %3
br label %34
33: ; preds = %2
store i32 0, i32* %3
br label %34
34: ; preds = %33, %32, %27
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i8*, i8*, i32 }
@V_ASN1_GENERALIZEDTIME = global i8* null
define i32 @ASN1_GENERALIZEDTIME_set_string(%struct.TYPE_4__* %0, i8* %1) {
%3 = alloca %struct.TYPE_4__
%4 = bitcast %struct.TYPE_4__* %3 to i8*
%5 = load i8*, i8** @V_ASN1_GENERALIZEDTIME
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 1
store i8* %5, i8** %6
%7 = tail call i32 @strlen(i8* %1)
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 2
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 0
store i8* %1, i8** %9
%10 = call i64 @ASN1_GENERALIZEDTIME_check(%struct.TYPE_4__* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %2
%13 = icmp eq %struct.TYPE_4__* %0, null
br i1 %13, label %22, label %14
14: ; preds = %12
%15 = bitcast %struct.TYPE_4__* %0 to i32*
%16 = load i32, i32* %8
%17 = call i32 @ASN1_STRING_set(i32* %15, i8* %1, i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %14
%20 = load i8*, i8** @V_ASN1_GENERALIZEDTIME
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 1
store i8* %20, i8** %21
br label %22
22: ; preds = %2, %12, %19, %14
%23 = phi i32 [ 0, %14 ], [ 1, %19 ], [ 1, %12 ], [ 0, %2 ]
ret i32 %23
}