#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*/ dhp_1024;
typedef int /*<<< orphan*/ dhg_1024;
typedef int /*<<< orphan*/ DH;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ *BN_bin2bn(unsigned char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ DH_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *DH_new();
int /*<<< orphan*/ DH_set0_pqg(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *, int /*<<< orphan*/ *);
DH *get_dh1024() {
  static unsigned char dhp_1024[] = {
      0x85, 0x08, 0xFF, 0x6C, 0xC1, 0x0C, 0x23, 0x55, 0xC5, 0xF8, 0x3D, 0x47,
      0x6F, 0x23, 0x36, 0xDA, 0x98, 0xF3, 0xE4, 0x56, 0xCD, 0xA0, 0xF3, 0x02,
      0x18, 0xB0, 0xCB, 0xD2, 0x92, 0x4B, 0xDC, 0x76, 0x2B, 0x24, 0x2B, 0x20,
      0xD9, 0x6D, 0x5B, 0x59, 0xC8, 0x04, 0xD1, 0x67, 0xFA, 0x53, 0x5D, 0x46,
      0xA9, 0x3A, 0x62, 0x72, 0x1D, 0xE6, 0x58, 0x20, 0xD7, 0x60, 0xF0, 0xAD,
      0xCE, 0x52, 0xD5, 0x7B, 0x21, 0x80, 0x5A, 0x18, 0x78, 0x86, 0x17, 0xD5,
      0xE7, 0xEE, 0x7D, 0xC7, 0x35, 0xEB, 0x4D, 0xC1, 0x4D, 0x47, 0x2A, 0x89,
      0x3D, 0xB1, 0x70, 0x41, 0xCE, 0x04, 0x27, 0xDB, 0x34, 0x6D, 0xA3, 0x0E,
      0x76, 0xE6, 0x56, 0xF3, 0x79, 0x0B, 0x95, 0x59, 0x97, 0x4F, 0x24, 0x06,
      0xF4, 0xB8, 0xB7, 0x5B, 0xEF, 0x7E, 0x06, 0x43, 0x2A, 0x8E, 0x33, 0x69,
      0x71, 0x65, 0x35, 0xBF, 0xCB, 0xCD, 0xB0, 0x5B,
  };
  static unsigned char dhg_1024[] = {
      0x02,
  };
  DH *dh;
  BIGNUM *dhp_bn, *dhg_bn;
  if ((dh = DH_new()) == NULL)
    return (NULL);
  dhp_bn = BN_bin2bn(dhp_1024, sizeof(dhp_1024), NULL);
  dhg_bn = BN_bin2bn(dhg_1024, sizeof(dhg_1024), NULL);
  if (!DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
    DH_free(dh);
    BN_free(dhp_bn);
    BN_free(dhg_bn);
    return (NULL);
  }
  return (dh);
}


x86 assembly (clang, -O0):
<get_dh1024>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <DH_new@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    117a <get_dh1024+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    11fa <get_dh1024+0xaa>
lea    0x2ecf(%rip),%rdi
mov    $0x80,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <BN_bin2bn@plt>
mov    %rax,-0x18(%rbp)
lea    0x2f36(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <BN_bin2bn@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <DH_set0_pqg@plt>
cmp    $0x0,%eax
jne    11f2 <get_dh1024+0xa2>
mov    -0x10(%rbp),%rdi
call   1070 <DH_free@plt>
mov    -0x18(%rbp),%rdi
call   1060 <BN_free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <BN_free@plt>
movq   $0x0,-0x8(%rbp)
jmp    11fa <get_dh1024+0xaa>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dh1024>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <DH_new@plt>
test   %rax,%rax
je     11bc <get_dh1024+0x6c>
mov    %rax,%rbx
lea    0x2ee5(%rip),%rdi
mov    $0x80,%esi
xor    %edx,%edx
call   1040 <BN_bin2bn@plt>
mov    %rax,%r14
lea    0x2f4f(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <BN_bin2bn@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %rax,%rcx
call   1030 <DH_set0_pqg@plt>
test   %eax,%eax
jne    11be <get_dh1024+0x6e>
mov    %rbx,%rdi
call   1070 <DH_free@plt>
mov    %r14,%rdi
call   1060 <BN_free@plt>
mov    %r15,%rdi
call   1060 <BN_free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@get_dh1024.dhp_1024 = internal global [128 x i8] c"\85\08\FFl\C1\0C#U\C5\F8=Go\DA\98\F3\E4V\CD\A0\F3\02\18\B0\CB\D2\92K\DCv+$+ \D9m[Y\C8\04\D1g\FAS]F\A9:br\1D\E6X \D7`\F0\AD\CER\D5{!\80Z\18x\86\17\D5\E7\EE}\C75\EBM\C1MG*\89=\B1pA\CE\04'\DB4m\A3\0Ev\E6V\F3y\0B\95Y\97O$\06\F4\B8\B7[\EF~\06C*\8E3iqe5\BF\CB\CD\B0["
@get_dh1024.dhg_1024 = internal global [1 x i8] c"\02"
define i32* @get_dh1024() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = call i32* (...) @DH_new()
store i32* %5, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %0
store i32* null, i32** %1
br label %25
8: ; preds = %0
%9 = call i32* @BN_bin2bn(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_dh1024.dhp_1024, i64 0, i64 0), i32 128, i32* null)
store i32* %9, i32** %3
%10 = call i32* @BN_bin2bn(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @get_dh1024.dhg_1024, i64 0, i64 0), i32 1, i32* null)
store i32* %10, i32** %4
%11 = load i32*, i32** %2
%12 = load i32*, i32** %3
%13 = load i32*, i32** %4
%14 = call i32 @DH_set0_pqg(i32* %11, i32* %12, i32* null, i32* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %8
%17 = load i32*, i32** %2
%18 = call i32 @DH_free(i32* %17)
%19 = load i32*, i32** %3
%20 = call i32 @BN_free(i32* %19)
%21 = load i32*, i32** %4
%22 = call i32 @BN_free(i32* %21)
store i32* null, i32** %1
br label %25
23: ; preds = %8
%24 = load i32*, i32** %2
store i32* %24, i32** %1
br label %25
25: ; preds = %23, %16, %7
%26 = load i32*, i32** %1
ret i32* %26
}

LLVM IR (-O2):
@get_dh1024.dhp_1024 = internal global [128 x i8] c"\85\08\FFl\C1\0C#U\C5\F8=Go\DA\98\F3\E4V\CD\A0\F3\02\18\B0\CB\D2\92K\DCv+$+ \D9m[Y\C8\04\D1g\FAS]F\A9:br\1D\E6X \D7`\F0\AD\CER\D5{!\80Z\18x\86\17\D5\E7\EE}\C75\EBM\C1MG*\89=\B1pA\CE\04'\DB4m\A3\0Ev\E6V\F3y\0B\95Y\97O$\06\F4\B8\B7[\EF~\06C*\8E3iqe5\BF\CB\CD\B0["
@get_dh1024.dhg_1024 = internal global [1 x i8] c"\02"
define i32* @get_dh1024() {
%1 = tail call i32* (...) @DH_new()
%2 = icmp eq i32* %1, null
br i1 %2, label %12, label %3
3: ; preds = %0
%4 = tail call i32* @BN_bin2bn(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_dh1024.dhp_1024, i64 0, i64 0), i32 128, i32* null)
%5 = tail call i32* @BN_bin2bn(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @get_dh1024.dhg_1024, i64 0, i64 0), i32 1, i32* null)
%6 = tail call i32 @DH_set0_pqg(i32* %1, i32* %4, i32* null, i32* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 @DH_free(i32* %1)
%10 = tail call i32 @BN_free(i32* %4)
%11 = tail call i32 @BN_free(i32* %5)
br label %12
12: ; preds = %3, %0, %8
%13 = phi i32* [ null, %8 ], [ null, %0 ], [ %1, %3 ]
ret i32* %13
}