#!/usr/bin/env perl
##
## Copyright (c) 2011, 2012 The University of Utah
## All rights reserved.
##
## This file is distributed under the University of Illinois Open Source
## License.  See the file COPYING for details.

###############################################################################

use strict;
use warnings;

my @l = ("safe_unary_minus_func_int8_t_s",
	 "safe_add_func_int8_t_s_s",
	 "safe_sub_func_int8_t_s_s",
	 "safe_mul_func_int8_t_s_s",
	 "safe_mod_func_int8_t_s_s",
	 "safe_div_func_int8_t_s_s",
	 "safe_lshift_func_int8_t_s_s",
	 "safe_lshift_func_int8_t_s_u",
	 "safe_rshift_func_int8_t_s_s",
	 "safe_rshift_func_int8_t_s_u",
	 "safe_unary_minus_func_int16_t_s",
	 "safe_add_func_int16_t_s_s",
	 "safe_sub_func_int16_t_s_s",
	 "safe_mul_func_int16_t_s_s",
	 "safe_mod_func_int16_t_s_s",
	 "safe_div_func_int16_t_s_s",
	 "safe_lshift_func_int16_t_s_s",
	 "safe_lshift_func_int16_t_s_u",
	 "safe_rshift_func_int16_t_s_s",
	 "safe_rshift_func_int16_t_s_u",
	 "safe_unary_minus_func_int32_t_s",
	 "safe_add_func_int32_t_s_s",
	 "safe_sub_func_int32_t_s_s",
	 "safe_mul_func_int32_t_s_s",
	 "safe_mod_func_int32_t_s_s",
	 "safe_div_func_int32_t_s_s",
	 "safe_lshift_func_int32_t_s_s",
	 "safe_lshift_func_int32_t_s_u",
	 "safe_rshift_func_int32_t_s_s",
	 "safe_rshift_func_int32_t_s_u",
	 "safe_unary_minus_func_int64_t_s",
	 "safe_add_func_int64_t_s_s",
	 "safe_sub_func_int64_t_s_s",
	 "safe_mul_func_int64_t_s_s",
	 "safe_mod_func_int64_t_s_s",
	 "safe_div_func_int64_t_s_s",
	 "safe_lshift_func_int64_t_s_s",
	 "safe_lshift_func_int64_t_s_u",
	 "safe_rshift_func_int64_t_s_s",
	 "safe_rshift_func_int64_t_s_u",
	 "safe_unary_minus_func_uint8_t_u",
	 "safe_add_func_uint8_t_u_u",
	 "safe_sub_func_uint8_t_u_u",
	 "safe_mul_func_uint8_t_u_u",
	 "safe_mod_func_uint8_t_u_u",
	 "safe_div_func_uint8_t_u_u",
	 "safe_lshift_func_uint8_t_u_s",
	 "safe_lshift_func_uint8_t_u_u",
	 "safe_rshift_func_uint8_t_u_s",
	 "safe_rshift_func_uint8_t_u_u",
	 "safe_unary_minus_func_uint16_t_u",
	 "safe_add_func_uint16_t_u_u",
	 "safe_sub_func_uint16_t_u_u",
	 "safe_mul_func_uint16_t_u_u",
	 "safe_mod_func_uint16_t_u_u",
	 "safe_div_func_uint16_t_u_u",
	 "safe_lshift_func_uint16_t_u_s",
	 "safe_lshift_func_uint16_t_u_u",
	 "safe_rshift_func_uint16_t_u_s",
	 "safe_rshift_func_uint16_t_u_u",
	 "safe_unary_minus_func_uint32_t_u",
	 "safe_add_func_uint32_t_u_u",
	 "safe_sub_func_uint32_t_u_u",
	 "safe_mul_func_uint32_t_u_u",
	 "safe_mod_func_uint32_t_u_u",
	 "safe_div_func_uint32_t_u_u",
	 "safe_lshift_func_uint32_t_u_s",
	 "safe_lshift_func_uint32_t_u_u",
	 "safe_rshift_func_uint32_t_u_s",
	 "safe_rshift_func_uint32_t_u_u",
	 "safe_unary_minus_func_uint64_t_u",
	 "safe_add_func_uint64_t_u_u",
	 "safe_sub_func_uint64_t_u_u",
	 "safe_mul_func_uint64_t_u_u",
	 "safe_mod_func_uint64_t_u_u",
	 "safe_div_func_uint64_t_u_u",
	 "safe_lshift_func_uint64_t_u_s",
	 "safe_lshift_func_uint64_t_u_u",
	 "safe_rshift_func_uint64_t_u_s",
	 "safe_rshift_func_uint64_t_u_u",
    );

my %ren;

my $n=0;
foreach my $s (@l) {
    $n++;
    $ren{$s} = "safe_$n";
}

my $prog = "";

while (my $line = <STDIN>) { 
    $prog .= $line;
}

foreach my $s (@l) {
    my $s2 = $ren{$s};
    ($prog =~ s/$s/$s2/g);
}

print $prog;

