#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*/ dh1024_p;
typedef int /*<<< orphan*/ dh1024_g;
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(void) {
  static unsigned char dh1024_p[] = {
      0xF8, 0x81, 0x89, 0x7D, 0x14, 0x24, 0xC5, 0xD1, 0xE6, 0xF7, 0xBF, 0x3A,
      0xE4, 0x90, 0xF4, 0xFC, 0x73, 0xFB, 0x34, 0xB5, 0xFA, 0x4C, 0x56, 0xA2,
      0xEA, 0xA7, 0xE9, 0xC0, 0xC0, 0xCE, 0x89, 0xE1, 0xFA, 0x63, 0x3F, 0xB0,
      0x6B, 0x32, 0x66, 0xF1, 0xD1, 0x7B, 0xB0, 0x00, 0x8F, 0xCA, 0x87, 0xC2,
      0xAE, 0x98, 0x89, 0x26, 0x17, 0xC2, 0x05, 0xD2, 0xEC, 0x08, 0xD0, 0x8C,
      0xFF, 0x17, 0x52, 0x8C, 0xC5, 0x07, 0x93, 0x03, 0xB1, 0xF6, 0x2F, 0xB8,
      0x1C, 0x52, 0x47, 0x27, 0x1B, 0xDB, 0xD1, 0x8D, 0x9D, 0x69, 0x1D, 0x52,
      0x4B, 0x32, 0x81, 0xAA, 0x7F, 0x00, 0xC8, 0xDC, 0xE6, 0xD9, 0xCC, 0xC1,
      0x11, 0x2D, 0x37, 0x34, 0x6C, 0xEA, 0x02, 0x97, 0x4B, 0x0E, 0xBB, 0xB1,
      0x71, 0x33, 0x09, 0x15, 0xFD, 0xDD, 0x23, 0x87, 0x07, 0x5E, 0x89, 0xAB,
      0x6B, 0x7C, 0x5F, 0xEC, 0xA6, 0x24, 0xDC, 0x53,
  };
  static unsigned char dh1024_g[] = {
      0x02,
  };
  DH *dh;
  BIGNUM *p, *g;
  if ((dh = DH_new()) == NULL)
    return NULL;
  p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
  g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
  if ((p == NULL) || (g == NULL) || !DH_set0_pqg(dh, p, NULL, g)) {
    DH_free(dh);
    BN_free(p);
    BN_free(g);
    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    1210 <get_dh1024+0xc0>
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)
cmpq   $0x0,-0x18(%rbp)
je     11e0 <get_dh1024+0x90>
cmpq   $0x0,-0x20(%rbp)
je     11e0 <get_dh1024+0x90>
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    1208 <get_dh1024+0xb8>
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    1210 <get_dh1024+0xc0>
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     11c6 <get_dh1024+0x76>
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
test   %r14,%r14
je     11ae <get_dh1024+0x5e>
test   %r15,%r15
je     11ae <get_dh1024+0x5e>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %r15,%rcx
call   1030 <DH_set0_pqg@plt>
test   %eax,%eax
jne    11c8 <get_dh1024+0x78>
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.dh1024_p = internal global [128 x i8] c"\F8\81\89}\14$\C5\D1\E6\F7\BF:\E4\90\F4\FCs\FB4\B5\FALV\A2\EA\A7\E9\C0\C0\CE\89\E1\FAc?\B0k2f\F1\D1{\B0\00\8F\CA\87\C2\AE\98\89&\17\C2\05\D2\EC\08\D0\8C\FF\17R\8C\C5\07\93\03\B1\F6/\B8\1CRG'\1B\DB\D1\8D\9Di\1DRK2\81\AA\7F\00\C8\DC\E6\D9\CC\C1\11-74l\EA\02\97K\0E\BB\B1q3\09\15\FD\DD#\87\07^\89\ABk|_\EC\A6$\DCS"
@get_dh1024.dh1024_g = 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 %31
8: ; preds = %0
%9 = call i32* @BN_bin2bn(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_dh1024.dh1024_p, 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.dh1024_g, i64 0, i64 0), i32 1, i32* null)
store i32* %10, i32** %4
%11 = load i32*, i32** %3
%12 = icmp eq i32* %11, null
br i1 %12, label %22, label %13
13: ; preds = %8
%14 = load i32*, i32** %4
%15 = icmp eq i32* %14, null
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = load i32*, i32** %2
%18 = load i32*, i32** %3
%19 = load i32*, i32** %4
%20 = call i32 @DH_set0_pqg(i32* %17, i32* %18, i32* null, i32* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %16, %13, %8
%23 = load i32*, i32** %2
%24 = call i32 @DH_free(i32* %23)
%25 = load i32*, i32** %3
%26 = call i32 @BN_free(i32* %25)
%27 = load i32*, i32** %4
%28 = call i32 @BN_free(i32* %27)
store i32* null, i32** %1
br label %31
29: ; preds = %16
%30 = load i32*, i32** %2
store i32* %30, i32** %1
br label %31
31: ; preds = %29, %22, %7
%32 = load i32*, i32** %1
ret i32* %32
}

LLVM IR (-O2):
@get_dh1024.dh1024_p = internal global [128 x i8] c"\F8\81\89}\14$\C5\D1\E6\F7\BF:\E4\90\F4\FCs\FB4\B5\FALV\A2\EA\A7\E9\C0\C0\CE\89\E1\FAc?\B0k2f\F1\D1{\B0\00\8F\CA\87\C2\AE\98\89&\17\C2\05\D2\EC\08\D0\8C\FF\17R\8C\C5\07\93\03\B1\F6/\B8\1CRG'\1B\DB\D1\8D\9Di\1DRK2\81\AA\7F\00\C8\DC\E6\D9\CC\C1\11-74l\EA\02\97K\0E\BB\B1q3\09\15\FD\DD#\87\07^\89\ABk|_\EC\A6$\DCS"
@get_dh1024.dh1024_g = 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 %16, label %3
3: ; preds = %0
%4 = tail call i32* @BN_bin2bn(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @get_dh1024.dh1024_p, 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.dh1024_g, i64 0, i64 0), i32 1, i32* null)
%6 = icmp eq i32* %4, null
%7 = icmp eq i32* %5, null
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i32 @DH_set0_pqg(i32* %1, i32* %4, i32* null, i32* %5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9, %3
%13 = tail call i32 @DH_free(i32* %1)
%14 = tail call i32 @BN_free(i32* %4)
%15 = tail call i32 @BN_free(i32* %5)
br label %16
16: ; preds = %9, %0, %12
%17 = phi i32* [ null, %12 ], [ null, %0 ], [ %1, %9 ]
ret i32* %17
}