// File: WeihuaZhu[P]hpc_prog2/./gtest/gtest-all.cc
// Function: testing::internal::CapturedStream::CapturedStream(int)
explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
# if GTEST_OS_WINDOWS
    char temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
    char temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT

    ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
    const UINT success = ::GetTempFileNameA(temp_dir_path,
                                            "gtest_redir",
                                            0,  // Generate unique file name.
                                            temp_file_path);
    GTEST_CHECK_(success != 0)
        << "Unable to create a temporary file in " << temp_dir_path;
    const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
    GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
                                    << temp_file_path;
    filename_ = temp_file_path;
# else
    // There's no guarantee that a test has write access to the current
    // directory, so we create the temporary file in the /tmp directory
    // instead. We use /tmp on most systems, and /sdcard on Android.
    // That's because Android doesn't have /tmp.
#  if GTEST_OS_LINUX_ANDROID
    // Note: Android applications are expected to call the framework's
    // Context.getExternalStorageDirectory() method through JNI to get
    // the location of the world-writable SD Card directory. However,
    // this requires a Context handle, which cannot be retrieved
    // globally from native code. Doing so also precludes running the
    // code as part of a regular standalone executable, which doesn't
    // run in a Dalvik process (e.g. when running it through 'adb shell').
    //
    // The location /sdcard is directly accessible from native code
    // and is the only location (unofficially) supported by the Android
    // team. It's generally a symlink to the real SD Card mount point
    // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or
    // other OEM-customized locations. Never rely on these, and always
    // use /sdcard.
    char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX";
#  else
    char name_template[] = "/tmp/captured_stream.XXXXXX";
#  endif  // GTEST_OS_LINUX_ANDROID
    const int captured_fd = mkstemp(name_template);
    filename_ = name_template;
# endif  // GTEST_OS_WINDOWS
    fflush(NULL);
    dup2(captured_fd, fd_);
    close(captured_fd);
  }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x4c(%rsp), %ecx
movl %ecx, (%rax)
movl 0x4c(%rsp), %edi
callq 0xf140
movq 0x8(%rsp), %rdi
movl %eax, 0x4(%rdi)
addq $0x8, %rdi
movq %rdi, 0x10(%rsp)
callq 0xefa0
movups 0x13e69(%rip), %xmm0    # 0x4e8ac
movups %xmm0, 0x3c(%rsp)
movaps 0x13e51(%rip), %xmm0    # 0x4e8a0
movaps %xmm0, 0x30(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xe2c0
movl %eax, 0x18(%rsp)
jmp 0x3aa64
movq 0x8(%rsp), %rdi
movl 0x18(%rsp), %eax
movl %eax, 0x2c(%rsp)
addq $0x8, %rdi
leaq 0x30(%rsp), %rsi
callq 0xef40
jmp 0x3aa81
xorl %eax, %eax
movl %eax, %edi
callq 0xecc0
jmp 0x3aa8c
movq 0x8(%rsp), %rax
movl 0x2c(%rsp), %edi
movl (%rax), %esi
callq 0xe960
movl 0x2c(%rsp), %edi
callq 0xf640
jmp 0x3aaa7
addq $0x58, %rsp
retq
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
callq 0xf698
movq 0x20(%rsp), %rdi
callq 0xf410
nop