llvm/bolt/test/X86/MachO/emit_new_binary_with_external_symbol.test

# RUN: yaml2obj -o %t.exe %p/Inputs/external_symbol.yaml
# RUN: llvm-bolt -o %t.original %t.exe
# RUN: llvm-objdump --macho --disassemble-all --no-print-imm-hex %t.original | FileCheck --check-prefix=ORIGINAL %s

# ORIGINAL:       _main:
# ORIGINAL-NEXT:  100000f50:	55	pushq	%rbp
# ORIGINAL-NEXT:  100000f51:	48 89 e5	movq	%rsp, %rbp
# ORIGINAL-NEXT:  100000f54:	48 83 ec 20	subq	$32, %rsp
# ORIGINAL-NEXT:  100000f58:	c7 45 fc 00 00 00 00	movl	$0, -4(%rbp)
# ORIGINAL-NEXT:  100000f5f:	89 7d f8	movl	%edi, -8(%rbp)
# ORIGINAL-NEXT:  100000f62:	48 89 75 f0	movq	%rsi, -16(%rbp)
# ORIGINAL-NEXT:  100000f66:	83 7d f8 01	cmpl	$1, -8(%rbp)
# ORIGINAL-NEXT:  100000f6a:	7e 0a	jle	0x100000f76
# ORIGINAL-NEXT:  100000f6c:	e8 25 00 00 00	callq	0x100000f96
# ORIGINAL-NEXT:  100000f71:	89 45 fc	movl	%eax, -4(%rbp)
# ORIGINAL-NEXT:  100000f74:	eb 10	jmp	0x100000f86
# ORIGINAL-NEXT:  100000f76:	c7 45 ec 01 00 00 00	movl	$1, -20(%rbp)
# ORIGINAL-NEXT:  100000f7d:	8b 45 ec	movl	-20(%rbp), %eax
# ORIGINAL-NEXT:  100000f80:	83 c0 02	addl	$2, %eax
# ORIGINAL-NEXT:  100000f83:	89 45 fc	movl	%eax, -4(%rbp)
# ORIGINAL-NEXT:  100000f86:	8b 45 fc	movl	-4(%rbp), %eax
# ORIGINAL-NEXT:  100000f89:	48 83 c4 20	addq	$32, %rsp
# ORIGINAL-NEXT:  100000f8d:	5d	popq	%rbp
# ORIGINAL-NEXT:  100000f8e:	c3	retq
# ORIGINAL-NEXT:  100000f8f:	fc	cld
# ORIGINAL-NEXT:  100000f90:	48 83 c4 20	addq	$32, %rsp
# ORIGINAL-NEXT:  100000f94:	5d	popq	%rbp
# ORIGINAL-NEXT:  100000f95:	c3	retq

# RUN: llvm-bolt -o %t.reversed -reorder-blocks=reverse %t.exe
# RUN: llvm-objdump --macho --disassemble-all --no-print-imm-hex %t.reversed | FileCheck --check-prefix=REVERSED %s

# REVERSED:       _main:
# REVERSED-NEXT: 100000f50:	55	pushq	%rbp
# REVERSED-NEXT: 100000f51:	48 89 e5	movq	%rsp, %rbp
# REVERSED-NEXT: 100000f54:	48 83 ec 20	subq	$32, %rsp
# REVERSED-NEXT: 100000f58:	c7 45 fc 00 00 00 00	movl	$0, -4(%rbp)
# REVERSED-NEXT: 100000f5f:	89 7d f8	movl	%edi, -8(%rbp)
# REVERSED-NEXT: 100000f62:	48 89 75 f0	movq	%rsi, -16(%rbp)
# REVERSED-NEXT: 100000f66:	83 7d f8 01	cmpl	$1, -8(%rbp)
# REVERSED-NEXT: 100000f6a:	7e 0b	jle	0x100000f77
# REVERSED-NEXT: 100000f6c:	eb 1b	jmp	0x100000f89
# REVERSED-NEXT: 100000f6e:	8b 45 fc	movl	-4(%rbp), %eax
# REVERSED-NEXT: 100000f71:	48 83 c4 20	addq	$32, %rsp
# REVERSED-NEXT: 100000f75:	5d	popq	%rbp
# REVERSED-NEXT: 100000f76:	c3	retq
# REVERSED-NEXT: 100000f77:	c7 45 ec 01 00 00 00	movl	$1, -20(%rbp)
# REVERSED-NEXT: 100000f7e:	8b 45 ec	movl	-20(%rbp), %eax
# REVERSED-NEXT: 100000f81:	83 c0 02	addl	$2, %eax
# REVERSED-NEXT: 100000f84:	89 45 fc	movl	%eax, -4(%rbp)
# REVERSED-NEXT: 100000f87:	eb e5	jmp	0x100000f6e
# REVERSED-NEXT: 100000f89:	e8 08 00 00 00	callq	0x100000f96
# REVERSED-NEXT: 100000f8e:	89 45 fc	movl	%eax, -4(%rbp)
# REVERSED-NEXT: 100000f91:	eb db	jmp	0x100000f6e
# REVERSED-NEXT: 100000f93:	20 5d c3	andb	%bl, -61(%rbp)