Created
July 20, 2012 07:39
-
-
Save nlguillemot/3149325 to your computer and use it in GitHub Desktop.
constexpr string hashing compiler behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ | |
return ( !str ? 0 : | |
_hash_string_recursive(5381, str)); | |
} | |
static_assert(hash_string("foo") != hash_string("bar"), "compare different hashed string by key"); | |
static_assert(hash_string("foo") == hash_string("foo"), "compare identical strings by key"); | |
static_assert(hash_string("bar") < hash_string("foo"), "compare strings by key ordering"); | |
int main() | |
{ | |
unsigned foo(hash_string("foo")); | |
unsigned bar(hash_string("bar")); | |
std::string s; | |
std::cin >> s; | |
unsigned rtimehash(hash_string(s.c_str())); | |
if (foo == rtimehash) | |
{ | |
std::cout << "foo" << std::endl; | |
std::cout << foo << std::endl; | |
} | |
else if (bar == rtimehash) | |
{ | |
std::cout << "bar" << std::endl; | |
std::cout << foo << std::endl; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "hashstr.cpp" | |
.section .rodata.str1.1,"aMS",@progbits,1 | |
.LC0: | |
.string "foo" | |
.LC1: | |
.string "bar" | |
.section .text.startup,"ax",@progbits | |
.p2align 4,,15 | |
.globl main | |
.type main, @function | |
main: | |
.LFB1277: | |
.cfi_startproc | |
.cfi_personality 0,__gxx_personality_v0 | |
.cfi_lsda 0,.LLSDA1277 | |
pushl %ebp | |
.cfi_def_cfa_offset 8 | |
.cfi_offset 5, -8 | |
movl $102, %edx | |
movl %esp, %ebp | |
.cfi_def_cfa_register 5 | |
movl $.LC0, %eax | |
pushl %edi | |
pushl %esi | |
pushl %ebx | |
movl $5381, %ebx | |
.cfi_offset 3, -20 | |
.cfi_offset 6, -16 | |
.cfi_offset 7, -12 | |
andl $-16, %esp | |
subl $32, %esp | |
.p2align 4,,7 | |
.p2align 3 | |
.L2: | |
movl %ebx, %ecx | |
movsbl %dl, %edx | |
sall $5, %ecx | |
addl $1, %eax | |
addl %ecx, %edx | |
addl %edx, %ebx | |
movzbl (%eax), %edx | |
testb %dl, %dl | |
jne .L2 | |
movl $5381, %esi | |
movl $98, %edx | |
movl $.LC1, %eax | |
.p2align 4,,7 | |
.p2align 3 | |
.L3: | |
movl %esi, %ecx | |
movsbl %dl, %edx | |
sall $5, %ecx | |
addl $1, %eax | |
addl %ecx, %edx | |
addl %edx, %esi | |
movzbl (%eax), %edx | |
testb %dl, %dl | |
jne .L3 | |
leal 28(%esp), %eax | |
movl $_ZNSs4_Rep20_S_empty_rep_storageE+12, 28(%esp) | |
movl %eax, 4(%esp) | |
movl $_ZSt3cin, (%esp) | |
.LEHB0: | |
call _ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_E | |
movl 28(%esp), %eax | |
xorl %edi, %edi | |
testl %eax, %eax | |
je .L7 | |
movzbl (%eax), %edx | |
movw $5381, %di | |
testb %dl, %dl | |
je .L7 | |
.p2align 4,,7 | |
.p2align 3 | |
.L8: | |
movl %edi, %ecx | |
movsbl %dl, %edx | |
sall $5, %ecx | |
addl $1, %eax | |
addl %ecx, %edx | |
addl %edx, %edi | |
movzbl (%eax), %edx | |
testb %dl, %dl | |
jne .L8 | |
.L7: | |
cmpl %ebx, %edi | |
je .L22 | |
cmpl %esi, %edi | |
je .L23 | |
.L10: | |
leal 28(%esp), %eax | |
movl %eax, (%esp) | |
call _ZNSsD1Ev | |
leal -12(%ebp), %esp | |
xorl %eax, %eax | |
popl %ebx | |
.cfi_remember_state | |
.cfi_restore 3 | |
popl %esi | |
.cfi_restore 6 | |
popl %edi | |
.cfi_restore 7 | |
popl %ebp | |
.cfi_def_cfa 4, 4 | |
.cfi_restore 5 | |
ret | |
.L23: | |
.cfi_restore_state | |
movl $.LC1, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc | |
movl %eax, (%esp) | |
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ | |
movl %ebx, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZNSo9_M_insertImEERSoT_ | |
.L20: | |
movl %eax, (%esp) | |
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ | |
jmp .L10 | |
.L22: | |
movl $.LC0, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc | |
movl %eax, (%esp) | |
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ | |
movl %edi, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZNSo9_M_insertImEERSoT_ | |
.LEHE0: | |
jmp .L20 | |
.L14: | |
movl %eax, %ebx | |
leal 28(%esp), %eax | |
movl %eax, (%esp) | |
call _ZNSsD1Ev | |
movl %ebx, (%esp) | |
.LEHB1: | |
call _Unwind_Resume | |
.LEHE1: | |
.cfi_endproc | |
.LFE1277: | |
.globl __gxx_personality_v0 | |
.section .gcc_except_table,"a",@progbits | |
.LLSDA1277: | |
.byte 0xff | |
.byte 0xff | |
.byte 0x1 | |
.uleb128 .LLSDACSE1277-.LLSDACSB1277 | |
.LLSDACSB1277: | |
.uleb128 .LEHB0-.LFB1277 | |
.uleb128 .LEHE0-.LEHB0 | |
.uleb128 .L14-.LFB1277 | |
.uleb128 0 | |
.uleb128 .LEHB1-.LFB1277 | |
.uleb128 .LEHE1-.LEHB1 | |
.uleb128 0 | |
.uleb128 0 | |
.LLSDACSE1277: | |
.section .text.startup | |
.size main, .-main | |
.p2align 4,,15 | |
.type _GLOBAL__sub_I_main, @function | |
_GLOBAL__sub_I_main: | |
.LFB1437: | |
.cfi_startproc | |
subl $28, %esp | |
.cfi_def_cfa_offset 32 | |
movl $_ZStL8__ioinit, (%esp) | |
call _ZNSt8ios_base4InitC1Ev | |
movl $__dso_handle, 8(%esp) | |
movl $_ZStL8__ioinit, 4(%esp) | |
movl $_ZNSt8ios_base4InitD1Ev, (%esp) | |
call __cxa_atexit | |
addl $28, %esp | |
.cfi_def_cfa_offset 4 | |
ret | |
.cfi_endproc | |
.LFE1437: | |
.size _GLOBAL__sub_I_main, .-_GLOBAL__sub_I_main | |
.section .ctors,"aw",@progbits | |
.align 4 | |
.long _GLOBAL__sub_I_main | |
.local _ZStL8__ioinit | |
.comm _ZStL8__ioinit,1,1 | |
.weakref _ZL20__gthrw_pthread_oncePiPFvvE,pthread_once | |
.weakref _ZL27__gthrw_pthread_getspecificj,pthread_getspecific | |
.weakref _ZL27__gthrw_pthread_setspecificjPKv,pthread_setspecific | |
.weakref _ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_,pthread_create | |
.weakref _ZL20__gthrw_pthread_joinmPPv,pthread_join | |
.weakref _ZL21__gthrw_pthread_equalmm,pthread_equal | |
.weakref _ZL20__gthrw_pthread_selfv,pthread_self | |
.weakref _ZL22__gthrw_pthread_detachm,pthread_detach | |
.weakref _ZL22__gthrw_pthread_cancelm,pthread_cancel | |
.weakref _ZL19__gthrw_sched_yieldv,sched_yield | |
.weakref _ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t,pthread_mutex_lock | |
.weakref _ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t,pthread_mutex_trylock | |
.weakref _ZL31__gthrw_pthread_mutex_timedlockP15pthread_mutex_tPK8timespec,pthread_mutex_timedlock | |
.weakref _ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t,pthread_mutex_unlock | |
.weakref _ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t,pthread_mutex_init | |
.weakref _ZL29__gthrw_pthread_mutex_destroyP15pthread_mutex_t,pthread_mutex_destroy | |
.weakref _ZL30__gthrw_pthread_cond_broadcastP14pthread_cond_t,pthread_cond_broadcast | |
.weakref _ZL27__gthrw_pthread_cond_signalP14pthread_cond_t,pthread_cond_signal | |
.weakref _ZL25__gthrw_pthread_cond_waitP14pthread_cond_tP15pthread_mutex_t,pthread_cond_wait | |
.weakref _ZL30__gthrw_pthread_cond_timedwaitP14pthread_cond_tP15pthread_mutex_tPK8timespec,pthread_cond_timedwait | |
.weakref _ZL28__gthrw_pthread_cond_destroyP14pthread_cond_t,pthread_cond_destroy | |
.weakref _ZL26__gthrw_pthread_key_createPjPFvPvE,pthread_key_create | |
.weakref _ZL26__gthrw_pthread_key_deletej,pthread_key_delete | |
.weakref _ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t,pthread_mutexattr_init | |
.weakref _ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti,pthread_mutexattr_settype | |
.weakref _ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t,pthread_mutexattr_destroy | |
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3" | |
.section .note.GNU-stack,"",@progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ | |
return ( !str ? 0 : | |
_hash_string_recursive(5381, str)); | |
} | |
static_assert(hash_string("foo") != hash_string("bar"), "compare different hashed string by key"); | |
static_assert(hash_string("foo") == hash_string("foo"), "compare identical strings by key"); | |
static_assert(hash_string("bar") < hash_string("foo"), "compare strings by key ordering"); | |
int main() | |
{ | |
std::string s; | |
std::cin >> s; | |
unsigned rtimehash(hash_string(s.c_str())); | |
if (hash_string("foo") == rtimehash) | |
{ | |
std::cout << "foo" << std::endl; | |
} | |
else if (hash_string("bar") == rtimehash) | |
{ | |
std::cout << "bar" << std::endl; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "hashstr.cpp" | |
.section .rodata.str1.1,"aMS",@progbits,1 | |
.LC0: | |
.string "foo" | |
.LC1: | |
.string "bar" | |
.section .text.startup,"ax",@progbits | |
.p2align 4,,15 | |
.globl main | |
.type main, @function | |
main: | |
.LFB1277: | |
.cfi_startproc | |
.cfi_personality 0,__gxx_personality_v0 | |
.cfi_lsda 0,.LLSDA1277 | |
pushl %ebp | |
.cfi_def_cfa_offset 8 | |
.cfi_offset 5, -8 | |
movl %esp, %ebp | |
.cfi_def_cfa_register 5 | |
pushl %edi | |
pushl %esi | |
pushl %ebx | |
andl $-16, %esp | |
subl $32, %esp | |
leal 28(%esp), %ebx | |
.cfi_offset 3, -20 | |
.cfi_offset 6, -16 | |
.cfi_offset 7, -12 | |
movl $_ZNSs4_Rep20_S_empty_rep_storageE+12, 28(%esp) | |
movl %ebx, 4(%esp) | |
movl $_ZSt3cin, (%esp) | |
.LEHB0: | |
call _ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_E | |
movl 28(%esp), %eax | |
xorl %esi, %esi | |
testl %eax, %eax | |
je .L4 | |
movzbl (%eax), %edx | |
movw $5381, %si | |
testb %dl, %dl | |
je .L4 | |
.p2align 4,,7 | |
.p2align 3 | |
.L5: | |
movl %esi, %ecx | |
movsbl %dl, %edx | |
sall $5, %ecx | |
addl $1, %eax | |
addl %ecx, %edx | |
addl %edx, %esi | |
movzbl (%eax), %edx | |
testb %dl, %dl | |
jne .L5 | |
.L4: | |
movl $5381, %eax | |
movl $102, %ecx | |
movl $.LC0, %edx | |
.p2align 4,,7 | |
.p2align 3 | |
.L6: | |
movl %eax, %edi | |
movsbl %cl, %ecx | |
sall $5, %edi | |
addl $1, %edx | |
addl %edi, %ecx | |
addl %ecx, %eax | |
movzbl (%edx), %ecx | |
testb %cl, %cl | |
jne .L6 | |
cmpl %eax, %esi | |
je .L20 | |
movl $5381, %eax | |
movl $98, %ecx | |
movl $.LC1, %edx | |
.p2align 4,,7 | |
.p2align 3 | |
.L7: | |
movl %eax, %edi | |
movsbl %cl, %ecx | |
sall $5, %edi | |
addl $1, %edx | |
addl %edi, %ecx | |
addl %ecx, %eax | |
movzbl (%edx), %ecx | |
testb %cl, %cl | |
jne .L7 | |
cmpl %esi, %eax | |
je .L21 | |
.L8: | |
movl %ebx, (%esp) | |
call _ZNSsD1Ev | |
leal -12(%ebp), %esp | |
xorl %eax, %eax | |
popl %ebx | |
.cfi_remember_state | |
.cfi_restore 3 | |
popl %esi | |
.cfi_restore 6 | |
popl %edi | |
.cfi_restore 7 | |
popl %ebp | |
.cfi_def_cfa 4, 4 | |
.cfi_restore 5 | |
ret | |
.L21: | |
.cfi_restore_state | |
movl $.LC1, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc | |
.L18: | |
movl %eax, (%esp) | |
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ | |
jmp .L8 | |
.L20: | |
movl $.LC0, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc | |
.LEHE0: | |
jmp .L18 | |
.L13: | |
movl %eax, %esi | |
movl %ebx, (%esp) | |
call _ZNSsD1Ev | |
movl %esi, (%esp) | |
.LEHB1: | |
call _Unwind_Resume | |
.LEHE1: | |
.cfi_endproc | |
.LFE1277: | |
.globl __gxx_personality_v0 | |
.section .gcc_except_table,"a",@progbits | |
.LLSDA1277: | |
.byte 0xff | |
.byte 0xff | |
.byte 0x1 | |
.uleb128 .LLSDACSE1277-.LLSDACSB1277 | |
.LLSDACSB1277: | |
.uleb128 .LEHB0-.LFB1277 | |
.uleb128 .LEHE0-.LEHB0 | |
.uleb128 .L13-.LFB1277 | |
.uleb128 0 | |
.uleb128 .LEHB1-.LFB1277 | |
.uleb128 .LEHE1-.LEHB1 | |
.uleb128 0 | |
.uleb128 0 | |
.LLSDACSE1277: | |
.section .text.startup | |
.size main, .-main | |
.p2align 4,,15 | |
.type _GLOBAL__sub_I_main, @function | |
_GLOBAL__sub_I_main: | |
.LFB1436: | |
.cfi_startproc | |
subl $28, %esp | |
.cfi_def_cfa_offset 32 | |
movl $_ZStL8__ioinit, (%esp) | |
call _ZNSt8ios_base4InitC1Ev | |
movl $__dso_handle, 8(%esp) | |
movl $_ZStL8__ioinit, 4(%esp) | |
movl $_ZNSt8ios_base4InitD1Ev, (%esp) | |
call __cxa_atexit | |
addl $28, %esp | |
.cfi_def_cfa_offset 4 | |
ret | |
.cfi_endproc | |
.LFE1436: | |
.size _GLOBAL__sub_I_main, .-_GLOBAL__sub_I_main | |
.section .ctors,"aw",@progbits | |
.align 4 | |
.long _GLOBAL__sub_I_main | |
.local _ZStL8__ioinit | |
.comm _ZStL8__ioinit,1,1 | |
.weakref _ZL20__gthrw_pthread_oncePiPFvvE,pthread_once | |
.weakref _ZL27__gthrw_pthread_getspecificj,pthread_getspecific | |
.weakref _ZL27__gthrw_pthread_setspecificjPKv,pthread_setspecific | |
.weakref _ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_,pthread_create | |
.weakref _ZL20__gthrw_pthread_joinmPPv,pthread_join | |
.weakref _ZL21__gthrw_pthread_equalmm,pthread_equal | |
.weakref _ZL20__gthrw_pthread_selfv,pthread_self | |
.weakref _ZL22__gthrw_pthread_detachm,pthread_detach | |
.weakref _ZL22__gthrw_pthread_cancelm,pthread_cancel | |
.weakref _ZL19__gthrw_sched_yieldv,sched_yield | |
.weakref _ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t,pthread_mutex_lock | |
.weakref _ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t,pthread_mutex_trylock | |
.weakref _ZL31__gthrw_pthread_mutex_timedlockP15pthread_mutex_tPK8timespec,pthread_mutex_timedlock | |
.weakref _ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t,pthread_mutex_unlock | |
.weakref _ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t,pthread_mutex_init | |
.weakref _ZL29__gthrw_pthread_mutex_destroyP15pthread_mutex_t,pthread_mutex_destroy | |
.weakref _ZL30__gthrw_pthread_cond_broadcastP14pthread_cond_t,pthread_cond_broadcast | |
.weakref _ZL27__gthrw_pthread_cond_signalP14pthread_cond_t,pthread_cond_signal | |
.weakref _ZL25__gthrw_pthread_cond_waitP14pthread_cond_tP15pthread_mutex_t,pthread_cond_wait | |
.weakref _ZL30__gthrw_pthread_cond_timedwaitP14pthread_cond_tP15pthread_mutex_tPK8timespec,pthread_cond_timedwait | |
.weakref _ZL28__gthrw_pthread_cond_destroyP14pthread_cond_t,pthread_cond_destroy | |
.weakref _ZL26__gthrw_pthread_key_createPjPFvPvE,pthread_key_create | |
.weakref _ZL26__gthrw_pthread_key_deletej,pthread_key_delete | |
.weakref _ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t,pthread_mutexattr_init | |
.weakref _ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti,pthread_mutexattr_settype | |
.weakref _ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t,pthread_mutexattr_destroy | |
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3" | |
.section .note.GNU-stack,"",@progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
constexpr unsigned _hash_string_recursive(unsigned hash, const char* str) | |
{ | |
return ( !*str ? hash : | |
_hash_string_recursive(((hash << 5) + hash) + *str, str + 1)); | |
} | |
constexpr unsigned hash_string(const char* str) | |
{ | |
return ( !str ? 0 : | |
_hash_string_recursive(5381, str)); | |
} | |
static_assert(hash_string("foo") != hash_string("bar"), "compare different hashed string by key"); | |
static_assert(hash_string("foo") == hash_string("foo"), "compare identical strings by key"); | |
static_assert(hash_string("bar") < hash_string("foo"), "compare strings by key ordering"); | |
int main() | |
{ | |
// note: "const" qualifier is NECESSARY OTHERWISE THE STRINGS WILL BE HASHED AT RUNTIME ANWAYSY!!!!!!!!!!!!!!!! | |
const unsigned foo(hash_string("foo")); | |
const unsigned bar(hash_string("bar")); | |
std::string s; | |
std::cin >> s; | |
unsigned rtimehash(hash_string(s.c_str())); | |
if (foo == rtimehash) | |
{ | |
std::cout << "foo" << std::endl; | |
std::cout << foo << std::endl; | |
} | |
else if (bar == rtimehash) | |
{ | |
std::cout << "bar" << std::endl; | |
std::cout << foo << std::endl; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "hashstr.cpp" | |
.section .rodata.str1.1,"aMS",@progbits,1 | |
.LC0: | |
.string "foo" | |
.LC1: | |
.string "bar" | |
.section .text.startup,"ax",@progbits | |
.p2align 4,,15 | |
.globl main | |
.type main, @function | |
main: | |
.LFB1277: | |
.cfi_startproc | |
.cfi_personality 0,__gxx_personality_v0 | |
.cfi_lsda 0,.LLSDA1277 | |
pushl %ebp | |
.cfi_def_cfa_offset 8 | |
.cfi_offset 5, -8 | |
movl %esp, %ebp | |
.cfi_def_cfa_register 5 | |
pushl %esi | |
pushl %ebx | |
andl $-16, %esp | |
subl $32, %esp | |
leal 28(%esp), %ebx | |
.cfi_offset 3, -16 | |
.cfi_offset 6, -12 | |
movl $_ZNSs4_Rep20_S_empty_rep_storageE+12, 28(%esp) | |
movl %ebx, 4(%esp) | |
movl $_ZSt3cin, (%esp) | |
.LEHB0: | |
call _ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_E | |
movl 28(%esp), %eax | |
testl %eax, %eax | |
je .L4 | |
movzbl (%eax), %ecx | |
testb %cl, %cl | |
je .L4 | |
movl $5381, %edx | |
.p2align 4,,7 | |
.p2align 3 | |
.L5: | |
movl %edx, %esi | |
movsbl %cl, %ecx | |
sall $5, %esi | |
addl $1, %eax | |
addl %esi, %ecx | |
addl %ecx, %edx | |
movzbl (%eax), %ecx | |
testb %cl, %cl | |
jne .L5 | |
cmpl $193491849, %edx | |
je .L17 | |
cmpl $193487034, %edx | |
je .L18 | |
.L4: | |
movl %ebx, (%esp) | |
call _ZNSsD1Ev | |
leal -8(%ebp), %esp | |
xorl %eax, %eax | |
popl %ebx | |
.cfi_remember_state | |
.cfi_restore 3 | |
popl %esi | |
.cfi_restore 6 | |
popl %ebp | |
.cfi_def_cfa 4, 4 | |
.cfi_restore 5 | |
ret | |
.L18: | |
.cfi_restore_state | |
movl $.LC1, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc | |
.L15: | |
movl %eax, (%esp) | |
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ | |
movl $193491849, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZNSo9_M_insertImEERSoT_ | |
movl %eax, (%esp) | |
call _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ | |
jmp .L4 | |
.L17: | |
movl $.LC0, 4(%esp) | |
movl $_ZSt4cout, (%esp) | |
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc | |
.LEHE0: | |
jmp .L15 | |
.L8: | |
movl %eax, %esi | |
movl %ebx, (%esp) | |
call _ZNSsD1Ev | |
movl %esi, (%esp) | |
.LEHB1: | |
call _Unwind_Resume | |
.LEHE1: | |
.cfi_endproc | |
.LFE1277: | |
.globl __gxx_personality_v0 | |
.section .gcc_except_table,"a",@progbits | |
.LLSDA1277: | |
.byte 0xff | |
.byte 0xff | |
.byte 0x1 | |
.uleb128 .LLSDACSE1277-.LLSDACSB1277 | |
.LLSDACSB1277: | |
.uleb128 .LEHB0-.LFB1277 | |
.uleb128 .LEHE0-.LEHB0 | |
.uleb128 .L8-.LFB1277 | |
.uleb128 0 | |
.uleb128 .LEHB1-.LFB1277 | |
.uleb128 .LEHE1-.LEHB1 | |
.uleb128 0 | |
.uleb128 0 | |
.LLSDACSE1277: | |
.section .text.startup | |
.size main, .-main | |
.p2align 4,,15 | |
.type _GLOBAL__sub_I_main, @function | |
_GLOBAL__sub_I_main: | |
.LFB1437: | |
.cfi_startproc | |
subl $28, %esp | |
.cfi_def_cfa_offset 32 | |
movl $_ZStL8__ioinit, (%esp) | |
call _ZNSt8ios_base4InitC1Ev | |
movl $__dso_handle, 8(%esp) | |
movl $_ZStL8__ioinit, 4(%esp) | |
movl $_ZNSt8ios_base4InitD1Ev, (%esp) | |
call __cxa_atexit | |
addl $28, %esp | |
.cfi_def_cfa_offset 4 | |
ret | |
.cfi_endproc | |
.LFE1437: | |
.size _GLOBAL__sub_I_main, .-_GLOBAL__sub_I_main | |
.section .ctors,"aw",@progbits | |
.align 4 | |
.long _GLOBAL__sub_I_main | |
.local _ZStL8__ioinit | |
.comm _ZStL8__ioinit,1,1 | |
.weakref _ZL20__gthrw_pthread_oncePiPFvvE,pthread_once | |
.weakref _ZL27__gthrw_pthread_getspecificj,pthread_getspecific | |
.weakref _ZL27__gthrw_pthread_setspecificjPKv,pthread_setspecific | |
.weakref _ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_,pthread_create | |
.weakref _ZL20__gthrw_pthread_joinmPPv,pthread_join | |
.weakref _ZL21__gthrw_pthread_equalmm,pthread_equal | |
.weakref _ZL20__gthrw_pthread_selfv,pthread_self | |
.weakref _ZL22__gthrw_pthread_detachm,pthread_detach | |
.weakref _ZL22__gthrw_pthread_cancelm,pthread_cancel | |
.weakref _ZL19__gthrw_sched_yieldv,sched_yield | |
.weakref _ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t,pthread_mutex_lock | |
.weakref _ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t,pthread_mutex_trylock | |
.weakref _ZL31__gthrw_pthread_mutex_timedlockP15pthread_mutex_tPK8timespec,pthread_mutex_timedlock | |
.weakref _ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t,pthread_mutex_unlock | |
.weakref _ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t,pthread_mutex_init | |
.weakref _ZL29__gthrw_pthread_mutex_destroyP15pthread_mutex_t,pthread_mutex_destroy | |
.weakref _ZL30__gthrw_pthread_cond_broadcastP14pthread_cond_t,pthread_cond_broadcast | |
.weakref _ZL27__gthrw_pthread_cond_signalP14pthread_cond_t,pthread_cond_signal | |
.weakref _ZL25__gthrw_pthread_cond_waitP14pthread_cond_tP15pthread_mutex_t,pthread_cond_wait | |
.weakref _ZL30__gthrw_pthread_cond_timedwaitP14pthread_cond_tP15pthread_mutex_tPK8timespec,pthread_cond_timedwait | |
.weakref _ZL28__gthrw_pthread_cond_destroyP14pthread_cond_t,pthread_cond_destroy | |
.weakref _ZL26__gthrw_pthread_key_createPjPFvPvE,pthread_key_create | |
.weakref _ZL26__gthrw_pthread_key_deletej,pthread_key_delete | |
.weakref _ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t,pthread_mutexattr_init | |
.weakref _ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti,pthread_mutexattr_settype | |
.weakref _ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t,pthread_mutexattr_destroy | |
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3" | |
.section .note.GNU-stack,"",@progbits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment