#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*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ harnessTlsServerAccept();
int /*<<< orphan*/ harnessTlsServerClose();
int /*<<< orphan*/ harnessTlsServerInit(int /*<<< orphan*/, int /*<<< orphan*/,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ harnessTlsTestPort();
int /*<<< orphan*/ strNewFmt(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strPtr(int /*<<< orphan*/);
scalar_t__ testContainer();
int /*<<< orphan*/ testRepoPath();
void testTlsServerAltName(void) {
  if (fork() == 0) {
    harnessTlsServerInit(harnessTlsTestPort(),
                         strPtr(strNewFmt("%s/"
                                          "test/certificate/pgbackrest-test"
                                          "-alt-name.crt",
                                          testRepoPath())),
                         strPtr(strNewFmt("%s/"
                                          "test/certificate/pgbackrest-test"
                                          ".key",
                                          testRepoPath())));
    harnessTlsServerAccept();
    harnessTlsServerClose();
    if (testContainer()) {
      harnessTlsServerAccept();
      harnessTlsServerClose();
      harnessTlsServerAccept();
      harnessTlsServerClose();
      harnessTlsServerAccept();
      harnessTlsServerClose();
    }
    harnessTlsServerAccept();
    harnessTlsServerClose();
    harnessTlsServerAccept();
    harnessTlsServerClose();
    exit(0);
  }
}


x86 assembly (clang, -O0):
<testTlsServerAltName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   10b0 <fork@plt>
cmp    $0x0,%rax
jne    1277 <testTlsServerAltName+0xd7>
mov    $0x0,%al
call   1080 <harnessTlsTestPort@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <testRepoPath@plt>
mov    %eax,%esi
lea    0xe2d(%rip),%rdi
call   10c0 <strNewFmt@plt>
mov    %eax,%edi
call   1090 <strPtr@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1070 <testRepoPath@plt>
mov    %eax,%esi
lea    0xe3f(%rip),%rdi
call   10c0 <strNewFmt@plt>
mov    %eax,%edi
call   1090 <strPtr@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    %eax,%edx
call   1040 <harnessTlsServerInit@plt>
mov    $0x0,%al
call   1030 <harnessTlsServerAccept@plt>
mov    $0x0,%al
call   1050 <harnessTlsServerClose@plt>
mov    $0x0,%al
call   1060 <testContainer@plt>
cmp    $0x0,%rax
je     1254 <testTlsServerAltName+0xb4>
mov    $0x0,%al
call   1030 <harnessTlsServerAccept@plt>
mov    $0x0,%al
call   1050 <harnessTlsServerClose@plt>
mov    $0x0,%al
call   1030 <harnessTlsServerAccept@plt>
mov    $0x0,%al
call   1050 <harnessTlsServerClose@plt>
mov    $0x0,%al
call   1030 <harnessTlsServerAccept@plt>
mov    $0x0,%al
call   1050 <harnessTlsServerClose@plt>
mov    $0x0,%al
call   1030 <harnessTlsServerAccept@plt>
mov    $0x0,%al
call   1050 <harnessTlsServerClose@plt>
mov    $0x0,%al
call   1030 <harnessTlsServerAccept@plt>
mov    $0x0,%al
call   1050 <harnessTlsServerClose@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTlsServerAltName>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   10b0 <fork@plt>
test   %rax,%rax
je     11b6 <testTlsServerAltName+0x16>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
call   1080 <harnessTlsTestPort@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <testRepoPath@plt>
lea    0xe33(%rip),%rdi
mov    %eax,%esi
call   10c0 <strNewFmt@plt>
mov    %eax,%edi
call   1090 <strPtr@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <testRepoPath@plt>
lea    0xe46(%rip),%rdi
mov    %eax,%esi
call   10c0 <strNewFmt@plt>
mov    %eax,%edi
call   1090 <strPtr@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <harnessTlsServerInit@plt>
xor    %eax,%eax
call   1030 <harnessTlsServerAccept@plt>
xor    %eax,%eax
call   1050 <harnessTlsServerClose@plt>
xor    %eax,%eax
call   1060 <testContainer@plt>
test   %rax,%rax
je     1248 <testTlsServerAltName+0xa8>
xor    %eax,%eax
call   1030 <harnessTlsServerAccept@plt>
xor    %eax,%eax
call   1050 <harnessTlsServerClose@plt>
xor    %eax,%eax
call   1030 <harnessTlsServerAccept@plt>
xor    %eax,%eax
call   1050 <harnessTlsServerClose@plt>
xor    %eax,%eax
call   1030 <harnessTlsServerAccept@plt>
xor    %eax,%eax
call   1050 <harnessTlsServerClose@plt>
xor    %eax,%eax
call   1030 <harnessTlsServerAccept@plt>
xor    %eax,%eax
call   1050 <harnessTlsServerClose@plt>
xor    %eax,%eax
call   1030 <harnessTlsServerAccept@plt>
xor    %eax,%eax
call   1050 <harnessTlsServerClose@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"%s/test/certificate/pgbackrest-test-alt-name.crt\00"
@.str.1 = [40 x i8] c"%s/test/certificate/pgbackrest-test.key\00"
define void @testTlsServerAltName() {
%1 = call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %29
3: ; preds = %0
%4 = call i32 (...) @harnessTlsTestPort()
%5 = call i32 (...) @testRepoPath()
%6 = call i32 @strNewFmt(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @strPtr(i32 %6)
%8 = call i32 (...) @testRepoPath()
%9 = call i32 @strNewFmt(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @strPtr(i32 %9)
%11 = call i32 @harnessTlsServerInit(i32 %4, i32 %7, i32 %10)
%12 = call i32 (...) @harnessTlsServerAccept()
%13 = call i32 (...) @harnessTlsServerClose()
%14 = call i64 (...) @testContainer()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %3
%17 = call i32 (...) @harnessTlsServerAccept()
%18 = call i32 (...) @harnessTlsServerClose()
%19 = call i32 (...) @harnessTlsServerAccept()
%20 = call i32 (...) @harnessTlsServerClose()
%21 = call i32 (...) @harnessTlsServerAccept()
%22 = call i32 (...) @harnessTlsServerClose()
br label %23
23: ; preds = %16, %3
%24 = call i32 (...) @harnessTlsServerAccept()
%25 = call i32 (...) @harnessTlsServerClose()
%26 = call i32 (...) @harnessTlsServerAccept()
%27 = call i32 (...) @harnessTlsServerClose()
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"%s/test/certificate/pgbackrest-test-alt-name.crt\00"
@.str.1 = [40 x i8] c"%s/test/certificate/pgbackrest-test.key\00"
define void @testTlsServerAltName() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %29
3: ; preds = %0
%4 = tail call i32 (...) @harnessTlsTestPort()
%5 = tail call i32 (...) @testRepoPath()
%6 = tail call i32 @strNewFmt(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @strPtr(i32 %6)
%8 = tail call i32 (...) @testRepoPath()
%9 = tail call i32 @strNewFmt(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 @strPtr(i32 %9)
%11 = tail call i32 @harnessTlsServerInit(i32 %4, i32 %7, i32 %10)
%12 = tail call i32 (...) @harnessTlsServerAccept()
%13 = tail call i32 (...) @harnessTlsServerClose()
%14 = tail call i64 (...) @testContainer()
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %3
%17 = tail call i32 (...) @harnessTlsServerAccept()
%18 = tail call i32 (...) @harnessTlsServerClose()
%19 = tail call i32 (...) @harnessTlsServerAccept()
%20 = tail call i32 (...) @harnessTlsServerClose()
%21 = tail call i32 (...) @harnessTlsServerAccept()
%22 = tail call i32 (...) @harnessTlsServerClose()
br label %23
23: ; preds = %16, %3
%24 = tail call i32 (...) @harnessTlsServerAccept()
%25 = tail call i32 (...) @harnessTlsServerClose()
%26 = tail call i32 (...) @harnessTlsServerAccept()
%27 = tail call i32 (...) @harnessTlsServerClose()
%28 = tail call i32 @exit(i32 0)
unreachable
29: ; preds = %0
ret void
}